diff options
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsscene.cpp | 8 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 13 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication_p.h | 8 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetwindow_qpa.cpp | 2 | ||||
-rw-r--r-- | src/widgets/util/qflickgesture.cpp | 2 |
6 files changed, 20 insertions, 15 deletions
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index f99b72ffd0..791f25aa27 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -5808,7 +5808,7 @@ void QGraphicsScenePrivate::touchEventHandler(QTouchEvent *sceneTouchEvent) // update state QGraphicsItem *item = 0; if (touchPoint.state() == Qt::TouchPointPressed) { - if (sceneTouchEvent->deviceType() == QTouchEvent::TouchPad) { + if (sceneTouchEvent->device()->type() == QTouchDevice::TouchPad) { // on touch-pad devices, send all touch points to the same item item = itemForTouchPointId.isEmpty() ? 0 @@ -5823,7 +5823,7 @@ void QGraphicsScenePrivate::touchEventHandler(QTouchEvent *sceneTouchEvent) item = cachedItemsUnderMouse.isEmpty() ? 0 : cachedItemsUnderMouse.first(); } - if (sceneTouchEvent->deviceType() == QTouchEvent::TouchScreen) { + if (sceneTouchEvent->device()->type() == QTouchDevice::TouchScreen) { // on touch-screens, combine this touch point with the closest one we find int closestTouchPointId = findClosestTouchPointId(touchPoint.scenePos()); QGraphicsItem *closestItem = itemForTouchPointId.value(closestTouchPointId); @@ -5889,10 +5889,12 @@ void QGraphicsScenePrivate::touchEventHandler(QTouchEvent *sceneTouchEvent) QTouchEvent touchEvent(eventType); touchEvent.setWidget(sceneTouchEvent->widget()); - touchEvent.setDeviceType(sceneTouchEvent->deviceType()); + touchEvent.setDevice(sceneTouchEvent->device()); touchEvent.setModifiers(sceneTouchEvent->modifiers()); touchEvent.setTouchPointStates(it.value().first); touchEvent.setTouchPoints(it.value().second); + touchEvent.setTimestamp(sceneTouchEvent->timestamp()); + touchEvent.setWindow(sceneTouchEvent->window()); switch (touchEvent.type()) { case QEvent::TouchBegin: diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 472f19a3c1..afd5fb70e1 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -5214,7 +5214,7 @@ int QApplicationPrivate::findClosestTouchPointId(const QPointF &screenPos) } void QApplicationPrivate::translateRawTouchEvent(QWidget *window, - QTouchEvent::DeviceType deviceType, + QTouchDevice *device, const QList<QTouchEvent::TouchPoint> &touchPoints, ulong timestamp) { @@ -5234,7 +5234,7 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, switch (touchPoint.state()) { case Qt::TouchPointPressed: { - if (deviceType == QTouchEvent::TouchPad) { + if (device->type() == QTouchDevice::TouchPad) { // on touch-pads, send all touch points to the same widget widget = d->widgetForTouchPointId.isEmpty() ? QWeakPointer<QWidget>() @@ -5252,7 +5252,7 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, widget = window; } - if (deviceType == QTouchEvent::TouchScreen) { + if (device->type() == QTouchDevice::TouchScreen) { int closestTouchPointId = d->findClosestTouchPointId(touchPoint.screenPos()); QWidget *closestWidget = d->widgetForTouchPointId.value(closestTouchPointId).data(); if (closestWidget @@ -5348,12 +5348,13 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, } QTouchEvent touchEvent(eventType, - deviceType, + device, QApplication::keyboardModifiers(), it.value().first, it.value().second); updateTouchPointsForWidget(widget, &touchEvent); touchEvent.setTimestamp(timestamp); + touchEvent.setWindow(window->windowHandle()); switch (touchEvent.type()) { case QEvent::TouchBegin: @@ -5376,11 +5377,11 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, } Q_WIDGETS_EXPORT void qt_translateRawTouchEvent(QWidget *window, - QTouchEvent::DeviceType deviceType, + QTouchDevice *device, const QList<QTouchEvent::TouchPoint> &touchPoints, ulong timestamp) { - QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints, timestamp); + QApplicationPrivate::translateRawTouchEvent(window, device, touchPoints, timestamp); } #ifndef QT_NO_GESTURES diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 7b663608f7..3841cef62f 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -83,6 +83,7 @@ class QInputContext; class QObject; class QWidget; class QSocketNotifier; +class QTouchDevice; #ifndef QT_NO_GESTURES class QGestureManager; #endif @@ -482,7 +483,7 @@ public: void appendTouchPoint(const QTouchEvent::TouchPoint &touchPoint); void removeTouchPoint(int touchPointId); static void translateRawTouchEvent(QWidget *widget, - QTouchEvent::DeviceType deviceType, + QTouchDevice *device, const QList<QTouchEvent::TouchPoint> &touchPoints, ulong timestamp); @@ -554,8 +555,9 @@ private: }; Q_WIDGETS_EXPORT void qt_translateRawTouchEvent(QWidget *window, - QTouchEvent::DeviceType deviceType, - const QList<QTouchEvent::TouchPoint> &touchPoints); + QTouchDevice *device, + const QList<QTouchEvent::TouchPoint> &touchPoints, + ulong timestamp); #if defined(Q_WS_WIN) extern void qt_win_set_cursor(QWidget *, bool); diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index e5ebfba851..7ec37bb929 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -8251,7 +8251,7 @@ bool QWidget::event(QEvent *event) #ifndef Q_WS_MAC QTouchEvent *touchEvent = static_cast<QTouchEvent *>(event); const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().first(); - if (touchPoint.isPrimary() || touchEvent->deviceType() == QTouchEvent::TouchPad) + if (touchPoint.isPrimary() || touchEvent->device()->type() == QTouchDevice::TouchPad) break; // fake a mouse event! diff --git a/src/widgets/kernel/qwidgetwindow_qpa.cpp b/src/widgets/kernel/qwidgetwindow_qpa.cpp index 5b7ded9ece..e3178db8c9 100644 --- a/src/widgets/kernel/qwidgetwindow_qpa.cpp +++ b/src/widgets/kernel/qwidgetwindow_qpa.cpp @@ -289,7 +289,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) void QWidgetWindow::handleTouchEvent(QTouchEvent *event) { - QApplicationPrivate::translateRawTouchEvent(m_widget, event->deviceType(), event->touchPoints(), event->timestamp()); + QApplicationPrivate::translateRawTouchEvent(m_widget, event->device(), event->touchPoints(), event->timestamp()); } void QWidgetWindow::handleKeyEvent(QKeyEvent *event) diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp index a028b27d72..fbbefcf89f 100644 --- a/src/widgets/util/qflickgesture.cpp +++ b/src/widgets/util/qflickgesture.cpp @@ -551,7 +551,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state, if (!inputType) inputType = QScroller::InputMove; - if (te->deviceType() == QTouchEvent::TouchPad) { + if (te->device()->type() == QTouchDevice::TouchPad) { if (te->touchPoints().count() != 2) // 2 fingers on pad return Ignore; |