summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@kdab.com>2015-04-03 08:42:32 +0200
committerKevin Ottens <kevin.ottens@kdab.com>2015-06-29 08:43:08 +0000
commit094d36760afbccf83a75816585b3b7376ac84063 (patch)
tree08095d3383ba965f326c5b3bbf2c6d48f9ef9555
parentb5e1cd9954ec5bd64806cb1ae8a6abcd6275f945 (diff)
downloadqtquickcontrols-094d36760afbccf83a75816585b3b7376ac84063.tar.gz
Fix Dialog behavior
We should emit the accepted and rejected signals, not call the accept and reject slots directly. Also it doesn't make sense to close the dialog by default for some standard buttons namely Help, Apply and Reset. Change-Id: I48a3bc3c870f1d2f97f923fc24c57abd6594073b Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
-rw-r--r--src/dialogs/qquickdialog.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/dialogs/qquickdialog.cpp b/src/dialogs/qquickdialog.cpp
index 3ebd9aef..6a4a0721 100644
--- a/src/dialogs/qquickdialog.cpp
+++ b/src/dialogs/qquickdialog.cpp
@@ -338,27 +338,31 @@ void QQuickDialog::setStandardButtons(StandardButtons buttons)
void QQuickDialog::click(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role)
{
- setVisible(false);
m_clickedButton = static_cast<StandardButton>(button);
emit buttonClicked();
switch (role) {
case QPlatformDialogHelper::AcceptRole:
- emit accept();
+ emit accepted();
+ setVisible(false);
break;
case QPlatformDialogHelper::RejectRole:
- emit reject();
+ emit rejected();
+ setVisible(false);
break;
case QPlatformDialogHelper::DestructiveRole:
emit discard();
+ setVisible(false);
break;
case QPlatformDialogHelper::HelpRole:
emit help();
break;
case QPlatformDialogHelper::YesRole:
emit yes();
+ setVisible(false);
break;
case QPlatformDialogHelper::NoRole:
emit no();
+ setVisible(false);
break;
case QPlatformDialogHelper::ApplyRole:
emit apply();