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 98a161cec624bbb7e58f57c869741b349d96cc9f;
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 f920602e71
commit 35ea6b8282
2 changed files with 1 additions and 7 deletions

View file

@ -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)

View file

@ -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()