1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2017 The Qt Company Ltd. 4 ** Contact: http://www.qt.io/licensing/ 5 ** 6 ** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit. 7 ** 8 ** $QT_BEGIN_LICENSE:LGPL3$ 9 ** Commercial License Usage 10 ** Licensees holding valid commercial Qt licenses may use this file in 11 ** accordance with the commercial license agreement provided with the 12 ** Software or, alternatively, in accordance with the terms contained in 13 ** a written agreement between you and The Qt Company. For licensing terms 14 ** and conditions see http://www.qt.io/terms-conditions. For further 15 ** information use the contact form at http://www.qt.io/contact-us. 16 ** 17 ** GNU Lesser General Public License Usage 18 ** Alternatively, this file may be used under the terms of the GNU Lesser 19 ** General Public License version 3 as published by the Free Software 20 ** Foundation and appearing in the file LICENSE.LGPLv3 included in the 21 ** packaging of this file. Please review the following information to 22 ** ensure the GNU Lesser General Public License version 3 requirements 23 ** will be met: https://www.gnu.org/licenses/lgpl.html. 24 ** 25 ** GNU General Public License Usage 26 ** Alternatively, this file may be used under the terms of the GNU 27 ** General Public License version 2.0 or later as published by the Free 28 ** Software Foundation and appearing in the file LICENSE.GPL included in 29 ** the packaging of this file. Please review the following information to 30 ** ensure the GNU General Public License version 2.0 requirements will be 31 ** met: http://www.gnu.org/licenses/gpl-2.0.html. 32 ** 33 ** $QT_END_LICENSE$ 34 ** 35 ****************************************************************************/ 36 37 #ifndef QQUICKDIALOG_P_H 38 #define QQUICKDIALOG_P_H 39 40 // 41 // W A R N I N G 42 // ------------- 43 // 44 // This file is not part of the Qt API. It exists purely as an 45 // implementation detail. This header file may change from version to 46 // version without notice, or even be removed. 47 // 48 // We mean it. 49 // 50 51 #include <QtQuickTemplates2/private/qquickpopup_p.h> 52 #include <QtGui/qpa/qplatformdialoghelper.h> 53 54 QT_BEGIN_NAMESPACE 55 56 class QQuickDialogPrivate; 57 class QQuickAbstractButton; 58 59 class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickDialog : public QQuickPopup 60 { 61 Q_OBJECT 62 Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL) 63 Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL) 64 Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL) 65 Q_PROPERTY(QPlatformDialogHelper::StandardButtons standardButtons READ standardButtons WRITE setStandardButtons NOTIFY standardButtonsChanged FINAL) 66 // 2.3 (Qt 5.10) 67 Q_PROPERTY(int result READ result WRITE setResult NOTIFY resultChanged FINAL REVISION 3) 68 Q_FLAGS(QPlatformDialogHelper::StandardButtons) 69 // 2.5 (Qt 5.12) 70 Q_PROPERTY(qreal implicitHeaderWidth READ implicitHeaderWidth NOTIFY implicitHeaderWidthChanged FINAL REVISION 5) 71 Q_PROPERTY(qreal implicitHeaderHeight READ implicitHeaderHeight NOTIFY implicitHeaderHeightChanged FINAL REVISION 5) 72 Q_PROPERTY(qreal implicitFooterWidth READ implicitFooterWidth NOTIFY implicitFooterWidthChanged FINAL REVISION 5) 73 Q_PROPERTY(qreal implicitFooterHeight READ implicitFooterHeight NOTIFY implicitFooterHeightChanged FINAL REVISION 5) 74 75 public: 76 explicit QQuickDialog(QObject *parent = nullptr); 77 78 QString title() const; 79 void setTitle(const QString &title); 80 81 QQuickItem *header() const; 82 void setHeader(QQuickItem *header); 83 84 QQuickItem *footer() const; 85 void setFooter(QQuickItem *footer); 86 87 QPlatformDialogHelper::StandardButtons standardButtons() const; 88 void setStandardButtons(QPlatformDialogHelper::StandardButtons buttons); 89 Q_REVISION(3) Q_INVOKABLE QQuickAbstractButton *standardButton(QPlatformDialogHelper::StandardButton button) const; 90 91 // 2.3 (Qt 5.10) 92 enum StandardCode { Rejected, Accepted }; 93 Q_ENUM(StandardCode) 94 95 int result() const; 96 void setResult(int result); 97 98 // 2.5 (Qt 5.12) 99 qreal implicitHeaderWidth() const; 100 qreal implicitHeaderHeight() const; 101 102 qreal implicitFooterWidth() const; 103 qreal implicitFooterHeight() const; 104 105 public Q_SLOTS: 106 virtual void accept(); 107 virtual void reject(); 108 virtual void done(int result); 109 110 Q_SIGNALS: 111 void accepted(); 112 void rejected(); 113 void titleChanged(); 114 void headerChanged(); 115 void footerChanged(); 116 void standardButtonsChanged(); 117 // 2.3 (Qt 5.10) 118 Q_REVISION(3) void applied(); 119 Q_REVISION(3) void reset(); 120 Q_REVISION(3) void discarded(); 121 Q_REVISION(3) void helpRequested(); 122 Q_REVISION(3) void resultChanged(); 123 // 2.5 (Qt 5.12) 124 void implicitHeaderWidthChanged(); 125 void implicitHeaderHeightChanged(); 126 void implicitFooterWidthChanged(); 127 void implicitFooterHeightChanged(); 128 129 protected: 130 #if QT_CONFIG(accessibility) 131 QAccessible::Role accessibleRole() const override; 132 void accessibilityActiveChanged(bool active) override; 133 #endif 134 135 private: 136 Q_DISABLE_COPY(QQuickDialog) 137 Q_DECLARE_PRIVATE(QQuickDialog) 138 }; 139 140 QT_END_NAMESPACE 141 142 QML_DECLARE_TYPE(QQuickDialog) 143 144 #endif // QQUICKDIALOG_P_H 145