1 | // Copyright (C) 2017 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 QQUICKACTIONGROUP_P_H |
5 | #define QQUICKACTIONGROUP_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 <QtCore/qobject.h> |
19 | #include <QtQuickTemplates2/private/qtquicktemplates2global_p.h> |
20 | #include <QtQml/qqml.h> |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | class QQuickAction; |
25 | class QQuickActionGroupPrivate; |
26 | class QQuickActionGroupAttached; |
27 | class QQuickActionGroupAttachedPrivate; |
28 | |
29 | class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickActionGroup : public QObject |
30 | { |
31 | Q_OBJECT |
32 | Q_PROPERTY(QQuickAction *checkedAction READ checkedAction WRITE setCheckedAction NOTIFY checkedActionChanged FINAL) |
33 | Q_PROPERTY(QQmlListProperty<QQuickAction> actions READ actions NOTIFY actionsChanged FINAL) |
34 | Q_PROPERTY(bool exclusive READ isExclusive WRITE setExclusive NOTIFY exclusiveChanged FINAL) |
35 | Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL) |
36 | Q_CLASSINFO("DefaultProperty", "actions") |
37 | QML_NAMED_ELEMENT(ActionGroup) |
38 | QML_ATTACHED(QQuickActionGroupAttached) |
39 | QML_ADDED_IN_VERSION(2, 3) |
40 | |
41 | public: |
42 | explicit QQuickActionGroup(QObject *parent = nullptr); |
43 | ~QQuickActionGroup(); |
44 | |
45 | static QQuickActionGroupAttached *qmlAttachedProperties(QObject *object); |
46 | |
47 | QQuickAction *checkedAction() const; |
48 | void setCheckedAction(QQuickAction *checkedAction); |
49 | |
50 | QQmlListProperty<QQuickAction> actions(); |
51 | |
52 | bool isExclusive() const; |
53 | void setExclusive(bool exclusive); |
54 | |
55 | bool isEnabled() const; |
56 | void setEnabled(bool enabled); |
57 | |
58 | public Q_SLOTS: |
59 | void addAction(QQuickAction *action); |
60 | void removeAction(QQuickAction *action); |
61 | |
62 | Q_SIGNALS: |
63 | void checkedActionChanged(); |
64 | void actionsChanged(); |
65 | void exclusiveChanged(); |
66 | void enabledChanged(); |
67 | void triggered(QQuickAction *action); |
68 | |
69 | private: |
70 | Q_DISABLE_COPY(QQuickActionGroup) |
71 | Q_DECLARE_PRIVATE(QQuickActionGroup) |
72 | |
73 | Q_PRIVATE_SLOT(d_func(), void _q_updateCurrent()) |
74 | }; |
75 | |
76 | class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickActionGroupAttached : public QObject |
77 | { |
78 | Q_OBJECT |
79 | Q_PROPERTY(QQuickActionGroup *group READ group WRITE setGroup NOTIFY groupChanged FINAL) |
80 | |
81 | public: |
82 | explicit QQuickActionGroupAttached(QObject *parent = nullptr); |
83 | |
84 | QQuickActionGroup *group() const; |
85 | void setGroup(QQuickActionGroup *group); |
86 | |
87 | Q_SIGNALS: |
88 | void groupChanged(); |
89 | |
90 | private: |
91 | Q_DISABLE_COPY(QQuickActionGroupAttached) |
92 | Q_DECLARE_PRIVATE(QQuickActionGroupAttached) |
93 | }; |
94 | |
95 | QT_END_NAMESPACE |
96 | |
97 | QML_DECLARE_TYPE(QQuickActionGroup) |
98 | |
99 | #endif // QQUICKACTIONGROUP_P_H |
100 |