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
qquickdialogbuttonbox_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 QQUICKDIALOGBUTTONBOX_P_H
6#define QQUICKDIALOGBUTTONBOX_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 <QtQuickTemplates2/private/qquickabstractbutton_p.h>
20#include <QtQuickTemplates2/private/qquickcontainer_p.h>
21#include <QtGui/qpa/qplatformdialoghelper.h>
22
24
25QT_BEGIN_NAMESPACE
26
27class QQmlComponent;
28class QQuickDialogButtonBoxPrivate;
29class QQuickDialogButtonBoxAttached;
31
32class Q_QUICKTEMPLATES2_EXPORT QQuickDialogButtonBox : public QQuickContainer
33{
34 Q_OBJECT
35 Q_PROPERTY(Position position READ position WRITE setPosition NOTIFY positionChanged FINAL)
36 Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment RESET resetAlignment NOTIFY alignmentChanged FINAL)
37 Q_PROPERTY(QPlatformDialogHelper::StandardButtons standardButtons READ standardButtons WRITE setStandardButtons NOTIFY standardButtonsChanged FINAL)
38 Q_PROPERTY(QPlatformDialogHelper::StandardButton defaultStandardButton READ defaultStandardButton WRITE setDefaultStandardButton NOTIFY defaultStandardButtonChanged FINAL REVISION(6, 11))
39 Q_PROPERTY(QQuickAbstractButton *defaultButton READ defaultButton WRITE setDefaultButton NOTIFY defaultButtonChanged FINAL REVISION(6, 11))
40 Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
41 // 2.5 (Qt 5.12)
42 Q_PROPERTY(QPlatformDialogHelper::ButtonLayout buttonLayout READ buttonLayout WRITE setButtonLayout RESET resetButtonLayout NOTIFY buttonLayoutChanged FINAL REVISION(2, 5))
43 QML_NAMED_ELEMENT(DialogButtonBox)
44 QML_ATTACHED(QQuickDialogButtonBoxAttached)
45 QML_EXTENDED_NAMESPACE(QPlatformDialogHelper)
46 QML_ADDED_IN_VERSION(2, 1)
47
48public:
49 explicit QQuickDialogButtonBox(QQuickItem *parent = nullptr);
50 ~QQuickDialogButtonBox();
51
52 enum Position {
53 Header,
54 Footer
55 };
56 Q_ENUM(Position)
57
58 Position position() const;
59 void setPosition(Position position);
60
61 Qt::Alignment alignment() const;
62 void setAlignment(Qt::Alignment alignment);
63 void resetAlignment();
64
65 QPlatformDialogHelper::StandardButtons standardButtons() const;
66 void setStandardButtons(QPlatformDialogHelper::StandardButtons buttons);
67 Q_INVOKABLE QQuickAbstractButton *standardButton(QPlatformDialogHelper::StandardButton button) const;
68
69 QPlatformDialogHelper::StandardButton defaultStandardButton() const;
70 void setDefaultStandardButton(QPlatformDialogHelper::StandardButton button);
71
72 QQuickAbstractButton *defaultButton() const;
73 void setDefaultButton(QQuickAbstractButton *button);
74
75 QQmlComponent *delegate() const;
76 void setDelegate(QQmlComponent *delegate);
77
78 static QQuickDialogButtonBoxAttached *qmlAttachedProperties(QObject *object);
79
80 QPlatformDialogHelper::ButtonLayout buttonLayout() const;
81 void setButtonLayout(QPlatformDialogHelper::ButtonLayout layout);
82 void resetButtonLayout();
83
84Q_SIGNALS:
85 void accepted();
86 void rejected();
87 void helpRequested();
88 void clicked(QQuickAbstractButton *button);
89 void positionChanged();
90 void alignmentChanged();
91 void standardButtonsChanged();
92 void delegateChanged();
93 // 2.3 (Qt 5.10)
94 Q_REVISION(2, 3) void applied();
95 Q_REVISION(2, 3) void reset();
96 Q_REVISION(2, 3) void discarded();
97 // 2.5 (Qt 5.12)
98 Q_REVISION(2, 5) void buttonLayoutChanged();
99 Q_REVISION(6, 11) void defaultStandardButtonChanged();
100 Q_REVISION(6, 11) void defaultButtonChanged();
101
102protected:
103 void updatePolish() override;
104 void componentComplete() override;
105 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
106 void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
107 bool isContent(QQuickItem *item) const override;
108 void itemAdded(int index, QQuickItem *item) override;
109 void itemRemoved(int index, QQuickItem *item) override;
110
111#if QT_CONFIG(accessibility)
112 QAccessible::Role accessibleRole() const override;
113#endif
114 bool event(QEvent *e) override;
115
116private:
117 void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data) override;
118
119 Q_DISABLE_COPY(QQuickDialogButtonBox)
120 Q_DECLARE_PRIVATE(QQuickDialogButtonBox)
121};
122
123class Q_QUICKTEMPLATES2_EXPORT QQuickDialogButtonBoxAttached : public QObject
124{
125 Q_OBJECT
126 Q_PROPERTY(QQuickDialogButtonBox *buttonBox READ buttonBox NOTIFY buttonBoxChanged FINAL)
127 Q_PROPERTY(QPlatformDialogHelper::ButtonRole buttonRole READ buttonRole WRITE setButtonRole NOTIFY buttonRoleChanged FINAL)
128
129public:
130 explicit QQuickDialogButtonBoxAttached(QObject *parent = nullptr);
131
132 QQuickDialogButtonBox *buttonBox() const;
133
134 QPlatformDialogHelper::ButtonRole buttonRole() const;
135 void setButtonRole(QPlatformDialogHelper::ButtonRole role);
136
137Q_SIGNALS:
138 void buttonBoxChanged();
139 void buttonRoleChanged();
140
141private:
142 Q_DISABLE_COPY(QQuickDialogButtonBoxAttached)
143 Q_DECLARE_PRIVATE(QQuickDialogButtonBoxAttached)
144};
145
146QT_END_NAMESPACE
147
148#endif // QQUICKDIALOGBUTTONBOX_P_H
Combined button and popup list for selecting options.
QT_REQUIRE_CONFIG(animation)
QT_REQUIRE_CONFIG(quicktemplates2_container)