Skip to content

Commit 47bd603

Browse files
committed
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 <[email protected]>
1 parent ef0f5f5 commit 47bd603

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/plugins/platforms/webgl/qwebglintegration.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -493,10 +493,10 @@ void QWebGLIntegrationPrivate::handleMouse(const ClientData &clientData, const Q
493493
QPointF globalPos(object.value("clientX").toDouble(),
494494
object.value("clientY").toDouble());
495495
auto buttons = static_cast<Qt::MouseButtons>(object.value("buttons").toInt());
496-
auto time = object.value("time").toDouble();
496+
auto time = object.value("time").toString();
497497
auto platformWindow = findWindow(clientData, winId);
498498
QWindowSystemInterface::handleMouseEvent(platformWindow->window(),
499-
static_cast<ulong>(time),
499+
time.toULong(),
500500
localPos,
501501
globalPos,
502502
Qt::MouseButtons(buttons),
@@ -535,11 +535,11 @@ void QWebGLIntegrationPrivate::handleTouch(const ClientData &clientData, const Q
535535
const auto winId = object.value("name").toInt(-1);
536536
Q_ASSERT(winId != -1);
537537
auto window = findWindow(clientData, winId)->window();
538-
const auto time = object.value("time").toDouble();
538+
const auto time = object.value("time").toString();
539539
const auto eventType = object.value("event").toString();
540540
if (eventType == QStringLiteral("touchcancel")) {
541541
QWindowSystemInterface::handleTouchCancelEvent(window,
542-
time,
542+
time.toULong(),
543543
touchDevice,
544544
Qt::NoModifier);
545545
} else {
@@ -585,7 +585,7 @@ void QWebGLIntegrationPrivate::handleTouch(const ClientData &clientData, const Q
585585
}
586586

587587
QWindowSystemInterface::handleTouchEvent(window,
588-
time,
588+
time.toULong(),
589589
touchDevice,
590590
points,
591591
Qt::NoModifier);

src/plugins/platforms/webgl/webqt.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ window.onload = function () {
212212
var object = { "type": "mouse",
213213
"buttons": buttons,
214214
"layerX": layerX, "layerY": layerY, "clientX": clientX, "clientY": clientY,
215-
"time": new Date().getTime(),
215+
"time": new Date().getTime().toString(),
216216
"name": name
217217
};
218218
sendObject(object);
@@ -285,7 +285,7 @@ window.onload = function () {
285285
var object = {
286286
"type": "touch",
287287
"name": name,
288-
"time": new Date().getTime(),
288+
"time": new Date().getTime().toString(),
289289
"event": event.type,
290290
"changedTouches": [],
291291
"stationaryTouches": [],

0 commit comments

Comments
 (0)