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
qquickbuttongroup_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKBUTTONGROUP_P_H
6#define QQUICKBUTTONGROUP_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
19#include <QtCore/qobject.h>
20#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
21#include <QtQml/qqml.h>
22#include <QtQml/qqmlparserstatus.h>
23
25
26class QQuickAbstractButton;
28class QQuickButtonGroupAttached;
30
31class Q_QUICKTEMPLATES2_EXPORT QQuickButtonGroup : public QObject, public QQmlParserStatus
32{
33 Q_OBJECT
34 Q_PROPERTY(QQuickAbstractButton *checkedButton READ checkedButton WRITE setCheckedButton NOTIFY checkedButtonChanged FINAL)
35 Q_PROPERTY(QQmlListProperty<QQuickAbstractButton> buttons READ buttons NOTIFY buttonsChanged FINAL)
36 // 2.3 (Qt 5.10)
37 Q_PROPERTY(bool exclusive READ isExclusive WRITE setExclusive NOTIFY exclusiveChanged FINAL REVISION(2, 3))
38 // 2.4 (Qt 5.11)
39 Q_PROPERTY(Qt::CheckState checkState READ checkState WRITE setCheckState NOTIFY checkStateChanged FINAL REVISION(2, 4))
40 Q_INTERFACES(QQmlParserStatus)
41 QML_NAMED_ELEMENT(ButtonGroup)
42 QML_ATTACHED(QQuickButtonGroupAttached)
43 QML_ADDED_IN_VERSION(2, 0)
44
45public:
46 explicit QQuickButtonGroup(QObject *parent = nullptr);
47 ~QQuickButtonGroup();
48
49 static QQuickButtonGroupAttached *qmlAttachedProperties(QObject *object);
50
51 QQuickAbstractButton *checkedButton() const;
52 void setCheckedButton(QQuickAbstractButton *checkedButton);
53
54 QQmlListProperty<QQuickAbstractButton> buttons();
55
56 bool isExclusive() const;
57 void setExclusive(bool exclusive);
58
59 // 2.4 (Qt 5.11)
60 Qt::CheckState checkState() const;
61 void setCheckState(Qt::CheckState state);
62
63public Q_SLOTS:
64 void addButton(QQuickAbstractButton *button);
65 void removeButton(QQuickAbstractButton *button);
66
67Q_SIGNALS:
68 void checkedButtonChanged();
69 void buttonsChanged();
70 // 2.1 (Qt 5.8)
71 Q_REVISION(2, 1) void clicked(QQuickAbstractButton *button);
72 // 2.3 (Qt 5.10)
73 Q_REVISION(2, 3) void exclusiveChanged();
74 // 2.4 (Qt 5.11)
75 Q_REVISION(2, 4) void checkStateChanged();
76
77protected:
78 void classBegin() override;
79 void componentComplete() override;
80
81private:
82 Q_DISABLE_COPY(QQuickButtonGroup)
83 Q_DECLARE_PRIVATE(QQuickButtonGroup)
84
85 Q_PRIVATE_SLOT(d_func(), void _q_updateCurrent())
86};
87
88class Q_QUICKTEMPLATES2_EXPORT QQuickButtonGroupAttached : public QObject
89{
90 Q_OBJECT
91 Q_PROPERTY(QQuickButtonGroup *group READ group WRITE setGroup NOTIFY groupChanged FINAL)
92
93public:
94 explicit QQuickButtonGroupAttached(QObject *parent = nullptr);
95
96 QQuickButtonGroup *group() const;
97 void setGroup(QQuickButtonGroup *group);
98
99Q_SIGNALS:
100 void groupChanged();
101
102private:
103 Q_DISABLE_COPY(QQuickButtonGroupAttached)
104 Q_DECLARE_PRIVATE(QQuickButtonGroupAttached)
105};
106
107QT_END_NAMESPACE
108
109#endif // QQUICKBUTTONGROUP_P_H
Groups actions together.
Mutually-exclusive group of checkable buttons.