mirror of https://github.com/PCSX2/pcsx2.git
Qt: Work around theme switching issue in 6.4.0
Starting in dark theme then switching to native/light would not restore the standard palette.
This commit is contained in:
parent
f79b57d0cf
commit
0dd766cec8
|
@ -93,6 +93,7 @@ const char* MainWindow::DEFAULT_THEME_NAME = "darkfusion";
|
||||||
|
|
||||||
MainWindow* g_main_window = nullptr;
|
MainWindow* g_main_window = nullptr;
|
||||||
static QString s_unthemed_style_name;
|
static QString s_unthemed_style_name;
|
||||||
|
static QPalette s_unthemed_palette;
|
||||||
static bool s_unthemed_style_name_set;
|
static bool s_unthemed_style_name_set;
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__APPLE__)
|
#if defined(_WIN32) || defined(__APPLE__)
|
||||||
|
@ -109,8 +110,7 @@ static bool s_use_central_widget = false;
|
||||||
static bool s_vm_valid = false;
|
static bool s_vm_valid = false;
|
||||||
static bool s_vm_paused = false;
|
static bool s_vm_paused = false;
|
||||||
|
|
||||||
MainWindow::MainWindow(const QString& unthemed_style_name)
|
MainWindow::MainWindow()
|
||||||
: m_unthemed_style_name(unthemed_style_name)
|
|
||||||
{
|
{
|
||||||
pxAssert(!g_main_window);
|
pxAssert(!g_main_window);
|
||||||
g_main_window = this;
|
g_main_window = this;
|
||||||
|
@ -439,7 +439,7 @@ void MainWindow::recreate()
|
||||||
close();
|
close();
|
||||||
g_main_window = nullptr;
|
g_main_window = nullptr;
|
||||||
|
|
||||||
MainWindow* new_main_window = new MainWindow(m_unthemed_style_name);
|
MainWindow* new_main_window = new MainWindow();
|
||||||
new_main_window->initialize();
|
new_main_window->initialize();
|
||||||
new_main_window->refreshGameList(false);
|
new_main_window->refreshGameList(false);
|
||||||
new_main_window->show();
|
new_main_window->show();
|
||||||
|
@ -486,6 +486,7 @@ void MainWindow::updateApplicationTheme()
|
||||||
{
|
{
|
||||||
s_unthemed_style_name_set = true;
|
s_unthemed_style_name_set = true;
|
||||||
s_unthemed_style_name = QApplication::style()->objectName();
|
s_unthemed_style_name = QApplication::style()->objectName();
|
||||||
|
s_unthemed_palette = QApplication::style()->standardPalette();
|
||||||
}
|
}
|
||||||
|
|
||||||
setStyleFromSettings();
|
setStyleFromSettings();
|
||||||
|
@ -498,7 +499,7 @@ void MainWindow::setStyleFromSettings()
|
||||||
|
|
||||||
if (theme == "fusion")
|
if (theme == "fusion")
|
||||||
{
|
{
|
||||||
qApp->setPalette(QApplication::style()->standardPalette());
|
qApp->setPalette(s_unthemed_palette);
|
||||||
qApp->setStyleSheet(QString());
|
qApp->setStyleSheet(QString());
|
||||||
qApp->setStyle(QStyleFactory::create("Fusion"));
|
qApp->setStyle(QStyleFactory::create("Fusion"));
|
||||||
}
|
}
|
||||||
|
@ -770,7 +771,7 @@ void MainWindow::setStyleFromSettings()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qApp->setPalette(QApplication::style()->standardPalette());
|
qApp->setPalette(s_unthemed_palette);
|
||||||
qApp->setStyleSheet(QString());
|
qApp->setStyleSheet(QString());
|
||||||
qApp->setStyle(s_unthemed_style_name);
|
qApp->setStyle(s_unthemed_style_name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public:
|
||||||
static const char* DEFAULT_THEME_NAME;
|
static const char* DEFAULT_THEME_NAME;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(const QString& unthemed_style_name);
|
MainWindow();
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
/// Sets application theme according to settings.
|
/// Sets application theme according to settings.
|
||||||
|
@ -243,8 +243,6 @@ private:
|
||||||
|
|
||||||
Ui::MainWindow m_ui;
|
Ui::MainWindow m_ui;
|
||||||
|
|
||||||
QString m_unthemed_style_name;
|
|
||||||
|
|
||||||
GameListWidget* m_game_list_widget = nullptr;
|
GameListWidget* m_game_list_widget = nullptr;
|
||||||
DisplayWidget* m_display_widget = nullptr;
|
DisplayWidget* m_display_widget = nullptr;
|
||||||
DisplayContainer* m_display_container = nullptr;
|
DisplayContainer* m_display_container = nullptr;
|
||||||
|
|
|
@ -1833,7 +1833,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
// Set theme before creating any windows.
|
// Set theme before creating any windows.
|
||||||
MainWindow::updateApplicationTheme();
|
MainWindow::updateApplicationTheme();
|
||||||
MainWindow* main_window = new MainWindow(QApplication::style()->objectName());
|
MainWindow* main_window = new MainWindow();
|
||||||
|
|
||||||
// Start up the CPU thread.
|
// Start up the CPU thread.
|
||||||
QtHost::HookSignals();
|
QtHost::HookSignals();
|
||||||
|
|
Loading…
Reference in New Issue