From 5978aaaedcc670684e9c12af27b18da76784c2a5 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Thu, 28 Nov 2019 13:45:15 +0100 Subject: [PATCH] Set attribute Qt::WA_X11NetWmWindowTypeDock permanently for floating widgets --- demo/MainWindow.cpp | 2 +- src/FloatingDockContainer.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/demo/MainWindow.cpp b/demo/MainWindow.cpp index 43a3a54..53892c1 100644 --- a/demo/MainWindow.cpp +++ b/demo/MainWindow.cpp @@ -232,7 +232,7 @@ void MainWindowPrivate::createContent() // Test creation of floating dock widgets DockWidget = createFileSystemTreeDockWidget(ViewMenu); auto FloatingWidget = DockManager->addDockWidgetFloating(DockWidget); - FloatingWidget->move(QPoint(0, 0)); + FloatingWidget->move(QPoint(20, 20)); FloatingWidget = DockManager->addDockWidgetFloating(createLongTextLabelDockWidget(ViewMenu)); FloatingWidget->move(QPoint(100, 100)); diff --git a/src/FloatingDockContainer.cpp b/src/FloatingDockContainer.cpp index 5872ba7..58524e9 100644 --- a/src/FloatingDockContainer.cpp +++ b/src/FloatingDockContainer.cpp @@ -249,6 +249,7 @@ CFloatingDockContainer::CFloatingDockContainer(CDockManager *DockManager) : QDockWidget::setFeatures(QDockWidget::AllDockWidgetFeatures); setTitleBarWidget(d->TitleBar); connect(d->TitleBar, SIGNAL(closeRequested()), SLOT(close())); + setAttribute(Qt::WA_X11NetWmWindowTypeDock, true); #else setWindowFlags( Qt::Window | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint); @@ -509,7 +510,7 @@ void CFloatingDockContainer::startFloating(const QPoint &DragStartMousePos, #ifdef Q_OS_LINUX if (DraggingFloatingWidget == DragState) { - setAttribute(Qt::WA_X11NetWmWindowTypeDock, true); + //setAttribute(Qt::WA_X11NetWmWindowTypeDock, true); d->MouseEventHandler = MouseEventHandler; if (d->MouseEventHandler) { @@ -619,7 +620,7 @@ void CFloatingDockContainer::finishDragging() { ADS_PRINT("CFloatingDockContainer::finishDragging"); #ifdef Q_OS_LINUX - setAttribute(Qt::WA_X11NetWmWindowTypeDock, false); + //setAttribute(Qt::WA_X11NetWmWindowTypeDock, false); setWindowOpacity(1); activateWindow(); if (d->MouseEventHandler)