Skip to content

KPageDialog: Handle Esc to close in keyReleaseEvent, not keyPressEvent

This differs from QDialog behavior where it closes on keyPressEvent, and leaves the release event to be handled by whatever is underneath.

This causes problems where the thing underneath handles Esc to close on release.

The specific motivation for this is from graphics/spectacle!157 (closed), which changes Spectacle (itself a QDialog) to handle Esc on release, to prevent windows underneath from getting the event (which causes things like https://bugs.kde.org/428478). However, as Spectacle uses a KConfigDialog (which inherits KPageDialog) for configuration, with this change when you press Esc to exit the config dialog, it absorbs the press event but leaves the release event for Spectacle's main window to deal with, which then exits. I thought KPageDialog was the right place to solve this.

Merge request reports