From 75621cc816120597f493e0debc6d88e2e0bbd30a Mon Sep 17 00:00:00 2001 From: glubsy Date: Wed, 15 Jul 2020 22:04:19 +0200 Subject: [PATCH] Prevent Windows from floating if no decoration * Windows users cannot move a window which has no native decorations. Toggling a dock widget's titlebar off also removes native decorations on a floating window. Until we implement a replacement titlebar by overriding paintEvents, simply force the floating window to go back to docked state after we toggled the titlebar off. --- qt/details_dialog.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qt/details_dialog.py b/qt/details_dialog.py index 56555c30..75b4abb1 100644 --- a/qt/details_dialog.py +++ b/qt/details_dialog.py @@ -10,11 +10,13 @@ from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QDockWidget, QWidget from .details_table import DetailsModel +from hscommon.plat import ISLINUX class DetailsDialog(QDockWidget): def __init__(self, parent, app, **kwargs): super().__init__(parent, Qt.Tool, **kwargs) + self.parent = parent self.app = app self.model = app.model.details_panel self.setAllowedAreas(Qt.AllDockWidgetAreas) @@ -44,6 +46,10 @@ class DetailsDialog(QDockWidget): if not self.app.prefs.details_dialog_titlebar_enabled \ and not self.titleBarWidget(): self.setTitleBarWidget(QWidget()) + # Windows (and MacOS?) users cannot move a floating window which + # has not native decoration so we force it to dock for now + if not ISLINUX: + self.setFloating(False) elif self.titleBarWidget() is not None: # resets to the default title bar self.setTitleBarWidget(None)