diff --git a/platformthemeplugin/qdeepintheme.cpp b/platformthemeplugin/qdeepintheme.cpp index 8044c46d..566ad922 100644 --- a/platformthemeplugin/qdeepintheme.cpp +++ b/platformthemeplugin/qdeepintheme.cpp @@ -669,6 +669,24 @@ const QPalette *QDeepinTheme::palette(QPlatformTheme::Palette type) const return &palette; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) +Qt::ColorScheme QDeepinTheme::colorScheme() const +{ + auto *helper = DGuiApplicationHelper::instance(); + if (!helper) + return QGenericUnixTheme::colorScheme(); + + switch (helper->themeType()) { + case DGuiApplicationHelper::DarkType: + return Qt::ColorScheme::Dark; + case DGuiApplicationHelper::LightType: + return Qt::ColorScheme::Light; + default: + return Qt::ColorScheme::Unknown; + } +} +#endif + static QFont *createUnresolveFont(const QString &family, qreal pointSize) { auto font = new QFont(family); diff --git a/platformthemeplugin/qdeepintheme.h b/platformthemeplugin/qdeepintheme.h index 34b65532..ca9376cd 100644 --- a/platformthemeplugin/qdeepintheme.h +++ b/platformthemeplugin/qdeepintheme.h @@ -41,6 +41,9 @@ class QDeepinTheme : public QGenericUnixTheme QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE; const QPalette *palette(Palette type) const override; +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) + Qt::ColorScheme colorScheme() const override; +#endif const QFont *font(Font type) const Q_DECL_OVERRIDE; DThemeSettings *settings() const; static DThemeSettings *getSettings();