aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickpopup_p_p.h
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-10-21 22:10:39 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-11-01 12:59:45 +0000
commitb31b4094e1728d839fef30f5128c81451ea75e4a (patch)
treed7288c7a964a1fb9f45612e9e4b98c40dc2b1a73 /src/quicktemplates2/qquickpopup_p_p.h
parent281469e947e6b09a44c296a26db474db815f6238 (diff)
QQuickPopup: use QShortcutMap to grab Back & Escape keys
This makes CloseOnEscape play well together with QML Shortcut, as illustrated by the Gallery example. For example, navigate to any control page, open the options menu, and hit escape twice. First, the options menu closes, and then the stackview navigates back. Another nice example is to open the style combobox in the settings dialog, while being navigated to one of the control pages, and hit escape three times. First, the combobox closes, then the settings dialog closes, and finally, the stackview navigates back. NOTE: tst_combobox had to be updated, because it was assuming that the popup is closed when escape is released. Now that the system is based on shortcut overrides, it gets closed on press instead. Task-number: QTBUG-56562 Change-Id: I8b8901bcba7deebd82b181af42f335d95a7cb469 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickpopup_p_p.h')
-rw-r--r--src/quicktemplates2/qquickpopup_p_p.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickpopup_p_p.h b/src/quicktemplates2/qquickpopup_p_p.h
index d2f16e11..96ce2ca0 100644
--- a/src/quicktemplates2/qquickpopup_p_p.h
+++ b/src/quicktemplates2/qquickpopup_p_p.h
@@ -86,9 +86,13 @@ class QQuickPopupItem : public QQuickControl
public:
explicit QQuickPopupItem(QQuickPopup *popup);
+ void grabShortcut();
+ void ungrabShortcut();
+
protected:
void updatePolish() override;
+ bool event(QEvent *event) override;
bool childMouseEventFilter(QQuickItem *child, QEvent *event) override;
void focusInEvent(QFocusEvent *event) override;
void focusOutEvent(QFocusEvent *event) override;