Catching Escape on a Popup
-
Hi,
I have a popup window where some settings can be done. Its close policy is set to CloseOnEscape, but if the user made a change, there should be a warning if he wants to apply those changes.
I wonder how I can achieve this. Using the closePolicy is closing the popup immediately. Using Keys.onEscapePressed does not seem to work, maybe because a popup is not an Item.
-
@maxwell31 according to this stack overflow thread
https://stackoverflow.com/questions/55510064/qml-popup-know-how-it-was-closed/55511670
esc shortcut should work, can you show, what you tried?
-
Thanks for the Stackoverflow post. I tried
Shortcut { sequence: "Esc" onActivated: { console.log("Esc: cancel a few things") popup.close() } }
but for some reason it does not get triggered if I hit Esc and I don't get the console message. I will try a minimal (not)working example and post it here