本文主要是介绍Qt-Advanced-Docking-System的学习,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Qt-Advanced-Docking-System使用说明_cdockmanager-CSDN博客
示例1:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H#include <QMainWindow>
#include "DockManager.h"
#include "QtDock/DockAreaWidget.h"
namespace Ui {
class MainWindow;
}class MainWindow : public QMainWindow
{Q_OBJECTpublic:explicit MainWindow(QWidget *parent = 0);~MainWindow();private:Ui::MainWindow *ui;ads::CDockManager* m_pDockManger;
};#endif // MAINWINDOW_H
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QLabel>
MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent),ui(new Ui::MainWindow)
{ui->setupUi(this);//创建CDockManager对象m_pDockManger=new ads::CDockManager(this);this->setCentralWidget(m_pDockManger);//创建CDockWidget窗口对象ads::CDockWidget* pDockWidget1=new ads::CDockWidget("页面1");//QLabel对象QLabel *Label=new QLabel(pDockWidget1);Label->setText("demo");//添加容器pDockWidget1->setWidget(Label);//将pDockWidget1添入CDockManager页面布局中m_pDockManger->addDockWidget(ads::RightDockWidgetArea,pDockWidget1);
}MainWindow::~MainWindow()
{delete ui;
}
示例2:
//创建CDockManager对象m_pDockManger=new ads::CDockManager(this);this->setCentralWidget(m_pDockManger);//创建CDockWidget窗口对象ads::CDockWidget* pDockWidget1=new ads::CDockWidget("页面1");//QLabel对象QLabel *Label=new QLabel(pDockWidget1);Label->setText("demo");//添加容器pDockWidget1->setWidget(Label);//将pDockWidget1添入CDockManager页面布局中m_pDockManger->addDockWidget(ads::RightDockWidgetArea,pDockWidget1);ads::CDockWidget* pDockWidget2=new ads::CDockWidget("页面2");QLabel *Label2=new QLabel(pDockWidget2);Label2->setText("demo2");pDockWidget2->setWidget(Label2);m_pDockManger->addDockWidget(ads::LeftDockWidgetArea,pDockWidget2);
示例3:
//创建CDockManager对象m_pDockManger=new ads::CDockManager(this);this->setCentralWidget(m_pDockManger);//创建CDockWidget窗口对象ads::CDockWidget* pDockWidget1=new ads::CDockWidget("页面1");//QLabel对象QLabel *Label=new QLabel(pDockWidget1);Label->setText("demo");//添加容器pDockWidget1->setWidget(Label);//将pDockWidget1添入CDockManager页面布局中m_pDockManger->addDockWidget(ads::RightDockWidgetArea,pDockWidget1);ads::CDockWidget* pDockWidget2=new ads::CDockWidget("页面2");QLabel *Label2=new QLabel(pDockWidget2);Label2->setText("demo2");pDockWidget2->setWidget(Label2);m_pDockManger->addDockWidget(ads::LeftDockWidgetArea,pDockWidget2);ads::CDockWidget* pDockWidget3=new ads::CDockWidget("页面3");QLabel *Label3=new QLabel(pDockWidget3);Label3->setText("demo3");pDockWidget3->setWidget(Label3);m_pDockManger->addDockWidget(ads::TopDockWidgetArea,pDockWidget3);
示例4:
ads::CDockManager::setConfigFlag(ads::CDockManager::ActiveTabHasCloseButton, false);
ads::CDockManager::setConfigFlag(ads::CDockManager::ActiveTabHasCloseButton, true);
不显示tab
pDockWidget1->setFeature(ads::CDockWidget::NoTab,true);
使用qss
pDockWidget1->setStyleSheet("background-color: rgb(224, 220, 216);");
这篇关于Qt-Advanced-Docking-System的学习的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!