From 5e9f410eb67175b0f1abe95cabdb64dd30a6e7d7 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 5 Sep 2011 15:56:37 +0300 Subject: Add timestamp to QInputEvent. The mouse, touch, key events have no timestamp field currently, meaning that the timestamp passed to QWindowSystemInterface's handleMouse, Touch, KeyEvent functions will not be stored in the generated events. The timestamp can be quite valuable in some cases (e.g. when performing filtering of touch events) so losing this information is not desirable. The patch adds a timestamp field to QInputEvent, which is the base for mouse, touch, key, and other events, and also makes QGuiApplication to store the timestamp in the generated events. Change-Id: Icb9de8b238cb341916eac33ce21603f4955baca7 Reviewed-on: http://codereview.qt.nokia.com/4196 Reviewed-by: Lars Knoll --- src/widgets/kernel/qapplication.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/widgets/kernel/qapplication.cpp') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index af49b658be..043b114c64 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3790,6 +3790,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) QMouseEvent me(mouse->type(), relpos, mouse->windowPos(), mouse->globalPos(), mouse->button(), mouse->buttons(), mouse->modifiers()); me.spont = mouse->spontaneous(); + me.setTimestamp(mouse->timestamp()); // throw away any mouse-tracking-only mouse events if (!w->hasMouseTracking() && mouse->type() == QEvent::MouseMove && mouse->buttons() == 0) { -- cgit v1.2.3