Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqstylekitstyle_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QQSTYLEKITSTYLE_P_H
6#define QQSTYLEKITSTYLE_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
24#include <QtLabsStyleKit/qtlabsstylekitexports.h>
25
26#include <QtQml/QtQml>
27#include <QtQuickTemplates2/private/qquickdeferredpointer_p_p.h>
28
30
31class QQStyleKitTheme;
33
34class Q_LABSSTYLEKIT_EXPORT QQStyleKitStyle : public QQStyleKitStyleAndThemeBase
35{
36 Q_OBJECT
37 Q_PROPERTY(QQuickPalette *palette READ palette NOTIFY paletteChanged FINAL)
38 Q_PROPERTY(QQStyleKitStyle *fallbackStyle READ fallbackStyle WRITE setFallbackStyle NOTIFY fallbackStyleChanged FINAL)
39 Q_PROPERTY(QQmlComponent *light READ light WRITE setLight NOTIFY lightChanged FINAL)
40 Q_PROPERTY(QQmlComponent *dark READ dark WRITE setDark NOTIFY darkChanged FINAL)
41 Q_PROPERTY(QString themeName READ themeName WRITE setThemeName NOTIFY themeNameChanged FINAL)
42 Q_PROPERTY(QStringList themeNames READ themeNames NOTIFY themeNamesChanged FINAL)
43 Q_PROPERTY(QStringList customThemeNames READ customThemeNames NOTIFY customThemeNamesChanged FINAL)
44 Q_PROPERTY(QQStyleKitTheme *theme READ theme NOTIFY themeChanged FINAL)
45
46 Q_CLASSINFO("DeferredPropertyNames", "fallbackStyle")
47 QML_NAMED_ELEMENT(BaseStyle)
48
49public:
50 QQStyleKitStyle(QObject *parent = nullptr);
51 ~QQStyleKitStyle();
52
53 QQuickPalette *palette() const;
54
55 QQStyleKitStyle *fallbackStyle() const;
56 void setFallbackStyle(QQStyleKitStyle *fallbackStyle);
57
58 QQmlComponent *light() const;
59 void setLight(QQmlComponent *lightTheme);
60
61 QQmlComponent *dark() const;
62 void setDark(QQmlComponent *darkTheme);
63
64 QList<QQStyleKitCustomTheme *> customThemes() const;
65 QStringList themeNames() const;
66 QStringList customThemeNames() const;
67
68 void setThemeName(const QString &themeName);
69 QString themeName() const;
70 QQStyleKitTheme *theme() const;
71 void recreateTheme();
72
73 bool loaded() const;
74
75 static QQStyleKitStyle *current();
76
77 QPalette paletteForControlType(QQStyleKitExtendableControlType type) const;
78 QFont fontForControlType(QQStyleKitExtendableControlType type) const;
79
80signals:
81 void paletteChanged();
82 void fallbackStyleChanged();
83 void lightChanged();
84 void darkChanged();
85 void themeChanged();
86 void themeNameChanged();
87 void themeNamesChanged();
88 void customThemeNamesChanged();
89
90protected:
91 void componentComplete() override;
92
93private:
94 void parseThemes();
95 void reapplyStyle();
96 void executeFallbackStyle(bool complete = false);
97 void syncFromQPalette(const QPalette &palette);
98 QPalette effectivePalette() const;
99
100 Q_DISABLE_COPY(QQStyleKitStyle)
101
102 bool m_completed = false;
103 bool m_isUpdatingPalette = false;
104 bool m_hasVariations = false;
105
106 QQuickDeferredPointer<QQStyleKitStyle> m_fallbackStyle;
107 QPointer<QQmlComponent> m_light;
108 QPointer<QQmlComponent> m_dark;
109 QPointer<QQStyleKitTheme> m_theme;
110 QPointer<QQmlComponent> m_currentThemeComponent;
111 QQuickPalette *m_paletteProxy = nullptr;
112 QPalette m_effectivePalette;
113 QPointer<QQuickPalette> m_palette;
114 QString m_themeName;
115 QString m_effectiveThemeName;
116 QStringList m_themeNames;
117 QStringList m_customThemeNames;
118
119 friend class QQStyleKitAttached;
120 friend class QQStyleKitPropertyGroup;
121 friend class QQStyleKitPropertyResolver;
122 friend class QQStyleKitDebug;
123 friend class QQStyleKitVariation;
124};
125
126QT_END_NAMESPACE
127
128#endif // QQSTYLEKITSTYLE_P_H
Q_INVOKABLE bool styleLoaded() const
QQStyleKitStyle * style() const
QUrl styleUrl() const
void transitionsEnabledChanged()
void setStyle(QQStyleKitStyle *style)
void setTransitionsEnabled(bool enabled)
QQStyleKitDebug * debug() const
bool transitionsEnabled() const
void setStyleUrl(const QUrl &styleUrl)
void filterChanged()
QString filter() const
void setFilter(const QString &filter)
void setControl(QQuickItem *item)
static Q_INVOKABLE bool insideControl(const QObject *child)
static QQStyleKitAttached * qmlAttachedProperties(QObject *obj=nullptr)
Combined button and popup list for selecting options.