From 631bb02e750f187a9ae6eb438ac37cce92a60bb6 Mon Sep 17 00:00:00 2001 From: Tony Mountifield Date: Wed, 2 Dec 2026 11:21:03 +0000 Subject: [PATCH 1/2] Use GUI application palette instead of default empty one Testing elsewhere showed that QPalette() returned an empty palette instead of the one inherited by the GUI from the environment. This caused the dialogs not to be fully themed. Using the GUI application palette explicitly fixed that problem. at least on Linux. --- src/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.h b/src/util.h index 4a8e3f4d53..f38882c163 100644 --- a/src/util.h +++ b/src/util.h @@ -416,7 +416,7 @@ class CBaseDlg : public QDialog if ( pEvent->type() == QEvent::Show ) { - setPalette ( QPalette() ); + setPalette ( QGuiApplication::palette() ); } return bHandled; From e8c689ed59929f8dd06e660088758d4c90f4c866 Mon Sep 17 00:00:00 2001 From: Tony Mountifield Date: Wed, 2 Dec 2026 21:33:11 +0000 Subject: [PATCH 2/2] Try a different approach to set the palette --- src/util.cpp | 9 ++++++++- src/util.h | 20 +------------------- 2 files changed, 9 insertions(+), 20 deletions(-) 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 f38882c163..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 ( QGuiApplication::palette() ); - } - - return bHandled; - } - public slots: void keyPressEvent ( QKeyEvent* pEvent ) {