aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2015-12-02 09:51:35 +0100
committerAndy Shaw <andy.shaw@qt.io>2017-11-06 23:56:16 +0000
commit37d25a5112cdf13620715c03d6bdbd1bc3cde515 (patch)
treeb1621e308555d25ab0c08df64e8e2fc34ce54eaf /src
parent5fc892ef86870021ad11d0be6981aa9630c1c01c (diff)
QQuickWidget: pass enter and leave events to the offscreen window
By passing the enter and leave events to the offscreen window it will enable mouse areas inside a QQuickWidget to know when the mouse has actually entered or left the area if it is covering the whole item. Task-number: QTBUG-45557 Change-Id: I670ebe30e367e919c73fed449bf2bed7ca42b5fd Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quickwidgets/qquickwidget.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index 4c4f5fa9f3..9e18ac2270 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -1398,6 +1398,7 @@ bool QQuickWidget::event(QEvent *e)
switch (e->type()) {
+ case QEvent::Leave:
case QEvent::TouchBegin:
case QEvent::TouchEnd:
case QEvent::TouchUpdate:
@@ -1451,6 +1452,14 @@ bool QQuickWidget::event(QEvent *e)
case QEvent::ShortcutOverride:
return QCoreApplication::sendEvent(d->offscreenWindow, e);
+ case QEvent::Enter: {
+ QEnterEvent *enterEvent = static_cast<QEnterEvent *>(e);
+ QEnterEvent mappedEvent(enterEvent->localPos(), enterEvent->windowPos(),
+ enterEvent->screenPos());
+ const bool ret = QCoreApplication::sendEvent(d->offscreenWindow, &mappedEvent);
+ e->setAccepted(mappedEvent.isAccepted());
+ return ret;
+ }
default:
break;
}