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(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
39 // 2.5 (Qt 5.12)
40 Q_PROPERTY(QPlatformDialogHelper::ButtonLayout buttonLayout READ buttonLayout WRITE setButtonLayout RESET resetButtonLayout NOTIFY buttonLayoutChanged FINAL REVISION(2, 5))
41 QML_NAMED_ELEMENT(DialogButtonBox)
42 QML_ATTACHED(QQuickDialogButtonBoxAttached)
43 QML_EXTENDED_NAMESPACE(QPlatformDialogHelper)
44 QML_ADDED_IN_VERSION(2, 1)
45
46public:
47 explicit QQuickDialogButtonBox(QQuickItem *parent = nullptr);
48 ~QQuickDialogButtonBox();
49
50 enum Position {
51 Header,
52 Footer
53 };
54 Q_ENUM(Position)
55
56 Position position() const;
57 void setPosition(Position position);
58
59 Qt::Alignment alignment() const;
60 void setAlignment(Qt::Alignment alignment);
61 void resetAlignment();
62
63 QPlatformDialogHelper::StandardButtons standardButtons() const;
64 void setStandardButtons(QPlatformDialogHelper::StandardButtons buttons);
65 Q_INVOKABLE QQuickAbstractButton *standardButton(QPlatformDialogHelper::StandardButton button) const;
66
67 QQmlComponent *delegate() const;
68 void setDelegate(QQmlComponent *delegate);
69
70 static QQuickDialogButtonBoxAttached *qmlAttachedProperties(QObject *object);
71
72 QPlatformDialogHelper::ButtonLayout buttonLayout() const;
73 void setButtonLayout(QPlatformDialogHelper::ButtonLayout layout);
74 void resetButtonLayout();
75
76Q_SIGNALS:
77 void accepted();
78 void rejected();
79 void helpRequested();
80 void clicked(QQuickAbstractButton *button);
81 void positionChanged();
82 void alignmentChanged();
83 void standardButtonsChanged();
84 void delegateChanged();
85 // 2.3 (Qt 5.10)
86 Q_REVISION(2, 3) void applied();
87 Q_REVISION(2, 3) void reset();
88 Q_REVISION(2, 3) void discarded();
89 // 2.5 (Qt 5.12)
90 Q_REVISION(2, 5) void buttonLayoutChanged();
91
92protected:
93 void updatePolish() override;
94 void componentComplete() override;
95 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
96 void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
97 bool isContent(QQuickItem *item) const override;
98 void itemAdded(int index, QQuickItem *item) override;
99 void itemRemoved(int index, QQuickItem *item) override;
100
101#if QT_CONFIG(accessibility)
102 QAccessible::Role accessibleRole() const override;
103#endif
104 bool event(QEvent *e) override;
105
106private:
107 Q_DISABLE_COPY(QQuickDialogButtonBox)
108 Q_DECLARE_PRIVATE(QQuickDialogButtonBox)
109};
110
111class Q_QUICKTEMPLATES2_EXPORT QQuickDialogButtonBoxAttached : public QObject
112{
113 Q_OBJECT
114 Q_PROPERTY(QQuickDialogButtonBox *buttonBox READ buttonBox NOTIFY buttonBoxChanged FINAL)
115 Q_PROPERTY(QPlatformDialogHelper::ButtonRole buttonRole READ buttonRole WRITE setButtonRole NOTIFY buttonRoleChanged FINAL)
116
117public:
118 explicit QQuickDialogButtonBoxAttached(QObject *parent = nullptr);
119
120 QQuickDialogButtonBox *buttonBox() const;
121
122 QPlatformDialogHelper::ButtonRole buttonRole() const;
123 void setButtonRole(QPlatformDialogHelper::ButtonRole role);
124
125Q_SIGNALS:
126 void buttonBoxChanged();
127 void buttonRoleChanged();
128
129private:
130 Q_DISABLE_COPY(QQuickDialogButtonBoxAttached)
131 Q_DECLARE_PRIVATE(QQuickDialogButtonBoxAttached)
132};
133
134QT_END_NAMESPACE
135
136#endif // QQUICKDIALOGBUTTONBOX_P_H
QT_REQUIRE_CONFIG(animation)
QT_REQUIRE_CONFIG(quicktemplates2_container)