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.
This commit is contained in:
Damien Elmes 2023-05-18 08:53:42 +10:00
parent eebd143a9f
commit 4e65793966
2 changed files with 1 additions and 7 deletions

View file

@ -148,7 +148,7 @@ class Browser(QMainWindow):
if self.layoutDirection() == Qt.LayoutDirection.RightToLeft if self.layoutDirection() == Qt.LayoutDirection.RightToLeft
else "editor" else "editor"
) )
restoreGeom(self, self._editor_state_key, 0) restoreGeom(self, self._editor_state_key)
restoreSplitter(self.form.splitter, "editor3") restoreSplitter(self.form.splitter, "editor3")
restoreState(self, self._editor_state_key) restoreState(self, self._editor_state_key)

View file

@ -703,18 +703,12 @@ def saveGeom(widget: QWidget, key: str) -> None:
def restoreGeom( def restoreGeom(
widget: QWidget, widget: QWidget,
key: str, key: str,
offset: int | None = None,
adjustSize: bool = False, adjustSize: bool = False,
default_size: tuple[int, int] | None = None, default_size: tuple[int, int] | None = None,
) -> None: ) -> None:
key += "Geom" key += "Geom"
if existing_geom := aqt.mw.pm.profile.get(key): if existing_geom := aqt.mw.pm.profile.get(key):
widget.restoreGeometry(existing_geom) 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) ensureWidgetInScreenBoundaries(widget)
elif adjustSize: elif adjustSize:
widget.adjustSize() widget.adjustSize()