From 47bd603dba7c1d66871646f309407976aafe2f6b Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 19 Nov 2019 06:21:01 +0100 Subject: Pass the timestamp as a string from JS to Qt to preserve precision When the timestamp was passed as a double from JS to Qt while being hosted on an embedded Linux device it was losing the precision and as a result scrolling for a ListView does not work because it does not see the timestamp has having changed. So by passing it as a string instead means that it does not lose anything in the transition. Fixes: QTBUG-79842 Change-Id: Ia6bb8b713c0c5296a046ff3f7fddbc8e8249bbd6 Reviewed-by: Jesus Fernandez --- src/plugins/platforms/webgl/qwebglintegration.cpp | 10 +++++----- src/plugins/platforms/webgl/webqt.jsx | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/webgl/qwebglintegration.cpp b/src/plugins/platforms/webgl/qwebglintegration.cpp index 645c766..5031e5e 100644 --- a/src/plugins/platforms/webgl/qwebglintegration.cpp +++ b/src/plugins/platforms/webgl/qwebglintegration.cpp @@ -493,10 +493,10 @@ void QWebGLIntegrationPrivate::handleMouse(const ClientData &clientData, const Q QPointF globalPos(object.value("clientX").toDouble(), object.value("clientY").toDouble()); auto buttons = static_cast(object.value("buttons").toInt()); - auto time = object.value("time").toDouble(); + auto time = object.value("time").toString(); auto platformWindow = findWindow(clientData, winId); QWindowSystemInterface::handleMouseEvent(platformWindow->window(), - static_cast(time), + time.toULong(), localPos, globalPos, Qt::MouseButtons(buttons), @@ -535,11 +535,11 @@ void QWebGLIntegrationPrivate::handleTouch(const ClientData &clientData, const Q const auto winId = object.value("name").toInt(-1); Q_ASSERT(winId != -1); auto window = findWindow(clientData, winId)->window(); - const auto time = object.value("time").toDouble(); + const auto time = object.value("time").toString(); const auto eventType = object.value("event").toString(); if (eventType == QStringLiteral("touchcancel")) { QWindowSystemInterface::handleTouchCancelEvent(window, - time, + time.toULong(), touchDevice, Qt::NoModifier); } else { @@ -585,7 +585,7 @@ void QWebGLIntegrationPrivate::handleTouch(const ClientData &clientData, const Q } QWindowSystemInterface::handleTouchEvent(window, - time, + time.toULong(), touchDevice, points, Qt::NoModifier); diff --git a/src/plugins/platforms/webgl/webqt.jsx b/src/plugins/platforms/webgl/webqt.jsx index ca2b3b5..02f93a5 100644 --- a/src/plugins/platforms/webgl/webqt.jsx +++ b/src/plugins/platforms/webgl/webqt.jsx @@ -212,7 +212,7 @@ window.onload = function () { var object = { "type": "mouse", "buttons": buttons, "layerX": layerX, "layerY": layerY, "clientX": clientX, "clientY": clientY, - "time": new Date().getTime(), + "time": new Date().getTime().toString(), "name": name }; sendObject(object); @@ -285,7 +285,7 @@ window.onload = function () { var object = { "type": "touch", "name": name, - "time": new Date().getTime(), + "time": new Date().getTime().toString(), "event": event.type, "changedTouches": [], "stationaryTouches": [], -- cgit v1.2.3