From fef65aeeca087e45b61a40315878bf5da65fda53 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 13 Aug 2023 17:02:27 +0300 Subject: [PATCH] Show that the app busy when switching a style. --- .../configpages/puzzlepreferencesconfigurationpage.cpp | 2 ++ .../dialogs/configpages/tapepreferencesconfigurationpage.cpp | 2 ++ .../dialogs/configpages/preferencesconfigurationpage.cpp | 2 ++ src/libs/vmisc/theme/vtheme.cpp | 4 ++++ 4 files changed, 10 insertions(+) diff --git a/src/app/puzzle/dialogs/configpages/puzzlepreferencesconfigurationpage.cpp b/src/app/puzzle/dialogs/configpages/puzzlepreferencesconfigurationpage.cpp index 08aadb470..bceef8e0a 100644 --- a/src/app/puzzle/dialogs/configpages/puzzlepreferencesconfigurationpage.cpp +++ b/src/app/puzzle/dialogs/configpages/puzzlepreferencesconfigurationpage.cpp @@ -121,6 +121,7 @@ auto PuzzlePreferencesConfigurationPage::Apply() -> QStringList auto themeMode = static_cast(ui->comboBoxThemeMode->currentData().toInt()); if (settings->GetThemeMode() != themeMode) { + QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) if (themeMode == VThemeMode::System && VTheme::NativeDarkThemeAvailable()) { @@ -140,6 +141,7 @@ auto PuzzlePreferencesConfigurationPage::Apply() -> QStringList settings->SetThemeMode(themeMode); VTheme::Instance()->ResetThemeSettings(); + QGuiApplication::restoreOverrideCursor(); } if (settings->IsDontUseNativeDialog() != ui->checkBoxDontUseNativeDialog->isChecked()) diff --git a/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp b/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp index 445556a3d..5db773f2f 100644 --- a/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp +++ b/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp @@ -125,6 +125,7 @@ auto TapePreferencesConfigurationPage::Apply() -> QStringList auto themeMode = static_cast(ui->comboBoxThemeMode->currentData().toInt()); if (settings->GetThemeMode() != themeMode) { + QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) if (themeMode == VThemeMode::System && VTheme::NativeDarkThemeAvailable()) { @@ -144,6 +145,7 @@ auto TapePreferencesConfigurationPage::Apply() -> QStringList settings->SetThemeMode(themeMode); VTheme::Instance()->ResetThemeSettings(); + QGuiApplication::restoreOverrideCursor(); } if (settings->IsDontUseNativeDialog() != ui->checkBoxDontUseNativeDialog->isChecked()) diff --git a/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp b/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp index ad6d2167e..9938ca272 100644 --- a/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp +++ b/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp @@ -199,6 +199,7 @@ auto PreferencesConfigurationPage::Apply() -> QStringList auto themeMode = static_cast(ui->comboBoxThemeMode->currentData().toInt()); if (settings->GetThemeMode() != themeMode) { + QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) if (themeMode == VThemeMode::System && VTheme::NativeDarkThemeAvailable()) { @@ -218,6 +219,7 @@ auto PreferencesConfigurationPage::Apply() -> QStringList settings->SetThemeMode(themeMode); VTheme::Instance()->ResetThemeSettings(); + QGuiApplication::restoreOverrideCursor(); } if (settings->IsDontUseNativeDialog() != ui->checkBoxDontUseNativeDialog->isChecked()) diff --git a/src/libs/vmisc/theme/vtheme.cpp b/src/libs/vmisc/theme/vtheme.cpp index 2ab2f2565..5da45f933 100644 --- a/src/libs/vmisc/theme/vtheme.cpp +++ b/src/libs/vmisc/theme/vtheme.cpp @@ -604,6 +604,7 @@ VTheme::VTheme(QObject *parent) } isProcessingColorSchemeChange = true; + QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); VCommonSettings *settings = VAbstractApplication::VApp()->Settings(); VThemeMode themeMode = settings->GetThemeMode(); @@ -624,6 +625,7 @@ VTheme::VTheme(QObject *parent) } ResetThemeSettings(); + QGuiApplication::restoreOverrideCursor(); isProcessingColorSchemeChange = false; }; @@ -645,6 +647,7 @@ VTheme::VTheme(QObject *parent) } isProcessingColorSchemeChange = true; + QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); bool darkTheme = IsInDarkTheme(); if (m_darkTheme != darkTheme) @@ -653,6 +656,7 @@ VTheme::VTheme(QObject *parent) ResetThemeSettings(); } + QGuiApplication::restoreOverrideCursor(); isProcessingColorSchemeChange = false; };