Skip to content

Commit f9ad1d7

Browse files
authored
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.
1 parent 34b68d6 commit f9ad1d7

5 files changed

Lines changed: 21 additions & 1 deletion

File tree

src/DockAreaWidget.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,12 @@ CDockAreaWidget::CDockAreaWidget(CDockManager* DockManager, CDockContainerWidget
460460

461461
d->createTitleBar();
462462
d->ContentsLayout = new DockAreaLayout(d->Layout);
463+
464+
if (CDockManager::testConfigFlag(CDockManager::UseNativeWindows))
465+
{
466+
winId();
467+
}
468+
463469
if (d->DockManager)
464470
{
465471
Q_EMIT d->DockManager->dockAreaCreated(this);

src/DockContainerWidget.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,10 @@ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area)
15741574

15751575
// Remove are from parent splitter and recursively hide tree of parent
15761576
// splitters if it has no visible content
1577-
area->setParent(nullptr);
1577+
if (area->testAttribute(Qt::WA_NativeWindow))
1578+
area->setParent(d->DockManager);
1579+
else
1580+
area->setParent(nullptr);
15781581
internal::hideEmptyParentSplitters(Splitter);
15791582

15801583
// Remove this area from cached areas

src/DockManager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ public Q_SLOTS:
217217
ShowTabTextOnlyForActiveTab =0x8000000, //! Set this flag to show label texts in dock area tabs only for active tabs
218218
DoubleClickUndocksWidget = 0x10000000, //!< If the flag is set, a double click on a tab undocks the widget
219219
TabsAtBottom = 0x20000000, //!< If the flag is set, tabs will be shown at the bottom instead of in the title bar.
220+
UseNativeWindows = 0x40000000, //!< If the flag is set, windows for the dock and area widgets will be native.
220221

221222

222223
DefaultDockAreaButtons = DockAreaHasCloseButton

src/DockWidget.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,11 @@ CDockWidget::CDockWidget(CDockManager *manager, const QString &title, QWidget* p
396396
{
397397
setFocusPolicy(Qt::ClickFocus);
398398
}
399+
400+
if (CDockManager::testConfigFlag(CDockManager::UseNativeWindows))
401+
{
402+
winId();
403+
}
399404
}
400405

401406

src/FloatingDockContainer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,11 @@ CFloatingDockContainer::CFloatingDockContainer(CDockManager *DockManager) :
728728
l->addWidget(d->DockContainer);
729729
#endif
730730

731+
if (CDockManager::testConfigFlag(CDockManager::UseNativeWindows))
732+
{
733+
winId();
734+
}
735+
731736
DockManager->registerFloatingWidget(this);
732737
}
733738

0 commit comments

Comments
 (0)