summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2019-11-19 06:21:01 +0100
committerAndy Shaw <andy.shaw@qt.io>2019-11-28 10:34:14 +0100
commit47bd603dba7c1d66871646f309407976aafe2f6b (patch)
tree06f2a09c571031a72b5749a77e7b0278e1d7bfd3
parentef0f5f5ed8cdb6dd70f728fd1873158785f43d27 (diff)
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 <jsfdez@gmail.com>
-rw-r--r--src/plugins/platforms/webgl/qwebglintegration.cpp10
-rw-r--r--src/plugins/platforms/webgl/webqt.jsx4
2 files changed, 7 insertions, 7 deletions
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<Qt::MouseButtons>(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<ulong>(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": [],