Unsolved Missing TouchEvent
-
Hi,
i need some help regarding touch events.
I created a QWindow and reimplemented the touchEvent function.
My problem is when i use more than one finger on the touchpad, i only get 1 TouchEnd notification.I implemented a custom QAbstractNativeEventFilter which sends a QTouchEvent to my window which looks like this:
class TouchEventFilter : public QAbstractNativeEventFilter { public: virtual bool nativeEventFilter(const QByteArray &eventType, void* message, long*) Q_DECL_OVERRIDE { if (eventType == "windows_generic_MSG") { MSG* msg = static_cast<MSG*>(message); if (msg->message == WM_POINTERUP) { if ((WId)(msg->hwnd) == window->winId()) { QList<QTouchEvent::TouchPoint> touchPoints; QTouchEvent::TouchPoint point; QPointF position(GET_X_LPARAM(msg->lParam), GET_Y_LPARAM(msg->lParam)); point.setPos(position); point.setId(?????); // <--- touchPoints.push_back(point); QTouchEvent te(QEvent::TouchEnd, nullptr, 0, Qt::TouchPointReleased, touchPoints); QApplication::sendEvent(window, &te); return true; } } } return false; } QWindow* window; };
My problem is that i have to assign the right id to the TouchPoint object, otherwise i cannot distinguish it from the other touch inputs i received in my application.
Any help would be appreciated.Dosfried