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. Wheel Event direction changing when pressing Alt key
QtWS25 Last Chance

Wheel Event direction changing when pressing Alt key

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmlmousescrollmouse eventmousearea
1 Posts 1 Posters 640 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.
  • B Offline
    B Offline
    brai
    wrote on last edited by
    #1

    When I use the onWheel event in a MouseArea, I get the wheel.angleDelta.y to represent my scrolling delta as expected.

    When I press the alt key while scrolling, it will change the direction of the scroll from vertical to horizontal.

    I.E. when the alt key is pressed, the wheel.angleDelta.x value is non-zero, and the y value is zero.

    Here is the mouse area code:

    MouseArea {
        id: translateArea
        anchors.fill: parent
        cursorShape: Qt.SizeAllCursor
        acceptedButtons: Qt.LeftButton
    
        onWheel: {
            console.log(wheel.angleDelta) // Using this to debug for now
        }
    
        drag: {
            target: image // Mouse Area is in an image
            axis: Drag.XAndYAxis
            maximumX: image.paintedWidth
            maximumY: image.paintedHeight
            smoothed: true
            onActiveChanged: {
                 if(!translateArea.drag.active) {
                     imgTranslateX += image.x
                     imgTranslateY += image.y
                     image.x = 0
                     image.y = 0
                 }
            }
        }
    }
    

    I added the drag code, just in case there is an effect here that I am unaware of, but the documentation doesn't mention anything about conflicts.

    I can work around this (when alt key is pressed, look for x value instead ...) but this just doesn't seem correct?

    I am running Qt 5.15.0, QtQuick 2.15, and am running the application on Windows 10, MSVC 2019 64bit.

    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