summaryrefslogtreecommitdiffstats
path: root/src/core/web_event_factory.cpp
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2017-11-06 16:04:45 +0100
committerPeter Varga <pvarga@inf.u-szeged.hu>2017-11-09 07:13:55 +0000
commit4de8486b6614896a2b84cc64b69606c7b3bd07e8 (patch)
tree3b7573d16a6ba5b60eff36df52597c5199ad35c8 /src/core/web_event_factory.cpp
parentf3fdb0d2200ee1fa06bb8620f8bef84a37ab753a (diff)
Notify Chromium about leaving view
Forward QEvent::Leave for Widget and QEvent::HoverLeave for Quick. Task-number: QTBUG-64265 Change-Id: Ide32768902956476d24b1d4115e305392b62feb3 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/web_event_factory.cpp')
-rw-r--r--src/core/web_event_factory.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp
index f5264708d..0e46aced5 100644
--- a/src/core/web_event_factory.cpp
+++ b/src/core/web_event_factory.cpp
@@ -1019,12 +1019,14 @@ static ui::DomKey getDomKeyFromQKeyEvent(QKeyEvent *ev)
}
}
-static inline double currentTimeForEvent(const QInputEvent* event)
+static inline double currentTimeForEvent(const QEvent *event)
{
Q_ASSERT(event);
- if (event->timestamp())
- return static_cast<double>(event->timestamp()) / 1000;
+ if (const QInputEvent *inputEvent = static_cast<const QInputEvent *>(event)) {
+ if (inputEvent->timestamp())
+ return static_cast<double>(inputEvent->timestamp()) / 1000;
+ }
static QElapsedTimer timer;
if (!timer.isValid())
@@ -1211,6 +1213,16 @@ WebMouseEvent WebEventFactory::toWebMouseEvent(QHoverEvent *ev, double dpiScale)
return webKitEvent;
}
+WebMouseEvent WebEventFactory::toWebMouseEvent(QEvent *ev)
+{
+ Q_ASSERT(ev->type() == QEvent::Leave || ev->type() == QEvent::HoverLeave);
+
+ WebMouseEvent webKitEvent;
+ webKitEvent.timeStampSeconds = currentTimeForEvent(ev);
+ webKitEvent.type = WebInputEvent::MouseLeave;
+ return webKitEvent;
+}
+
#ifndef QT_NO_GESTURES
WebGestureEvent WebEventFactory::toWebGestureEvent(QNativeGestureEvent *ev, double dpiScale)
{