diff --git a/app/viewmainpage.cpp b/app/viewmainpage.cpp --- a/app/viewmainpage.cpp +++ b/app/viewmainpage.cpp @@ -784,13 +784,13 @@ bool ViewMainPage::eventFilter(QObject* watched, QEvent* event) { if (event->type() == QEvent::ShortcutOverride) { - const QKeyEvent* keyEvent = static_cast(event); - if (keyEvent->key() == Qt::Key_Escape) { + const int key = static_cast(event)->key(); + if (key == Qt::Key_Space || key == Qt::Key_Escape) { const DocumentView* view = d->currentView(); if (view) { AbstractRasterImageViewTool* tool = view->currentTool(); if (tool) { - QKeyEvent toolKeyEvent(QEvent::KeyPress, Qt::Key_Escape, Qt::NoModifier); + QKeyEvent toolKeyEvent(QEvent::KeyPress, key, Qt::NoModifier); tool->keyPressEvent(&toolKeyEvent); if (toolKeyEvent.isAccepted()) { event->accept(); diff --git a/lib/crop/croptool.cpp b/lib/crop/croptool.cpp --- a/lib/crop/croptool.cpp +++ b/lib/crop/croptool.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -424,10 +425,16 @@ buttons->rejected(); break; case Qt::Key_Return: - case Qt::Key_Enter: + case Qt::Key_Enter: { event->accept(); - buttons->accepted(); + auto focusButton = static_cast(buttons->focusWidget()); + if (focusButton && buttons->buttonRole(focusButton) == QDialogButtonBox::RejectRole) { + buttons->rejected(); + } else { + buttons->accepted(); + } break; + } default: break; } diff --git a/lib/redeyereduction/redeyereductiontool.cpp b/lib/redeyereduction/redeyereductiontool.cpp --- a/lib/redeyereduction/redeyereductiontool.cpp +++ b/lib/redeyereduction/redeyereductiontool.cpp @@ -173,10 +173,16 @@ buttons->rejected(); break; case Qt::Key_Return: - case Qt::Key_Enter: + case Qt::Key_Enter: { event->accept(); - buttons->accepted(); + auto focusButton = static_cast(buttons->focusWidget()); + if (focusButton && buttons->buttonRole(focusButton) == QDialogButtonBox::RejectRole) { + buttons->rejected(); + } else { + buttons->accepted(); + } break; + } default: break; }