diff --git a/docs/release_notes/next/fix-2209-theme_os_startup_instability b/docs/release_notes/next/fix-2209-theme_os_startup_instability new file mode 100644 index 00000000000..413bb9cb896 --- /dev/null +++ b/docs/release_notes/next/fix-2209-theme_os_startup_instability @@ -0,0 +1 @@ +#2209: Mantid Imaging now switches between Fusion and qt-material themes correctly \ No newline at end of file diff --git a/mantidimaging/gui/windows/main/presenter.py b/mantidimaging/gui/windows/main/presenter.py index 40bee214c68..7c65df284fc 100644 --- a/mantidimaging/gui/windows/main/presenter.py +++ b/mantidimaging/gui/windows/main/presenter.py @@ -853,28 +853,24 @@ def do_update_UI(self) -> None: override_os_theme = settings.value('override_os_theme') os_theme = settings.value('os_theme') font = QFont(settings.value('default_font_family'), int(extra_style['font_size'].replace('px', ''))) - for window in [ - self.view, self.view.recon, self.view.live_viewer, self.view.spectrum_viewer, self.view.filters, - self.view.settings_window - ]: - if window: - QApplication.instance().setFont(font) - window.setStyleSheet(theme) - if theme == 'Fusion': - if override_os_theme == 'False': - if os_theme == 'Light': - self.use_fusion_light_mode() - elif os_theme == 'Dark': - self.use_fusion_dark_mode() - else: - if use_dark_mode == 'True': - self.use_fusion_dark_mode() - else: - self.use_fusion_light_mode() - QApplication.instance().setFont(font) - window.setStyleSheet(theme) + app = QApplication.instance() + + app.setFont(font) + if theme == 'Fusion': + if override_os_theme == 'False': + if os_theme == 'Light': + self.use_fusion_light_mode() + elif os_theme == 'Dark': + self.use_fusion_dark_mode() + else: + if use_dark_mode == 'True': + self.use_fusion_dark_mode() else: - apply_stylesheet(window, theme=theme, invert_secondary=False, extra=extra_style) + self.use_fusion_light_mode() + app.setStyle(theme) + app.setStyleSheet('') + else: + apply_stylesheet(app, theme=theme, invert_secondary=False, extra=extra_style) @staticmethod def use_fusion_dark_mode() -> None: