PinchArea



  • I am trying to use PinchArea (Qt Quick 1.1) : I have the following :

    @
    import QtQuick 1.1

    Rectangle {
    width: 300
    height: 200
    color:"blue"
    id :mainMT

    PinchArea {
        property int xpoint
        property int ypoint
        property int pinchscale
        property int pinchrotation
    
    
        id: pinchy
        enabled: true
        anchors.fill: parent
        pinch.dragAxis: Pinch.XandYAxis
        pinch.minimumScale: 0.01
        pinch.maximumScale: 20
        onPinchUpdated:
        {
            mainMT.x+=-mapToItem(mainMT.parent,pinch.previousCenter.x,pinch.previousCenter.y).x+mapToItem(mainMT.parent,pinch.center.x,pinch.center.y).x;
            mainMT.y+=-mapToItem(mainMT.parent,pinch.previousCenter.x,pinch.previousCenter.y).y+mapToItem(mainMT.parent,pinch.center.x,pinch.center.y).y;
            mainMT.scale-=pinch.previousScale-pinch.scale;
            mainMT.rotation+=pinch.previousAngle-pinch.angle;
         }
    }
    

    }

    @

    It works well except than it's difficult to move the item with two fingers : when you do that, there is rotation that comes with ...
    Is there a way to enable single touch to move item instead of double touch to distinct move object, and scale/rotation ?



  • A couple things you could try:

    • filtering the data in onPinchUpdated (e.g. only change the rotation when the difference in angle passes a certain threshold)
    • use a MouseArea for the single finger dragging (from memory MouseArea and PinchArea should work well together)

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.