From ec9e276bc4fd7e950716962fcb81554d727481a5 Mon Sep 17 00:00:00 2001 From: Eric Mehl Date: Tue, 7 Jan 2025 15:46:04 -0500 Subject: [PATCH] CompoundEditor : Fix maximizing detached windows Qt can only `setScreen()` on the top-level Window, which meant that layouts with detached windows that were set to maximized would not be moved to a non-primary screen. By setting the window geometry based on the desired screen, before maximizing, the detached windows get maximized on the right screen. --- python/GafferUI/CompoundEditor.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python/GafferUI/CompoundEditor.py b/python/GafferUI/CompoundEditor.py index bc96d623aa9..169fc89dcbf 100644 --- a/python/GafferUI/CompoundEditor.py +++ b/python/GafferUI/CompoundEditor.py @@ -1429,7 +1429,14 @@ def _restoreWindowState( gafferWindow, boundData ) : screens = QtWidgets.QApplication.screens() if boundData["screen"] < len(screens) : targetScreen = screens[ boundData["screen"] ] - window.setScreen( targetScreen ) + # \todo In Qt6, `setScreen()` is added to `QWidget` which we should + # be able to use to set the screen including for detached windows. + + window.setWindowState( QtCore.Qt.WindowNoState ) + + screenGeom = targetScreen.availableGeometry() + geometry = window.geometry() + window.setGeometry( screenGeom.x(), screenGeom.y(), geometry.width(), geometry.height() ) if boundData["fullScreen"] : window.setWindowState( QtCore.Qt.WindowFullScreen )