DolphinQt: reset stylesheets on colorSchemeChanged

This is required for switching system color scheme
(dark/light) dynamically at runtime.
This commit is contained in:
Shawn Hoffman
2023-04-25 00:12:59 -07:00
parent 8c2e924255
commit bb227ad7bb
4 changed files with 42 additions and 6 deletions

View File

@ -14,6 +14,7 @@
#include <QIcon>
#include <QMimeData>
#include <QStackedWidget>
#include <QStyleHints>
#include <QVBoxLayout>
#include <QWindow>
@ -238,6 +239,13 @@ MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters,
ConnectMenuBar();
ConnectHotkeys();
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged, this,
[](Qt::ColorScheme colorScheme) {
Settings::Instance().SetCurrentUserStyle(Settings::Instance().GetCurrentUserStyle());
});
#endif
connect(m_cheats_manager, &CheatsManager::OpenGeneralSettings, this,
&MainWindow::ShowGeneralWindow);