From 41162ea2e880b40ddedca5c0fd56a2747fa96ad4 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Thu, 2 Jan 2014 10:51:51 +0100 Subject: [PATCH] Only try to click the focused button when pressing enter. It makes no sense when pressing the escape button. --- src/gui/DialogyWidget.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gui/DialogyWidget.cpp b/src/gui/DialogyWidget.cpp index 617224984..349a5eea4 100644 --- a/src/gui/DialogyWidget.cpp +++ b/src/gui/DialogyWidget.cpp @@ -60,10 +60,14 @@ void DialogyWidget::keyPressEvent(QKeyEvent* e) bool DialogyWidget::clickButton(QDialogButtonBox::StandardButton standardButton) { - QPushButton* pb = qobject_cast(focusWidget()); - if (pb && pb->isVisible() && pb->isEnabled() && pb->hasFocus()) { - pb->click(); - return true; + QPushButton* pb; + + if (standardButton == QDialogButtonBox::Ok) { + pb = qobject_cast(focusWidget()); + if (pb && pb->isVisible() && pb->isEnabled() && pb->hasFocus()) { + pb->click(); + return true; + } } QList buttonBoxes = findChildren();