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