Use Native Windows (#797)

* Avoid changing to a top-level window when moving a native window.

* Support using native windows for the dock/area widgets.
This commit is contained in:
André Vautour
2026-01-15 16:39:51 -04:00
committed by GitHub
parent 34b68d6eab
commit f9ad1d7801
5 changed files with 21 additions and 1 deletions

View File

@@ -460,6 +460,12 @@ CDockAreaWidget::CDockAreaWidget(CDockManager* DockManager, CDockContainerWidget
d->createTitleBar();
d->ContentsLayout = new DockAreaLayout(d->Layout);
if (CDockManager::testConfigFlag(CDockManager::UseNativeWindows))
{
winId();
}
if (d->DockManager)
{
Q_EMIT d->DockManager->dockAreaCreated(this);

View File

@@ -1574,7 +1574,10 @@ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area)
// Remove are from parent splitter and recursively hide tree of parent
// splitters if it has no visible content
area->setParent(nullptr);
if (area->testAttribute(Qt::WA_NativeWindow))
area->setParent(d->DockManager);
else
area->setParent(nullptr);
internal::hideEmptyParentSplitters(Splitter);
// Remove this area from cached areas

View File

@@ -217,6 +217,7 @@ public:
ShowTabTextOnlyForActiveTab =0x8000000, //! Set this flag to show label texts in dock area tabs only for active tabs
DoubleClickUndocksWidget = 0x10000000, //!< If the flag is set, a double click on a tab undocks the widget
TabsAtBottom = 0x20000000, //!< If the flag is set, tabs will be shown at the bottom instead of in the title bar.
UseNativeWindows = 0x40000000, //!< If the flag is set, windows for the dock and area widgets will be native.
DefaultDockAreaButtons = DockAreaHasCloseButton

View File

@@ -396,6 +396,11 @@ CDockWidget::CDockWidget(CDockManager *manager, const QString &title, QWidget* p
{
setFocusPolicy(Qt::ClickFocus);
}
if (CDockManager::testConfigFlag(CDockManager::UseNativeWindows))
{
winId();
}
}

View File

@@ -728,6 +728,11 @@ CFloatingDockContainer::CFloatingDockContainer(CDockManager *DockManager) :
l->addWidget(d->DockContainer);
#endif
if (CDockManager::testConfigFlag(CDockManager::UseNativeWindows))
{
winId();
}
DockManager->registerFloatingWidget(this);
}