Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Missing TouchEvent
Forum Update on Monday, May 27th 2025

Missing TouchEvent

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 333 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dosfried
    wrote on last edited by
    #1

    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.

    Bugreport

    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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved