### Install Python Bindings Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System Commands to install the Advanced Docking System bindings for different Python frameworks via pip. ```bash pip install PySide6-QtAds ``` ```bash pip install PyQt6Ads ``` -------------------------------- ### Install Build Dependencies on Linux Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System Commands to install required Qt private headers and SVG support on Ubuntu systems. ```bash sudo apt install qt5-default qtbase5-private-dev ``` ```bash sudo apt install qtbase5-dev qtbase5-private-dev qtbase5-dev-tools libqt5svg5 libqt5qml5 qtdeclarative5-dev ``` ```bash sudo apt install qt6-default qt6-base-dev qt6-base-private-dev qt6-tools-dev libqt6svg6 qt6-qtdeclarative ``` -------------------------------- ### Manually Focus Non-Focusable Widgets Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html Install an event filter on widgets that do not support native focus to manually trigger dock focus via mouse events. ```cpp static ads::CDockWidget* createVTK2DWindow(QMenu* ViewMenu, QObject* EventFilter) { QVTKOpenGLStereoWidget* qvtkOpenGLStereoWidget = new QVTKOpenGLStereoWidget; ads::CDockWidget* DockWidget = new ads::CDockWidget("2D Window"); DockWidget->setWidget(qvtkOpenGLStereoWidget); qvtkOpenGLStereoWidget->installEventFilter(EventFilter); qvtkOpenGLStereoWidget->setProperty("DockWidget", QVariant::fromValue(DockWidget)); return DockWidget; } ``` ```cpp bool CMainWindow::eventFilter(QObject *watched, QEvent *event) { if (event->type() == QEvent::MouseButtonPress) { QVTKOpenGLStereoWidget* vtkWidget = qobject_cast(watched); auto vDockWidget = vtkWidget->property("DockWidget"); ads::CDockWidget* DockWidget = nullptr; if (vDockWidget.isValid()) { DockWidget = qvariant_cast(vDockWidget); } if (DockWidget) { d->DockManager->setDockWidgetFocused(DockWidget); } } return false; } ``` -------------------------------- ### Implement MainWindow Logic Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System Implementation of the dock manager initialization and widget registration within the MainWindow constructor. ```cpp #include "MainWindow.h" #include "ui_MainWindow.h" #include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); // Create the dock manager after the ui is setup. Because the // parent parameter is a QMainWindow the dock manager registers // itself as the central widget as such the ui must be set up first. DockManager = new ads::CDockManager(this); // Create example content label - this can be any application specific // widget QLabel* l = new QLabel(); l->setWordWrap(true); l->setAlignment(Qt::AlignTop | Qt::AlignLeft); l->setText("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. "); // Create a dock widget with the title Label 1 and set the created label // as the dock widget content ads::CDockWidget* DockWidget = DockManager->createDockWidget("Label 1"); DockWidget->setWidget(l); // 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 closed ui->menuView->addAction(DockWidget->toggleViewAction()); // Add the dock widget to the top dock widget area DockManager->addDockWidget(ads::TopDockWidgetArea, DockWidget); } MainWindow::~MainWindow() { delete ui; } ``` -------------------------------- ### Configure OpenGL Context Sharing Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html Set the Qt::AA_ShareOpenGLContexts attribute before initializing the QApplication instance to enable OpenGL widget support. ```cpp int main(int argc, char *argv[]) { QApplication::setAttribute(Qt::AA_ShareOpenGLContexts); QApplication application(argc, argv); ... } ``` -------------------------------- ### Set X11 Session for Wayland Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System Environment variable configuration to force X11 session type on older Qt versions that lack Wayland drag protocol support. ```bash XDG_SESSION_TYPE=x11 ./AdvancedDockingSystemDemo ``` -------------------------------- ### Setting Configuration Flags Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html Configure the dock manager by setting flags before instantiating the CDockManager. Use predefined configurations as a base and modify individual flags as needed. ```cpp CDockManager::setConfigFlags(CDockManager::DefaultOpaqueConfig); CDockManager::setConfigFlag(CDockManager::RetainTabSizeWhenCloseButtonHidden, true); ... d->DockManager = new CDockManager(this); ``` -------------------------------- ### Configure Dynamic Drag Preview Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html Sets the drag preview to be dynamic and disables content pixmap and window frame for an optimal visual effect. ```cpp CDockManager::setConfigFlag(CDockManager::DragPreviewIsDynamic, true); CDockManager::setConfigFlag(CDockManager::DragPreviewShowsContentPixmap, false); CDockManager::setConfigFlag(CDockManager::DragPreviewHasWindowFrame, false); ``` -------------------------------- ### Configure and Add Auto-Hide Widgets Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html Sets the global auto-hide configuration flags and adds a specific dock widget to the left sidebar. ```cpp CDockManager::setAutoHideConfigFlags(CDockManager::DefaultAutoHideConfig); d->DockManager = new CDockManager(this); CDockWidget* TableDockWidget = new CDockWidget("Table 1"); DockManager->addAutoHideDockWidget(SideBarLeft, TableDockWidget); ``` -------------------------------- ### Define Minimum Size Hint Modes Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html The eMinimumSizeHintMode enum controls how the dock widget calculates its minimum size hint for layout management. ```cpp enum eMinimumSizeHintMode { MinimumSizeHintFromDockWidget, MinimumSizeHintFromContent, MinimumSizeHintFromDockWidgetMinimumSize, MinimumSizeHintFromContentMinimumSize, }; ``` -------------------------------- ### Configure Color Scheme Mode Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html Sets the automatic theme selection behavior for the dock manager. ```cpp DockManager->setColorSchemeMode(CDockManager::ColorSchemeMode::FollowPalette); ``` -------------------------------- ### Define MainWindow Header Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System Header file definition for a QMainWindow subclass that includes the CDockManager container. ```cpp #include #include "DockManager.h" namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private: Ui::MainWindow *ui; // The main container for docking ads::CDockManager* m_DockManager; }; ``` -------------------------------- ### Configure Auto-Hide Flags Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html Set global configuration and Auto-Hide flags before creating the CDockManager instance. ```cpp CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true); CDockManager::setAutoHideConfigFlags(CDockManager::DefaultAutoHideConfig); CDockManager::setAutoHideConfigFlag(CDockManager::AutoHideShowOnMouseOver, true); ... d->DockManager = new CDockManager(this); ``` -------------------------------- ### Insert Dock Widget Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html Add a dock widget to a specific area within the dock manager. ```cpp d->DockManager->addDockWidget(ads::RightDockWidgetArea, DockWidget, EditorArea); ``` -------------------------------- ### Define Dock Widget Insert Modes Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html The eInsertMode enum determines how content widgets are wrapped or inserted into the docking system. ```cpp enum eInsertMode { AutoScrollArea, ForceScrollArea, ForceNoScrollArea }; ``` -------------------------------- ### Set Dock Widget Insert Mode Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html Apply an insert mode when assigning a widget to a CDockWidget instance. ```cpp DockWidget->setWidget(widget, CDockWidget::AutoScrollArea); ``` -------------------------------- ### Style Focused Dock Widgets with CSS Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html Use these CSS selectors to customize the appearance of focused dock widgets and their tabs when FocusHighlighting is enabled. ```css /* Color the tab with the highlight color */ ads--CDockWidgetTab[focused="true"] { background: palette(highlight); border-color: palette(highlight); } /* Use a different colored close button icon to match the test color */ ads--CDockWidgetTab[focused="true"] > #tabCloseButton { qproperty-icon: url(:/ads/images/close-button-focused.svg) } /* Make a hovered focused close button a little bit lighter */ ads--CDockWidgetTab[focused="true"] > #tabCloseButton:hover { background: rgba(255, 255, 255, 48); } /* Make a pressed focused close button even more lighter */ ads--CDockWidgetTab[focused="true"] > #tabCloseButton:pressed { background: rgba(255, 255, 255, 92); } /* Use a different color for the tab label */ ads--CDockWidgetTab[focused="true"] QLabel { color: palette(light); } /* Paint a nice solid line for the whole title bar to create the illusion of an active tab */ ads--CDockAreaWidget[focused="true"] ads--CDockAreaTitleBar { background: transparent; border-bottom: 2px solid palette(highlight); padding-bottom: 0px; } ``` -------------------------------- ### Auto-Hide Sidebar API Methods Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html Getter and setter methods for managing the preferred auto-hide sidebar location. ```cpp void setPreferredAutoHideSideBarLocation(SideBarLocation location); SideBarLocation preferredAutoHideSideBarLocation() const; ``` -------------------------------- ### Set Preferred Auto-Hide Sidebar Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html Forces a dock widget to pin to a specific sidebar, overriding the default geometry-based detection. ```cpp dockWidget->setPreferredAutoHideSideBarLocation(SideBarLeft); ``` -------------------------------- ### Create an empty dock area Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html Configures a dock widget to remain visible as a central area by setting the NoTab feature flag. ```cpp QLabel* label = new QLabel(); label->setText("This is a DockArea which is always visible, even if it does not contain any DockWidgets."); label->setAlignment(Qt::AlignCenter); CDockWidget* CentralDockWidget = new CDockWidget("CentralWidget"); CentralDockWidget->setWidget(label); CentralDockWidget->setFeature(ads::CDockWidget::NoTab, true);// set the flag before adding the widget to dock manager auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget); ``` -------------------------------- ### Set a central widget in DockManager Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html Assigns a dock widget as the central component. This must be the first widget added to the manager. ```cpp auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget); ``` -------------------------------- ### Globally Lock and Unlock Dock Widget Features Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html Use these methods on the DockManager to freeze or unfreeze the layout of all dock widgets. ```cpp DockManager->lockDockWidgetFeaturesGlobally(); DockManager->lockDockWidgetFeaturesGlobally(CDockWidget::NoDockWidgetFeatures); ``` -------------------------------- ### Disable Internal Style Sheet Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html Disables the default internal stylesheet to allow for custom application-wide styling. ```cpp DockManager->setStyleSheet(""); ``` ```cpp CDockManager::setConfigFlag(CDockManager::DisableStyleheet, true); ``` -------------------------------- ### CDockManager::setConfigFlag Source: https://githubuser0xffff.github.io/Qt-Advanced-Docking-System/doc/user-guide.html Sets a specific configuration flag for the CDockManager to control UI behavior and appearance. ```APIDOC ## CDockManager::setConfigFlag ### Description Sets a configuration flag to enable or disable specific features of the docking system, such as drag preview behavior, button visibility, or title bar display. ### Method void CDockManager::setConfigFlag(ConfigFlag flag, bool on) ### Parameters - **flag** (ConfigFlag) - Required - The specific configuration flag to modify (e.g., DragPreviewIsDynamic, AlwaysShowTabs, DockAreaHasUndockButton). - **on** (bool) - Required - True to enable the flag, false to disable it. ### Example ```cpp CDockManager::setConfigFlag(CDockManager::DragPreviewIsDynamic, true); CDockManager::setConfigFlag(CDockManager::AlwaysShowTabs, true); ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.