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_REQUIRE_CONFIG(quicktemplates2_container);
23
24QT_BEGIN_NAMESPACE
25
26class QQuickDialogPrivate;
27
28class Q_QUICKTEMPLATES2_EXPORT QQuickDialog : public QQuickPopup
29{
30 Q_OBJECT
31 Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
32 Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL)
33 Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL)
34 Q_PROPERTY(QPlatformDialogHelper::StandardButtons standardButtons READ standardButtons WRITE setStandardButtons NOTIFY standardButtonsChanged FINAL)
35 // 2.3 (Qt 5.10)
36 Q_PROPERTY(int result READ result WRITE setResult NOTIFY resultChanged FINAL REVISION(2, 3))
37 QML_EXTENDED_NAMESPACE(QPlatformDialogHelper)
38 // 2.5 (Qt 5.12)
39 Q_PROPERTY(qreal implicitHeaderWidth READ implicitHeaderWidth NOTIFY implicitHeaderWidthChanged FINAL REVISION(2, 5))
40 Q_PROPERTY(qreal implicitHeaderHeight READ implicitHeaderHeight NOTIFY implicitHeaderHeightChanged FINAL REVISION(2, 5))
41 Q_PROPERTY(qreal implicitFooterWidth READ implicitFooterWidth NOTIFY implicitFooterWidthChanged FINAL REVISION(2, 5))
42 Q_PROPERTY(qreal implicitFooterHeight READ implicitFooterHeight NOTIFY implicitFooterHeightChanged FINAL REVISION(2, 5))
43 QML_NAMED_ELEMENT(Dialog)
44 QML_ADDED_IN_VERSION(2, 1)
45
46public:
47 explicit QQuickDialog(QObject *parent = nullptr);
48 ~QQuickDialog();
49
50 QString title() const;
51 void setTitle(const QString &title);
52
53 QQuickItem *header() const;
54 void setHeader(QQuickItem *header);
55
56 QQuickItem *footer() const;
57 void setFooter(QQuickItem *footer);
58
59 QPlatformDialogHelper::StandardButtons standardButtons() const;
60 void setStandardButtons(QPlatformDialogHelper::StandardButtons buttons);
61 Q_REVISION(2, 3) Q_INVOKABLE QQuickAbstractButton *standardButton(QPlatformDialogHelper::StandardButton button) const;
62
63 // 2.3 (Qt 5.10)
64 enum StandardCode { Rejected, Accepted };
65 Q_ENUM(StandardCode)
66
67 int result() const;
68 void setResult(int result);
69
70 // 2.5 (Qt 5.12)
71 qreal implicitHeaderWidth() const;
72 qreal implicitHeaderHeight() const;
73
74 qreal implicitFooterWidth() const;
75 qreal implicitFooterHeight() const;
76
77 void setOpacity(qreal opacity) override;
78
79public Q_SLOTS:
80 virtual void accept();
81 virtual void reject();
82 virtual void done(int result);
83
84Q_SIGNALS:
85 void accepted();
86 void rejected();
87 void titleChanged();
88 void headerChanged();
89 void footerChanged();
90 void standardButtonsChanged();
91 // 2.3 (Qt 5.10)
92 Q_REVISION(2, 3) void applied();
93 Q_REVISION(2, 3) void reset();
94 Q_REVISION(2, 3) void discarded();
95 Q_REVISION(2, 3) void helpRequested();
96 Q_REVISION(2, 3) void resultChanged();
97 // 2.5 (Qt 5.12)
98 void implicitHeaderWidthChanged();
99 void implicitHeaderHeightChanged();
100 void implicitFooterWidthChanged();
101 void implicitFooterHeightChanged();
102
103protected:
104 QQuickDialog(QQuickDialogPrivate &dd, QObject *parent);
105
106#if QT_CONFIG(accessibility)
107 QAccessible::Role accessibleRole() const override;
108 void accessibilityActiveChanged(bool active) override;
109#endif
110
111private:
112 Q_DISABLE_COPY(QQuickDialog)
113 Q_DECLARE_PRIVATE(QQuickDialog)
114};
115
116QT_END_NAMESPACE
117
118#endif // QQUICKDIALOG_P_H
119

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

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