macOS: use QStyleHint to get color scheme in the style

That way, an override through QStyleHints::setColorScheme is
immediately respected by the style.

As a drive-by, make the helper static and inline.

Change-Id: Ia6cde1f5099d9194b25fac812c3184f5a61bf1dc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 4245987f6875d01853053c50d13ecf42b61fc0ad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
bb10
Volker Hilsheimer 2024-06-11 15:39:10 +02:00 committed by Qt Cherry-pick Bot
parent 450cd772e2
commit ea8277dbf3
1 changed files with 5 additions and 1 deletions

View File

@ -21,6 +21,7 @@
#include <QtCore/private/qcore_mac_p.h>
#include <QtGui/qpainterpath.h>
#include <QtGui/qstylehints.h>
#include <QtGui/private/qcoregraphics_p.h>
#include <QtGui/qpa/qplatformfontdatabase.h>
#include <QtGui/qpa/qplatformtheme.h>
@ -160,7 +161,10 @@ const int pushButtonBevelRectOffsets[3] = {
QVector<QPointer<QObject> > QMacStylePrivate::scrollBars;
bool isDarkMode() { return QGuiApplicationPrivate::platformTheme()->colorScheme() == Qt::ColorScheme::Dark; }
static inline bool isDarkMode()
{
return QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark;
}
#if QT_CONFIG(tabwidget)
/*