Both Crop and Reduce Red Eye feature a Cancel button.
While normally pressing Enter or Space while a button has
keyboard focus should trigger the button's action, in this case
incorrect actions were executed: Enter accepted the modifications,
i.e. it did the opposite of what the label said, and Space even
jumped to the next image.
For Enter this can be solved by explicitely checking for keyboard
focus, which avoids the underlying problem, i.e. that
ViewMainPage::slotEnterPressed calls *Tool::keyPressEvent before
QDialogButtonBox had a chance to handle the event. For Space
forwarding in ViewMainPage::eventFilter is enough to override the
default shortcut handler, since *Tool::keyPressEvent will implicitely
Note that this also prevents Space from navigating to the next
image even when the buttons are not focused. We could bring that back,
but it would actually be more consistent if we did not, since the arrow
keys are also blocked when a tool is active. To still navigate away
while a tool is active, users can set a secondary shortcut for
Next to avoid getting in conflict with how Space is supposed
to work on buttons.