HomePhabricator

Merge #13791: gui: Reject dialogs if key escape is pressed

Description

Merge #13791: gui: Reject dialogs if key escape is pressed

Summary:
7bf22bf0c21d13557ec46a67413819ebcabc3df0 gui: Reject options dialog when key escape is pressed (João Barbosa)
4a43306a4f643cf0d356d5d5e16913541f1bc893 gui: Reject edit address dialog when key escape is pressed (João Barbosa)
f7a553177d4b969956bc04a0140fce34958971f5 gui: Add GUIUtil::ItemDelegate with keyEscapePressed signal (João Barbosa)

Pull request description:

Currently `EditAddressDialog` and `OptionsDialog` don't close when the escape key is pressed. The `QDataWidgetMapper` instances prevents closing the dialogs because the escape key is used to reset the widgets values. More details and workarounds in https://stackoverflow.com/a/51487847 and http://qtramblings.blogspot.com/2010/10/qdatawidgetmapper-annoyances.html.

The adopted solution is different from the above references. It turns out that `QDataWidgetMapper::setItemDelegate` sets the event filter for all mapped widgets. So in this PR the mapper's delegate are changed to a custom `GUIUtil::ItemDelegate` that offers the signal `keyEscapePressed`, which is connected to the `QDialog::reject` slot.

Note that the installed event filter lets all events pass, so the current behaviour isn't changed, meaning that widgets values are reset in addition to closing the dialog.

Tree-SHA512: 9c961d488480b4ccc3880a11a8f1824b65f77570ee8918c7302c62775a1a73e52ae988a31a55ffff87b4170ddbecf833c2f09b66095c00eb6854a4d43f030f1f

Backport of Core PR13791
https://github.com/bitcoin/bitcoin/pull/13791/

Test Plan:

make check
./bitcoin-qt

Opena dialog window (i.e. the debug window in Help) and verify that it closes when the ESC key is pressed.

Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: deadalnix, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D4792

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on Aug 2 2018, 10:45
nakihitoCommitted on Dec 23 2019, 18:58
nakihitoPushed on Dec 23 2019, 18:58
Reviewer
Restricted Owners Package
Differential Revision
D4792: Merge #13791: gui: Reject dialogs if key escape is pressed
Parents
rABC95b3682e2f76: refactor null-signature checks in OP_CHECKSIG, OP_CHECKDATASIG
Branches
Unknown
Tags
Unknown