Fix build against Qt 6.5

This commit is contained in:
Jan Grulich 2023-04-04 14:39:38 +02:00
parent 87bc3863be
commit fee5bae1ec
2 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,76 @@
From d649368961f9b3f80b307ffa02cf3090fa29e140 Mon Sep 17 00:00:00 2001
From: Jan Grulich <jgrulich@redhat.com>
Date: Tue, 4 Apr 2023 13:54:44 +0200
Subject: [PATCH] Fix build against Qt 6.5
---
src/theme/qgnomeplatformtheme.cpp | 13 +++++++++----
src/theme/qgnomeplatformtheme.h | 6 ++++--
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/theme/qgnomeplatformtheme.cpp b/src/theme/qgnomeplatformtheme.cpp
index 8296647..42f0e84 100644
--- a/src/theme/qgnomeplatformtheme.cpp
+++ b/src/theme/qgnomeplatformtheme.cpp
@@ -83,7 +83,7 @@ QGnomePlatformTheme::QGnomePlatformTheme()
g_type_ensure(PANGO_TYPE_FONT_FAMILY);
g_type_ensure(PANGO_TYPE_FONT_FACE);
-#if QT_VERSION > 0x060000
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
// Load QGnomeTheme
m_platformTheme = QGenericUnixTheme::createUnixTheme(QLatin1String("gnome"));
#endif
@@ -148,7 +148,7 @@ QPlatformDialogHelper *QGnomePlatformTheme::createPlatformDialogHelper(QPlatform
}
}
-#if QT_VERSION < 0x060000
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#ifndef QT_NO_SYSTEMTRAYICON
static bool isDBusTrayAvailable()
{
@@ -169,7 +169,7 @@ static bool isDBusTrayAvailable()
#ifndef QT_NO_SYSTEMTRAYICON
QPlatformSystemTrayIcon *QGnomePlatformTheme::createPlatformSystemTrayIcon() const
{
-#if QT_VERSION < 0x060000
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if (isDBusTrayAvailable()) {
return new QDBusTrayIcon();
}
@@ -182,7 +182,12 @@ QPlatformSystemTrayIcon *QGnomePlatformTheme::createPlatformSystemTrayIcon() con
}
#endif
-#if QT_VERSION > 0x060300
+#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
+Qt::ColorScheme QGnomePlatformTheme::colorScheme() const
+{
+ return GnomeSettings::getInstance().useGtkThemeDarkVariant() ? Qt::ColorScheme::Dark : Qt::ColorScheme::Light;
+}
+#elif QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
QPlatformTheme::Appearance QGnomePlatformTheme::appearance() const
{
return GnomeSettings::getInstance().useGtkThemeDarkVariant() ? Appearance::Dark : Appearance::Light;
diff --git a/src/theme/qgnomeplatformtheme.h b/src/theme/qgnomeplatformtheme.h
index 342909f..a37475d 100644
--- a/src/theme/qgnomeplatformtheme.h
+++ b/src/theme/qgnomeplatformtheme.h
@@ -39,12 +39,14 @@ class QGnomePlatformTheme : public QPlatformTheme
#ifndef QT_NO_SYSTEMTRAYICON
QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const Q_DECL_OVERRIDE;
#endif
-#if QT_VERSION > 0x060300
+#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
+ Qt::ColorScheme colorScheme() const Q_DECL_OVERRIDE;
+#elif QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
QPlatformTheme::Appearance appearance() const Q_DECL_OVERRIDE;
#endif
private:
-#if QT_VERSION > 0x060000
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
// Used to load Qt's internall platform theme to get access to
// non-public stuff, like QDBusTrayIcon
QPlatformTheme *m_platformTheme = nullptr;

View File

@ -10,6 +10,7 @@ Source0: https://github.com/FedoraQt/QGnomePlatform/archive/%{version}/QG
# Upstream patches
Patch0: qgnomeplatform-fix-window-content-geometry-for-qt5-when-shadows-are-enabled.patch
Patch1: qgnomeplatform-add-support-for-kcolorscheme-using-adwaita-like-color-schemes.patch
Patch3: qgnomeplatform-fix-qt6-build.patch
Patch50: qgnomeplatform-use-more-updated-window-states-value.patch