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
qquickdialog_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 QQUICKDIALOG_P_H
6#define QQUICKDIALOG_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/qquickpopup_p.h>
21#include <QtGui/qpa/qplatformdialoghelper.h>
22
24
25QT_BEGIN_NAMESPACE
26
27class QQuickDialogPrivate;
28
29class Q_QUICKTEMPLATES2_EXPORT QQuickDialog : public QQuickPopup
30{
31 Q_OBJECT
32 Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
33 Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL)
34 Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL)
35 Q_PROPERTY(QPlatformDialogHelper::StandardButtons standardButtons READ standardButtons WRITE setStandardButtons NOTIFY standardButtonsChanged FINAL)
36 // 2.3 (Qt 5.10)
37 Q_PROPERTY(int result READ result WRITE setResult NOTIFY resultChanged FINAL REVISION(2, 3))
38 QML_EXTENDED_NAMESPACE(QPlatformDialogHelper)
39 // 2.5 (Qt 5.12)
40 Q_PROPERTY(qreal implicitHeaderWidth READ implicitHeaderWidth NOTIFY implicitHeaderWidthChanged FINAL REVISION(2, 5))
41 Q_PROPERTY(qreal implicitHeaderHeight READ implicitHeaderHeight NOTIFY implicitHeaderHeightChanged FINAL REVISION(2, 5))
42 Q_PROPERTY(qreal implicitFooterWidth READ implicitFooterWidth NOTIFY implicitFooterWidthChanged FINAL REVISION(2, 5))
43 Q_PROPERTY(qreal implicitFooterHeight READ implicitFooterHeight NOTIFY implicitFooterHeightChanged FINAL REVISION(2, 5))
44 QML_NAMED_ELEMENT(Dialog)
45 QML_ADDED_IN_VERSION(2, 1)
46
47public:
48 explicit QQuickDialog(QObject *parent = nullptr);
49 ~QQuickDialog();
50
51 QString title() const;
52 void setTitle(const QString &title);
53
54 QQuickItem *header() const;
55 void setHeader(QQuickItem *header);
56
57 QQuickItem *footer() const;
58 void setFooter(QQuickItem *footer);
59
60 QPlatformDialogHelper::StandardButtons standardButtons() const;
61 void setStandardButtons(QPlatformDialogHelper::StandardButtons buttons);
62 Q_REVISION(2, 3) Q_INVOKABLE QQuickAbstractButton *standardButton(QPlatformDialogHelper::StandardButton button) const;
63
64 // 2.3 (Qt 5.10)
65 enum StandardCode { Rejected, Accepted };
66 Q_ENUM(StandardCode)
67
68 int result() const;
69 void setResult(int result);
70
71 // 2.5 (Qt 5.12)
72 qreal implicitHeaderWidth() const;
73 qreal implicitHeaderHeight() const;
74
75 qreal implicitFooterWidth() const;
76 qreal implicitFooterHeight() const;
77
78 void setOpacity(qreal opacity) override;
79
80public Q_SLOTS:
81 virtual void accept();
82 virtual void reject();
83 virtual void done(int result);
84
85Q_SIGNALS:
86 void accepted();
87 void rejected();
88 void titleChanged();
89 void headerChanged();
90 void footerChanged();
91 void standardButtonsChanged();
92 // 2.3 (Qt 5.10)
93 Q_REVISION(2, 3) void applied();
94 Q_REVISION(2, 3) void reset();
95 Q_REVISION(2, 3) void discarded();
96 Q_REVISION(2, 3) void helpRequested();
97 Q_REVISION(2, 3) void resultChanged();
98 // 2.5 (Qt 5.12)
99 void implicitHeaderWidthChanged();
100 void implicitHeaderHeightChanged();
101 void implicitFooterWidthChanged();
102 void implicitFooterHeightChanged();
103
104protected:
105 QQuickDialog(QQuickDialogPrivate &dd, QObject *parent);
106
107 virtual void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data) override;
108
109#if QT_CONFIG(accessibility)
110 QAccessible::Role accessibleRole() const override;
111 void accessibilityActiveChanged(bool active) override;
112#endif
113
114private:
115 Q_DISABLE_COPY(QQuickDialog)
116 Q_DECLARE_PRIVATE(QQuickDialog)
117};
118
119// The dialog options are registered here because they conceptually belong to QPlatformDialogHelper
120// used as extension above. They may not be used QtQuick.Templates itself, but not registering them
121// here would cause every downstream module that uses them to produce a redundant registration.
122
124{
125 Q_GADGET
126 QML_ANONYMOUS
128};
129
131{
132 Q_GADGET
133 QML_ANONYMOUS
135};
136
138{
139 Q_GADGET
140 QML_ANONYMOUS
142};
143
144QT_END_NAMESPACE
145
146#endif // QQUICKDIALOG_P_H
Combined button and popup list for selecting options.
QT_REQUIRE_CONFIG(quicktemplates2_container)