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
qqstylekit_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 QQSTYLEKIT_P_H
6#define QQSTYLEKIT_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
20
21#include <QtQml/QtQml>
22
24
25class QQStyleKitAttached;
26
27class Q_LABSSTYLEKIT_EXPORT QQStyleKit : public QObject
28{
29 Q_OBJECT
30 QML_NAMED_ELEMENT(StyleKit)
31 QML_ATTACHED(QQStyleKitAttached)
32
33public:
34 QQStyleKit(QObject *parent = nullptr);
35 static QQStyleKitAttached *qmlAttachedProperties(QObject *obj = nullptr);
36
37private:
38 Q_DISABLE_COPY(QQStyleKit)
39};
40
41class Q_LABSSTYLEKIT_EXPORT QQStyleKitAttached : public QObject
42{
43 Q_OBJECT
44 Q_PROPERTY(QQStyleKitStyle *style READ style WRITE setStyle NOTIFY styleChanged FINAL)
45 Q_PROPERTY(QUrl styleUrl READ styleUrl WRITE setStyleUrl NOTIFY styleUrlChanged FINAL)
46 Q_PROPERTY(bool transitionsEnabled READ transitionsEnabled WRITE setTransitionsEnabled NOTIFY transitionsEnabledChanged FINAL)
47 Q_PROPERTY(QQStyleKitDebug *debug READ debug FINAL)
48
49public:
50 QQStyleKitAttached(QObject *parent);
51 ~QQStyleKitAttached();
52
53 QQStyleKitStyle *style() const;
54 void setStyle(QQStyleKitStyle *style);
55
56 QUrl styleUrl() const;
57 void setStyleUrl(const QUrl &styleUrl);
58
59 bool transitionsEnabled() const;
60 void setTransitionsEnabled(bool enabled);
61
62 QQStyleKitDebug *debug() const;
63
64 Q_INVOKABLE bool styleLoaded() const;
65
66signals:
67 void styleChanged();
68 void styleUrlChanged();
69 void transitionsEnabledChanged();
70
71private:
72 bool m_ownsStyle = false;
73 QUrl m_styleUrl;
74 QPointer<QQmlEngine> m_engine;
75 QPointer<QQStyleKitStyle> m_style;
76 QQStyleKitDebug m_debug;
77
78 static QPointer<QQStyleKitAttached> s_instance;
79 static bool s_transitionsEnabled;
80
81 friend class QQStyleKit;
82};
83
84QT_END_NAMESPACE
85
86#endif // QQSTYLEKIT_P_H
Combined button and popup list for selecting options.