Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How can I check a WheelEvent is from mouse wheel or touchpad in qml on Windows?
Forum Updated to NodeBB v4.3 + New Features

How can I check a WheelEvent is from mouse wheel or touchpad in qml on Windows?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 579 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.
  • I Offline
    I Offline
    isudfv
    wrote on last edited by
    #1

    I tried this var isTrackPad = wheel.pixelDelta !== Qt.point(0,0); as this says.

    But it seems pixelDelta works only on Mac. Is there other method to check if a wheel event is from mouse wheel or touchpad on Windows?

    onWheel: {
        var horizontal = false;
        var isTrackPad = wheel.pixelDelta !== Qt.point(0,0);
    
        if (Math.abs(wheel.angleDelta.x) > Math.abs(wheel.angleDelta.y)) {
            delta = wheel.angleDelta.x
            horizontal = true
        }
        else {
            delta = wheel.angleDelta.y
        }
        if ((isTrackPad && horizontal) || (!isTrackPad && wheel.modifiers === xxx.ScrollModifiersH)) {
            ...
        }
    }
    
    

    I also tried WheelHandler and WheelEvent.device as this. But I received only mouse device

    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