From 9168d72f38faaf0a12230cd544f14190cd29fca4 Mon Sep 17 00:00:00 2001 From: glubsy Date: Wed, 15 Jul 2020 22:47:32 +0200 Subject: [PATCH] Update preferences on show(), not in constructor * If the dialog window shouldn't have a titlebar during construction, update accordingly only when showing to fix Windows displaying a window without titlebar on first show * Only save geometry if the window is floating. Otherwise geometry while docked is saved whih gives weird results on subsequent starts, since it may be floating by default anyway (at least on Linux where titlebar being disabled is allowed while floating) * Vertical title bar doesn't seem to work on Windows, add note in preferences dialog --- qt/details_dialog.py | 4 ++-- qt/preferences_dialog.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/qt/details_dialog.py b/qt/details_dialog.py index 75b4abb1..7b3f07d5 100644 --- a/qt/details_dialog.py +++ b/qt/details_dialog.py @@ -21,7 +21,6 @@ class DetailsDialog(QDockWidget): self.model = app.model.details_panel self.setAllowedAreas(Qt.AllDockWidgetAreas) self._setupUi() - self.update_options() # To avoid saving uninitialized geometry on appWillSavePrefs, we track whether our dialog # has been shown. If it has, we know that our geometry should be saved. self._shown_once = False @@ -39,6 +38,7 @@ class DetailsDialog(QDockWidget): def show(self): self._shown_once = True super().show() + self.update_options() def update_options(self): # This disables the title bar (if we had not set one before already) @@ -62,7 +62,7 @@ class DetailsDialog(QDockWidget): # --- Events def appWillSavePrefs(self): - if self._shown_once: + if self._shown_once and self.isFloating(): self.app.prefs.saveGeometry("DetailsWindowRect", self) # --- model --> view diff --git a/qt/preferences_dialog.py b/qt/preferences_dialog.py index 2603eeb4..95eb1b67 100644 --- a/qt/preferences_dialog.py +++ b/qt/preferences_dialog.py @@ -118,14 +118,14 @@ class PreferencesDialogBase(QDialog): horizontalWrap([self.fontSizeLabel, self.fontSizeSpinBox, None]) ) self._setupAddCheckbox("reference_bold_font", - tr("Bold font for reference.")) + tr("Bold font for reference")) self.widgetsVLayout.addWidget(self.reference_bold_font) self._setupAddCheckbox("details_dialog_titlebar_enabled", tr("Details dialog displays a title bar and is dockable")) self.widgetsVLayout.addWidget(self.details_dialog_titlebar_enabled) self._setupAddCheckbox("details_dialog_vertical_titlebar", - tr("Details dialog displays a vertical title bar.")) + tr("Details dialog displays a vertical title bar (Linux only)")) self.widgetsVLayout.addWidget(self.details_dialog_vertical_titlebar) self.details_dialog_vertical_titlebar.setEnabled( self.details_dialog_titlebar_enabled.isChecked())