1 Overview
1.1 Introduction
This is a Qt-based and perfect Dock window layout solution on GitHub - Qt-Advanced-Docking-System , which supports cross-platform Windows , Linux and MacOS . Qt-Advanced-Docking-System provides a high-degree-of-freedom Dock window management interface, allowing users to create customizable window layouts, and implement window layout management similar to mainstream IDEs, design software and tool software, such as Visual Studio . Compared with the native Dock layout management of QMainWindow in Qt, Qt-Advanced-Docking-System has higher degrees of freedom, flexibility and scalability.
1.2 GitHub address
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System
2 features
2.1 The Dock window can be docked anywhere
There is no central window in Qt-Advanced-Docking-System , you can dock the Dock window on every border of the main window, or you can dock to each docking area, so you can dock the Dock window almost anywhere freely.
2.2 The Dock window supports docking in floating windows
In Qt-Advanced-Docking-System , there is no difference between the main window and the floating window, and it is supported to dock the Dock window in the floating window.
2.3 Support simultaneous dragging of Dock windows in tabs in the same area
When dragging the title bar of a Dock window, all Dock window tabs in the same area as it will be dragged. Thus, you can move full tabbed window areas to floating windows, or from one dock to another.
2.4 Support layout saving and free switching
Qt-Advanced-Docking-System provides DockManager support to save the layout of the current Dock window to the view configuration and create custom views. At the same time, it also supports selecting a view configuration from the existing view configuration list to quickly switch the complete main window layout.
2.5 Splitter supports two drag interaction methods
1. When dragging the splitter, the Dock window dynamically adjusts the window size. This property takes effect when the global parameter " OpaqueSplitterResize " is set to " true ".
2. When dragging the splitter, the size of the Dock window will change after dragging the splitter and releasing the mouse. This property takes effect when the global parameter " OpaqueSplitterResize " is set to " false ".
2.6 Support multi-tab management menu in the same area
If there are too many Dock windows in the same area, you can use the tab menu provided in the title bar to switch and manage tabs.
2.7 Support multiple interactive methods to separate the Dock window
1. By dragging the Dock window tab or the title bar of the docking area;
2. By double-clicking the Dock window tab or the title bar;
3. Through the tab menu management;
2.8 Support for creating and deleting temporary Dock windows
In general, clicking the close button of the Dock window will only hide the window, and the user can also use the toggleView method of the Dock window to control the visibility of the Dock window. If the " DockWidgetDeleteOnClose " property is set for the Dock window , it will be deleted once the Dock window is closed.
2.9 Support Python PyQt5
Qt-Advanced-Docking-System provides a complete Python integration solution based on PyQt5 .
2.10 Qt version compatible
The library supports Qt5 and Qt6 .
2.11 Support cross-platform
2.11.1 Windows support
Qt-Advanced-Docking-System 's support for Windows is almost perfect, because the library was originally developed for Windows applications.
2.11.2 Support for Linux
Due to the relative complexity of the Linux environment, there are various distributions. So it is impossible to support it perfectly like Windows . Only a small subset of Linux distributions are supported and tested . The library can be compiled, developed and run on the following Linux distributions :
1. Free 18.04 and 19.10
2. Ubuntu 18.04, 19.10 and 20.04
2.11.3 Support MacOS
The library supports MacOS and can be compiled, developed and run on MacOS .
3 use cases
3.1 Qt Creator
Starting from Qt Creator 4.12 version, its tool Qt Quick Designer uses the Qt-Advanced-Docking-System , which improves usability when using multiple screens.
Qt Creator official link
3.2 Qt Design Studio
The most obvious change in Qt Design Studio 1.5 is the integration of the Dock window using the Qt-Advanced-Docking-System .
Qt Design Studio official link
3.3 CETONI Elements
CETONI Elements software is a comprehensive, plug-in-based and modular laboratory automation software.
CETONI Elements official link
3.4 ezEditor
ezEditor is a complete graphics editor, and ezEngine is an open source c++ game engine under development.
ezEditor official link
3.5 D-Tect X
D-Tect X is an X-ray inspection software for industrial radiography.
D-Tect X official link
3.6 HiveWE
HiveWE is a world editor for the game " Warcraft III ".
HiveWE official link
3.7 Ramses Composer
Ramses Composer is an authoring tool for the open source engine " Ramses ".
Ramses is a low-level rendering engine optimized for embedded hardware mobile devices, automotive ecu, IoT electronics. Ramses was originally developed by the BMW Group and made open source in 2018. It is an important part of BMW's infotainment cluster and digital portfolio.
Ramses Composer official link
3.8 Plot Juggler
Plot Juggler is a fast, powerful and intuitive time series visualization tool. It makes it easy to visualize data and it also makes it easy to analyze it.
Plot Juggler official link
3.9 Notepad Next
Notepad Next is a cross-platform reimplementation of Notepad++ that uses the Qt-Advanced-Docking-System for view layout.
Notepad Next official link
3.10 MetGem
MetGem is an open source software for visualization of tandem mass spectrometry data.
MetGem official link
3.11 PRE Workbench
PRE Workbench is a software used by researchers who reverse engineer protocols to document their results.
PRE Workbench is a software developed in Python , using Qt-Advanced-Docking-System PyQt integration.
PRE Workbench official link
4 Compile and run
Linux system construction requires Qt private header files, make sure they are installed, if not installed, please execute the following command to install:
sudo apt install qtbase5-private-dev
Open the ads.pro file with QtCreator and start building.
5 sample program
The example below shows the minimal code required to use the Qt-Advanced-Docking-System.
MainWindow.h
#include <QMainWindow> #include "DockManager.h" namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private: Ui::MainWindow *ui; // Dock窗口主管理器 ads::CDockManager* m_DockManager; };
MainWindow.cpp
#include "MainWindow.h" #include "ui_MainWindow.h" #include <QLabel> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); // 带ui的MainWindow,必须在setupUi调用完成后构造CDockManager, // 因为CDockManager的构造将传入父窗口MainWindow, // 并且CDockManager会将自身注册为MainWindow的中心窗体 m_DockManager = new ads::CDockManager(this); // 构造一个界面小部件QLabel对象l,l将作为示例Dock窗口中的内容显示 QLabel* l = new QLabel(); l->setWordWrap(true); l->setAlignment(Qt::AlignTop | Qt::AlignLeft); l->setText("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. "); // 构造一个标题为“Label 1”的Dock窗口 // 并将QLabel对象l设置为该Dock窗口的内容显示 ads::CDockWidget* DockWidget = new ads::CDockWidget("Label 1"); DockWidget->setWidget(l); // 将Dock窗口的toggleViewAction添加到MainWindow的菜单中 // 用于在MainWindow菜单中控制Dock窗口的显隐 ui->menuView->addAction(DockWidget->toggleViewAction()); // 将Dock窗口添加到顶部停靠区域 m_DockManager->addDockWidget(ads::TopDockWidgetArea, DockWidget); } MainWindow::~MainWindow() { delete ui; }