From 91b48208f57b10f1b0378d1888fb96af73bc9fa3 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 12 Dec 2011 17:24:33 +0200 Subject: Add touchEvent() virtual to QWindow. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unlike keyPressEvent(), mousePressEvent(), etc. the touch events had no equivalent so one had to fall back to reimplementing event() or using an event filter. This is now corrected by introducing touchEvent(). Touch events are finally becoming a first-class citizen in Qt 5. Change-Id: Ia2044030154fd5b1b5384f08a3cb1749b798435f Reviewed-by: Samuel Rødal --- src/gui/kernel/qwindow.cpp | 9 +++++++++ src/gui/kernel/qwindow.h | 2 ++ 2 files changed, 11 insertions(+) (limited to 'src') diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 55329f56bd..d4f5e1dcf2 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -813,6 +813,12 @@ bool QWindow::event(QEvent *event) mouseDoubleClickEvent(static_cast(event)); break; + case QEvent::TouchBegin: + case QEvent::TouchUpdate: + case QEvent::TouchEnd: + touchEvent(static_cast(event)); + break; + case QEvent::Move: moveEvent(static_cast(event)); break; @@ -907,6 +913,9 @@ void QWindow::wheelEvent(QWheelEvent *) } #endif //QT_NO_WHEELEVENT +void QWindow::touchEvent(QTouchEvent *) +{ +} /*! diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 11ff6b101d..2a50248c8f 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -72,6 +72,7 @@ class QMouseEvent; #ifndef QT_NO_WHEELEVENT class QWheelEvent; #endif +class QTouchEvent; class QPlatformSurface; class QPlatformWindow; @@ -285,6 +286,7 @@ protected: #ifndef QT_NO_WHEELEVENT virtual void wheelEvent(QWheelEvent *); #endif + virtual void touchEvent(QTouchEvent *); QWindow(QWindowPrivate &dd, QWindow *parent); -- cgit v1.2.3