diff --git a/src/util.cpp b/src/util.cpp index 19ba9fcc5f..df0ee00dbb 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -458,8 +458,15 @@ void CHighPrecisionTimer::run() /******************************************************************************\ * GUI Utilities * \******************************************************************************/ -// About dialog ---------------------------------------------------------------- #ifndef HEADLESS +// Dialog base class ----------------------------------------------------------- +CBaseDlg::CBaseDlg ( QWidget* parent, Qt::WindowFlags flags ) : QDialog ( parent, flags ) +{ + // give the dialog the application palette inherited from the environment + setPalette ( QApplication::palette ( this ) ); +} + +// About dialog ---------------------------------------------------------------- CAboutDlg::CAboutDlg ( QWidget* parent ) : CBaseDlg ( parent ) { setupUi ( this ); diff --git a/src/util.h b/src/util.h index 4a8e3f4d53..72faa93bff 100644 --- a/src/util.h +++ b/src/util.h @@ -401,27 +401,9 @@ class CBaseDlg : public QDialog Q_OBJECT public: - CBaseDlg ( QWidget* parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags() ) : QDialog ( parent, flags ) {} + CBaseDlg ( QWidget* parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags() ); protected: - bool event ( QEvent* pEvent ) override - { - // a window keeps the palette it resolved when it was created. - // the system colour scheme is only known after the first window is shown - // (especially visible on iOS), so the dialogs which are created in the client - // dialog's constructor, would be painted with black text on the dark background - // until something repaints them (#3999). - - const bool bHandled = QDialog::event ( pEvent ); - - if ( pEvent->type() == QEvent::Show ) - { - setPalette ( QPalette() ); - } - - return bHandled; - } - public slots: void keyPressEvent ( QKeyEvent* pEvent ) {