mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
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.
This commit is contained in:
parent
3c816b2f11
commit
75621cc816
@ -10,11 +10,13 @@ from PyQt5.QtCore import Qt
|
|||||||
from PyQt5.QtWidgets import QDockWidget, QWidget
|
from PyQt5.QtWidgets import QDockWidget, QWidget
|
||||||
|
|
||||||
from .details_table import DetailsModel
|
from .details_table import DetailsModel
|
||||||
|
from hscommon.plat import ISLINUX
|
||||||
|
|
||||||
|
|
||||||
class DetailsDialog(QDockWidget):
|
class DetailsDialog(QDockWidget):
|
||||||
def __init__(self, parent, app, **kwargs):
|
def __init__(self, parent, app, **kwargs):
|
||||||
super().__init__(parent, Qt.Tool, **kwargs)
|
super().__init__(parent, Qt.Tool, **kwargs)
|
||||||
|
self.parent = parent
|
||||||
self.app = app
|
self.app = app
|
||||||
self.model = app.model.details_panel
|
self.model = app.model.details_panel
|
||||||
self.setAllowedAreas(Qt.AllDockWidgetAreas)
|
self.setAllowedAreas(Qt.AllDockWidgetAreas)
|
||||||
@ -44,6 +46,10 @@ class DetailsDialog(QDockWidget):
|
|||||||
if not self.app.prefs.details_dialog_titlebar_enabled \
|
if not self.app.prefs.details_dialog_titlebar_enabled \
|
||||||
and not self.titleBarWidget():
|
and not self.titleBarWidget():
|
||||||
self.setTitleBarWidget(QWidget())
|
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:
|
elif self.titleBarWidget() is not None:
|
||||||
# resets to the default title bar
|
# resets to the default title bar
|
||||||
self.setTitleBarWidget(None)
|
self.setTitleBarWidget(None)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user