[Development] potential mouse delta problem in Qt5 Beta2 on Mac OS X?

VStevenP vstevenpavao at yahoo.com
Tue Nov 13 04:20:42 CET 2012


The following QML code is an example of a functional 2D knob in Qt5 Beta1.  It no longer works in Qt5 Beta2, using latest successful build from November 12.  I am on Mac OS 10.7.4 (Lion).

Perhaps something has changed and I need to recode this example knob; if so, please advise and possibly add some information in the upcoming Qt5 Beta2 release notes if needed.   Perhaps this a potential bug in Qt5 Beta2.


Additional info:

To move the knob, I use a 2-finger up-and-down- swipe on the trackpad, or I click-and-drag a mouse up-and-down on the knob.  This causes the knob to rotate clockwise/counterclockwise.  I tested this using qmlscene.)

Moving the knob result in some deprecated messages from qmlscene in Qt5 Beta1.  
2012-11-12 21:52:52.063 qmlscene[23502:b03] -_continuousScroll is deprecated for NSScrollWheel. Please use -hasPreciseScrollingDeltas.
2012-11-12 21:52:52.063 qmlscene[23502:b03] -deviceDeltaX is deprecated for NSScrollWheel. Please use -scrollingDeltaX.
2012-11-12 21:52:52.064 qmlscene[23502:b03] -deviceDeltaY is deprecated for NSScrollWheel. Please use -scrollingDeltaY.

In Qt5 Beta2, these messages no longer occur, and of course, the knob doesn't move either.  Maybe this is a clue to the problem?


Here is the source qml:

Knob.qml  (to test, you would need to provide your own 39x39 pixel knob image in a file named knob.png)
--------------

import QtQuick 2.0

Image {
    id: knob

    property real minimumvalue: 0
    property real maximumvalue: 99

    property real minimumrotation: 0
    property real maximumrotation: 305

    property real value: 0

    width: 39
    height: 39
    smooth: true

    Image {
        id: knobImage

        anchors.fill: parent
        source: "knob.png"
        rotation: knob.minimumrotation + knob.value / knob.maximumvalue *
              knob.maximumrotation
        smooth: true
    }

    MouseArea {
        property int previousY: 0

        anchors.fill: knobImage

        onPressed: previousY = mouse.y
        onPositionChanged: {
            var delta = (previousY - mouse.y) * 1.00

            if (knob.value + delta > knob.maximumvalue) {
                knob.value = knob.maximumvalue
            }
            else if (knob.value + delta < knob.minimumvalue) {
                knob.value = knob.minimumvalue
            }
            else {
                knob.value += delta
                previousY = mouse.y
            }
        }
    }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20121112/cb266400/attachment.html>


More information about the Development mailing list