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
4#ifndef QQUICKDIALOG_P_H
5#define QQUICKDIALOG_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
19#include <QtQuickTemplates2/private/qquickpopup_p.h>
20#include <QtGui/qpa/qplatformdialoghelper.h>
21
22QT_BEGIN_NAMESPACE
23
24class QQuickDialogPrivate;
25
26class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickDialog : public QQuickPopup
27{
28 Q_OBJECT
29 Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
30 Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL)
31 Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL)
32 Q_PROPERTY(QPlatformDialogHelper::StandardButtons standardButtons READ standardButtons WRITE setStandardButtons NOTIFY standardButtonsChanged FINAL)
33 // 2.3 (Qt 5.10)
34 Q_PROPERTY(int result READ result WRITE setResult NOTIFY resultChanged FINAL REVISION(2, 3))
35 QML_EXTENDED_NAMESPACE(QPlatformDialogHelper)
36 // 2.5 (Qt 5.12)
37 Q_PROPERTY(qreal implicitHeaderWidth READ implicitHeaderWidth NOTIFY implicitHeaderWidthChanged FINAL REVISION(2, 5))
38 Q_PROPERTY(qreal implicitHeaderHeight READ implicitHeaderHeight NOTIFY implicitHeaderHeightChanged FINAL REVISION(2, 5))
39 Q_PROPERTY(qreal implicitFooterWidth READ implicitFooterWidth NOTIFY implicitFooterWidthChanged FINAL REVISION(2, 5))
40 Q_PROPERTY(qreal implicitFooterHeight READ implicitFooterHeight NOTIFY implicitFooterHeightChanged FINAL REVISION(2, 5))
41 QML_NAMED_ELEMENT(Dialog)
42 QML_ADDED_IN_VERSION(2, 1)
43
44public:
45 explicit QQuickDialog(QObject *parent = nullptr);
46 ~QQuickDialog();
47
48 QString title() const;
49 void setTitle(const QString &title);
50
51 QQuickItem *header() const;
52 void setHeader(QQuickItem *header);
53
54 QQuickItem *footer() const;
55 void setFooter(QQuickItem *footer);
56
57 QPlatformDialogHelper::StandardButtons standardButtons() const;
58 void setStandardButtons(QPlatformDialogHelper::StandardButtons buttons);
59 Q_REVISION(2, 3) Q_INVOKABLE QQuickAbstractButton *standardButton(QPlatformDialogHelper::StandardButton button) const;
60
61 // 2.3 (Qt 5.10)
62 enum StandardCode { Rejected, Accepted };
63 Q_ENUM(StandardCode)
64
65 int result() const;
66 void setResult(int result);
67
68 // 2.5 (Qt 5.12)
69 qreal implicitHeaderWidth() const;
70 qreal implicitHeaderHeight() const;
71
72 qreal implicitFooterWidth() const;
73 qreal implicitFooterHeight() const;
74
75public Q_SLOTS:
76 virtual void accept();
77 virtual void reject();
78 virtual void done(int result);
79
80Q_SIGNALS:
81 void accepted();
82 void rejected();
83 void titleChanged();
84 void headerChanged();
85 void footerChanged();
86 void standardButtonsChanged();
87 // 2.3 (Qt 5.10)
88 Q_REVISION(2, 3) void applied();
89 Q_REVISION(2, 3) void reset();
90 Q_REVISION(2, 3) void discarded();
91 Q_REVISION(2, 3) void helpRequested();
92 Q_REVISION(2, 3) void resultChanged();
93 // 2.5 (Qt 5.12)
94 void implicitHeaderWidthChanged();
95 void implicitHeaderHeightChanged();
96 void implicitFooterWidthChanged();
97 void implicitFooterHeightChanged();
98
99protected:
100 QQuickDialog(QQuickDialogPrivate &dd, QObject *parent);
101
102#if QT_CONFIG(accessibility)
103 QAccessible::Role accessibleRole() const override;
104 void accessibilityActiveChanged(bool active) override;
105#endif
106
107private:
108 Q_DISABLE_COPY(QQuickDialog)
109 Q_DECLARE_PRIVATE(QQuickDialog)
110};
111
112QT_END_NAMESPACE
113
114QML_DECLARE_TYPE(QQuickDialog)
115
116#endif // QQUICKDIALOG_P_H
117

source code of qtdeclarative/src/quicktemplates/qquickdialog_p.h