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. QWindow's touchEvent not called
Forum Updated to NodeBB v4.3 + New Features

QWindow's touchEvent not called

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 866 Views 1 Watching
  • 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.
  • NethersN Offline
    NethersN Offline
    Nethers
    wrote on last edited by
    #1

    On a Mac with a track pad, my QWindow based app does not get it's touchEvent virtual function override called.
    In a similar QWidget based test app, I do get QTouchEvents.

    Is there something extra I need to do? The QTouchEvent documentation states that QWindow gets touch events automatically.

    1 Reply Last reply
    0
    • BhanuKiranChaluvadiB Offline
      BhanuKiranChaluvadiB Offline
      BhanuKiranChaluvadi
      wrote on last edited by
      #2

      Try this
      In constructor of the class - add this code

      setAttribute(Qt::WA_AcceptTouchEvents, TRUE) ;

      Joel BodenmannJ 1 Reply Last reply
      0
      • BhanuKiranChaluvadiB BhanuKiranChaluvadi

        Try this
        In constructor of the class - add this code

        setAttribute(Qt::WA_AcceptTouchEvents, TRUE) ;

        Joel BodenmannJ Offline
        Joel BodenmannJ Offline
        Joel Bodenmann
        wrote on last edited by
        #3

        As an addition to what @BhanuKiranChaluvadi mentioned: If the Qt::WA_AcceptTouchEvents property is disabled, the touch events are simply transformed into mouse events:

        Qt::WA_AcceptTouchEvents
        
        Allows touch events (see QTouchEvent) to be sent to the widget. Must be set on all widgets that can handle touch events. Without this attribute set, events from a touch device will be sent as mouse events.
        

        Industrial process automation software: https://simulton.com
        Embedded Graphics & GUI library: https://ugfx.io

        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