From 26bfe7cb1a5f068b5287174f113335c8731dac82 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 17 May 2017 14:34:51 +0200 Subject: Incorporate QQuickDialog::result from QQuickPlatformDialog The experimental QQuickPlatformDialog in Qt.labs.platform had a bit more elaborate accepted vs. rejected dialog result handling. Copy the same logic to QQuickDialog in QtQuick.Controls. [ChangeLog][Controls][Dialog] Added "result" property that holds whether the dialog was previously accepted or rejected. Change-Id: I2c55848b5eeaad2130d32a337c2590212736f22c Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickdialog_p.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/quicktemplates2/qquickdialog_p.h') diff --git a/src/quicktemplates2/qquickdialog_p.h b/src/quicktemplates2/qquickdialog_p.h index 97c90a59..0743ee0a 100644 --- a/src/quicktemplates2/qquickdialog_p.h +++ b/src/quicktemplates2/qquickdialog_p.h @@ -62,6 +62,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickDialog : public QQuickPopup Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL) Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL) Q_PROPERTY(QPlatformDialogHelper::StandardButtons standardButtons READ standardButtons WRITE setStandardButtons NOTIFY standardButtonsChanged FINAL) + Q_PROPERTY(int result READ result WRITE setResult NOTIFY resultChanged FINAL REVISION 3) Q_FLAGS(QPlatformDialogHelper::StandardButtons) public: @@ -79,9 +80,16 @@ public: QPlatformDialogHelper::StandardButtons standardButtons() const; void setStandardButtons(QPlatformDialogHelper::StandardButtons buttons); + enum StandardCode { Rejected, Accepted }; + Q_ENUM(StandardCode) + + int result() const; + void setResult(int result); + public Q_SLOTS: - void accept(); - void reject(); + virtual void accept(); + virtual void reject(); + virtual void done(int result); Q_SIGNALS: void accepted(); @@ -91,6 +99,7 @@ Q_SIGNALS: void headerChanged(); void footerChanged(); void standardButtonsChanged(); + Q_REVISION(3) void resultChanged(); protected: void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; -- cgit v1.2.3