Qt笔记:的初次使用Qt-Advanced-Docking-System
1. 简单探索
CDockContainerWidget下管理着一些CDockAreaWidget,
CDockAreaWidget管理者一些CDockWidget,
CDockWidget管理者用户创建的具体窗口。
CDockManager继承自CDockContainerWidget,
CDockManager本身管理着一些CDockContainerWidget,CFloatingDockContainer
其中CFloatingDockContainer管理着一些浮动窗口,浮动窗口以独立窗口形式存在(带标题栏、边框),不嵌入主窗口内部
部分类图

2. 简单使用
一般主框架下建一个CDockManager的对象,然后通过这个对象管理Dock窗口。以下是使用示例,官方提供了很多示例https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System
TestQtADS::TestQtADS(QWidget *parent): QMainWindow(parent)
{ui.setupUi(this);m_pDockManager = new ads::CDockManager(this);//DockWidget1auto pDockWidget1 = m_pDockManager->createDockWidget(QString::fromStdWString(L"标题1"), this);auto pLabel = new QLabel("fdsafdasf");pDockWidget1->setWidget(pLabel);pDockWidget1->setFeature(ads::CDockWidget::DockWidgetDeleteOnClose, false);//DockWidget2auto pDockWidget2 = m_pDockManager->createDockWidget(QString::fromStdWString(L"标题2"), this);auto pTableWidget = new QTableWidget();pTableWidget->setColumnCount(5);pTableWidget->setRowCount(10);pDockWidget2->setWidget(pTableWidget);pDockWidget2->setFeature(ads::CDockWidget::DockWidgetDeleteOnClose, true);//DockWidget3auto pDockWidget3 = m_pDockManager->createDockWidget(QString::fromStdWString(L"标题3"), this);auto pTableView3 = new MyTableView();pDockWidget3->setWidget(pTableView3);pDockWidget3->setFeature(ads::CDockWidget::DockWidgetDeleteOnClose, false);//按指定方式停靠auto pExisitingDockArea = m_pDockManager->addDockWidget(ads::DockWidgetArea::CenterDockWidgetArea, pDockWidget1);m_pDockManager->addDockWidget(ads::DockWidgetArea::CenterDockWidgetArea, pDockWidget2, pExisitingDockArea);m_pDockManager->addDockWidget(ads::DockWidgetArea::CenterDockWidgetArea, pDockWidget3, pExisitingDockArea);// Add the toggleViewAction of the dock widget to the menu to give// the user the possibility to show the dock widget if it has been closedauto pMenuView = ui.menuBar->addMenu("View");pMenuView->addAction(pDockWidget1->toggleViewAction());pMenuView->addAction(pDockWidget2->toggleViewAction());pMenuView->addAction(pDockWidget3->toggleViewAction());
}
3. 运行截图

