From 95666236517f28f8e8d698fcab904fae4b772312 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sun, 26 Mar 2023 21:32:53 +0200 Subject: [PATCH] Apply Qt settings during runtime It is no longer required to restart the application to change settings like the widget style and palette. --- README.md | 5 +++-- tray/application/main.cpp | 1 + tray/gui/traywidget.cpp | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 79aaa2e..3f1950f 100644 --- a/README.md +++ b/README.md @@ -571,8 +571,9 @@ tweaking: WindowsArguments = darkmode=1 ``` -After changing these settings, restart Syncthing Tray. It is not sufficient to -close the last Windows; the process needs to be restarted. +When using Syncthing Tray 1.3.x or older, you need to restart Syncthing Tray for +these changes to have any effect. It is not sufficient to close the last window; +the process needs to be restarted. Note that one can alternatively also enable Windows' "High contrast" setting which seems to bring back the traditional theming/coloring (which has normally been diff --git a/tray/application/main.cpp b/tray/application/main.cpp index e174ac9..b63d840 100644 --- a/tray/application/main.cpp +++ b/tray/application/main.cpp @@ -220,6 +220,7 @@ int runApplication(int argc, const char *const *argv) QObject::connect(&singleInstance, &SingleInstance::newInstance, &runApplication); Settings::restore(); auto &settings = Settings::values(); + settings.qt.disableNotices(); settings.qt.apply(); qtConfigArgs.applySettings(true); if (assumeFirstLaunchArg.isPresent()) { diff --git a/tray/gui/traywidget.cpp b/tray/gui/traywidget.cpp index f3d290a..7e0d41a 100644 --- a/tray/gui/traywidget.cpp +++ b/tray/gui/traywidget.cpp @@ -631,6 +631,7 @@ bool TrayWidget::event(QEvent *event) void TrayWidget::applySettingsOnAllInstances() { + Settings::values().qt.apply(); for (TrayWidget *instance : s_instances) { instance->applySettings(); }