diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-06-06 15:58:36 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-06-07 09:56:27 +0000 |
commit | 0d59bff8929299ce5e2d9ec957055854a59c6cd6 (patch) | |
tree | 34e0c56e2af911bab3e5098e022af2d79d6eae8b /src/quicktemplates2/qquickmenu_p_p.h | |
parent | f37397ba3125e1ab5dc940270d90844a6010224f (diff) |
QQuickMenu: update the highlighted item on mouse hover
This is the expected behavior on desktop.
NOTE: It must be possible to mix mouse hover highlighting, and keyboard
navigation in the way that keyboard navigation must seamlessly continue
from the item that was previously mouse highlighted. Furthermore, there
should be only one item highlighted at a time. In order to be able to
respect keyboard navigation while another item is hovered and vice versa,
the visual highlight should be bound to MenuItem::highlighted instead of
Control::activeFocus or Control::hovered.
[ChangeLog][Controls][MenuItem] Menu has been fixed to highlight its
items while key navigating and mouse hovering to ensure seamless item
highlight between mouse hover and key navigation. In order to provide
appropriate highlighting that works for key navigation and mouse hover,
styles should bind their visual highlight to MenuItem::highlighted
instead of Control::activeFocus or Control::hovered.
Change-Id: I70cad5a5b441f2616d1ce2166e97974dc1ae063f
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickmenu_p_p.h')
-rw-r--r-- | src/quicktemplates2/qquickmenu_p_p.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickmenu_p_p.h b/src/quicktemplates2/qquickmenu_p_p.h index ff781906..b9e0512b 100644 --- a/src/quicktemplates2/qquickmenu_p_p.h +++ b/src/quicktemplates2/qquickmenu_p_p.h @@ -59,6 +59,7 @@ class QQuickMenu; class QQuickAction; class QQmlComponent; class QQmlObjectModel; +class QQuickMenuItem; class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickMenuPrivate : public QQuickPopupPrivate { @@ -83,6 +84,7 @@ public: void itemGeometryChanged(QQuickItem *, QQuickGeometryChange change, const QRectF &diff) override; void onItemPressed(); + void onItemHovered(); void onItemActiveFocusChanged(); int currentIndex() const; @@ -93,6 +95,7 @@ public: static QObject *contentData_at(QQmlListProperty<QObject> *prop, int index); static void contentData_clear(QQmlListProperty<QObject> *prop); + QPointer<QQuickMenuItem> currentItem; QQuickItem *contentItem; // TODO: cleanup QVector<QObject *> contentData; QQmlObjectModel *contentModel; |