1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QGNOMETHEME_P_H
5#define QGNOMETHEME_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qgenericunixtheme_p.h"
19#include <qpa/qplatformtheme.h>
20#include <qpa/qplatformtheme_p.h>
21#include <QtGui/QFont>
22#if QT_CONFIG(dbus)
23# include "qgnomeportalinterface_p.h"
24#endif // QT_CONFIG(dbus)
25
26QT_BEGIN_NAMESPACE
27
28class QGnomeThemePrivate;
29
30class Q_GUI_EXPORT QGnomeTheme : public QGenericUnixTheme
31{
32protected:
33 Q_DECLARE_PRIVATE(QGnomeTheme)
34
35public:
36 QGnomeTheme();
37 QVariant themeHint(ThemeHint hint) const override;
38 QIcon fileIcon(const QFileInfo &fileInfo,
39 QPlatformTheme::IconOptions = { }) const override;
40 const QFont *font(Font type) const override;
41 QString standardButtonText(int button) const override;
42
43 virtual QString gtkFontName() const;
44
45 virtual void requestColorScheme(Qt::ColorScheme) override;
46 virtual Qt::ColorScheme colorScheme() const override;
47
48#if QT_CONFIG(dbus)
49protected:
50 virtual void updateColorScheme(Qt::ColorScheme);
51 virtual void updateHighContrast(Qt::ContrastPreference);
52
53public:
54 QPlatformMenuBar *createPlatformMenuBar() const override;
55 Qt::ContrastPreference contrastPreference() const override;
56
57# if QT_CONFIG(systemtrayicon)
58 QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
59# endif // QT_CONFIG(systemtrayicon)
60#endif // QT_CONFIG(dbus)
61
62 static const char *name;
63};
64
65class Q_GUI_EXPORT QGnomeThemePrivate : public QGenericUnixThemePrivate
66{
67 friend QGnomeTheme;
68
69public:
70 QGnomeThemePrivate();
71 ~QGnomeThemePrivate();
72
73 void configureFonts(const QString &gtkFontName) const;
74
75 Qt::ColorScheme colorScheme() const;
76 bool hasRequestedColorScheme() const;
77
78private:
79 mutable QFont *systemFont = nullptr;
80 mutable QFont *fixedFont = nullptr;
81
82 Qt::ColorScheme m_requestedColorScheme = Qt::ColorScheme::Unknown;
83
84#if QT_CONFIG(dbus)
85 QGnomePortalInterface m_gnomePortal;
86 QString m_themeName;
87#endif // QT_CONFIG(dbus)
88};
89
90QT_END_NAMESPACE
91#endif // QGNOMETHEME_P_H
92

source code of qtbase/src/gui/platform/unix/qgnometheme_p.h