diff options
author | Eike Hein <hein@kde.org> | 2016-01-21 00:01:12 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-09-15 14:19:08 +0000 |
commit | 4e6c5eade5504b335e31bd0950b9a702f8db58e7 (patch) | |
tree | a10a5a0dffc106fb186410373cda0168c1ae79df /src/qml/qml.pro | |
parent | 43a65845e6148a2346b2ccdb2442cef6c43df94c (diff) |
Propagate window enter event as hover enter event in QQuickWindow
QQuickWindow currently propagates window leave events as hover leave
events to its content item, but it does not propagate window enter
events as corresponding hover enter events. Instead, hover enter is only
triggered implicitly by mouse moves.
This can cause problems when there is no mouse movement inbetween the
window being entered and a subsequent button press event. A common
example where this occurs is dismissing a mouse-grabbing popup window
(e.g. a QMenu) by clicking outside the popup, and then clicking in the
same spot that was clicked to dismiss the popup. Without this patch,
hover state is not realized until movement occurs, so there may be no
no visual feedback and code that needs to update state based on what is
being hovered prior to handling a press event can't work correctly.
This patch synthesizes a QHoverEvent and delivers it in response to
QEvent::Enter, similar to how QEvent::Leave is already handled.
QWidget handles this correctly via QWidget::enterEvent. The equivalent
in Qt Quick is QQuickItem::hoverEnterEvent, ultimately called with the
synthesized event.
The patch also updates the touchmouse::hoverEnabled autotest. Due to
the window enter event now being handled correctly, exitSpy2 would run
up a count() of 2, as the cursor was not in a neutral position after
previous test cases. The change makes sure the cursor is in a neutral
position before test case activity.
[ChangeLog][QQuickWindow] The relevant child item is now sent a hover
event when the window receives a QEnterEvent, making sure hovering is
recognized without waiting for mouse movement.
Change-Id: If0586f6cd971df0dfc266bb1a39c9cdb184fd286
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/qml/qml.pro')
0 files changed, 0 insertions, 0 deletions