Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Wheel Event direction changing when pressing Alt key



  • 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.