From: Michael Schuster Date: Thu, 26 Sep 2019 02:59:17 +0000 (+0200) Subject: Fix White Window issue on Windows after Qt 5.12.4 upgrade X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~632^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8f616969ab482c72092cb7c037a91292a0f159e1;p=nextcloud-desktop.git Fix White Window issue on Windows after Qt 5.12.4 upgrade Qt 5.12.4 seems to introduce a new bug on Windows, causing the settings window to not be redrawn when re-opening it, for example by clicking at the tray icon. As a workaround this fix starts a 100 ms timer to be fired once upon QDialog::showEvent is called. Signed-off-by: Michael Schuster --- diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp index e91b96853..841e8bbb2 100644 --- a/src/gui/settingsdialog.cpp +++ b/src/gui/settingsdialog.cpp @@ -168,6 +168,23 @@ void SettingsDialog::changeEvent(QEvent *e) QDialog::changeEvent(e); } +// FIX - White Window issue on Windows after Qt 5.12.4 upgrade /////////////////////////////// +#if (defined(Q_OS_WIN) && (QT_VERSION >= QT_VERSION_CHECK(5, 12, 4))) +void SettingsDialog::showEvent(QShowEvent *e) +{ + QDialog::showEvent(e); + + QTimer::singleShot(100, this, &SettingsDialog::timerShowEvent); +} + +void SettingsDialog::timerShowEvent() +{ + update(); + repaint(); +} +#endif +// FIX - White Window issue on Windows after Qt 5.12.4 upgrade /////////////////////////////// + void SettingsDialog::slotSwitchPage(QAction *action) { _ui->stack->setCurrentWidget(_actionGroupWidgets.value(action)); diff --git a/src/gui/settingsdialog.h b/src/gui/settingsdialog.h index 97d15c03c..6ae5f8896 100644 --- a/src/gui/settingsdialog.h +++ b/src/gui/settingsdialog.h @@ -68,10 +68,22 @@ protected: void accept() override; void changeEvent(QEvent *) override; + // FIX - White Window issue on Windows after Qt 5.12.4 upgrade /////////////////////////////// + #if (defined(Q_OS_WIN) && (QT_VERSION >= QT_VERSION_CHECK(5, 12, 4))) + void showEvent(QShowEvent *) override; + #endif + // FIX - White Window issue on Windows after Qt 5.12.4 upgrade /////////////////////////////// + private slots: void accountAdded(AccountState *); void accountRemoved(AccountState *); + // FIX - White Window issue on Windows after Qt 5.12.4 upgrade /////////////////////////////// + #if (defined(Q_OS_WIN) && (QT_VERSION >= QT_VERSION_CHECK(5, 12, 4))) + void timerShowEvent(); + #endif + // FIX - White Window issue on Windows after Qt 5.12.4 upgrade /////////////////////////////// + private: void customizeStyle(); void activityAdded(AccountState *);