From 4e657939667635a1cdc55e4c106689b230930837 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 18 May 2023 08:53:42 +1000 Subject: [PATCH] Remove offset workaround in restoreGeom() Way back in Qt4, there was an issue where (some?) windows would open at a different location to where they were previously open. I've tested the primary windows in Qt 5.14 on macOS, and the issue no longer seems to exist, so this code is no longer useful. The qtmajor > 5 check was a mistake introduced in 70dbd06be3ff56f13b9efe7c886c2a6c4f873ce9; it was intended to limit the code to Qt 5. A quick grep of an add-on snapshot indicates there are no add-ons that were using the offset param, so it has been removed. --- qt/aqt/browser/browser.py | 2 +- qt/aqt/utils.py | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/qt/aqt/browser/browser.py b/qt/aqt/browser/browser.py index bdfa26f47..393360259 100644 --- a/qt/aqt/browser/browser.py +++ b/qt/aqt/browser/browser.py @@ -148,7 +148,7 @@ class Browser(QMainWindow): if self.layoutDirection() == Qt.LayoutDirection.RightToLeft else "editor" ) - restoreGeom(self, self._editor_state_key, 0) + restoreGeom(self, self._editor_state_key) restoreSplitter(self.form.splitter, "editor3") restoreState(self, self._editor_state_key) diff --git a/qt/aqt/utils.py b/qt/aqt/utils.py index 7879f238f..97bf00bb1 100644 --- a/qt/aqt/utils.py +++ b/qt/aqt/utils.py @@ -703,18 +703,12 @@ def saveGeom(widget: QWidget, key: str) -> None: def restoreGeom( widget: QWidget, key: str, - offset: int | None = None, adjustSize: bool = False, default_size: tuple[int, int] | None = None, ) -> None: key += "Geom" if existing_geom := aqt.mw.pm.profile.get(key): widget.restoreGeometry(existing_geom) - if is_mac and offset: - if qtmajor > 5 or qtminor > 6: - # bug in osx toolkit - s = widget.size() - widget.resize(s.width(), s.height() + offset * 2) ensureWidgetInScreenBoundaries(widget) elif adjustSize: widget.adjustSize()