Apply Qt settings during runtime

It is no longer required to restart the application to change settings like
the widget style and palette.
This commit is contained in:
Martchus 2023-03-26 21:32:53 +02:00
parent 5a45a46450
commit 9566623651
3 changed files with 5 additions and 2 deletions

View File

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

View File

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

View File

@ -631,6 +631,7 @@ bool TrayWidget::event(QEvent *event)
void TrayWidget::applySettingsOnAllInstances()
{
Settings::values().qt.apply();
for (TrayWidget *instance : s_instances) {
instance->applySettings();
}