Qt捏放大,缩小(pinchArea)

问题描述 投票:0回答:1
enter code here
    PinchArea
    {
        MouseArea
        {
            id:dragArea
            hoverEnabled: true
            anchors.fill: parent
            drag.target: image
            scrollGestureEnabled: false
//            drag.maximumX: Screen.width
//            drag.maximumY: Screen.height

        }
        anchors.fill:image
        enabled: true
        pinch.target: image
        pinch.maximumScale: 4.0
        pinch.minimumScale: 1.0
        pinch.dragAxis: pinch.XAndYAxis
        pinch.maximumX: image.width
        pinch.maximumY: image.heighr
        onPinchStarted: {
            console.log("console ","pinchstarted")
        }

        onPinchUpdated: {

            console.log("console ","pinchUpdated")
        }
        onPinchFinished: {
            console.log("console ","pinchfinished")
        }
    }
}

我想在捏时将缩放比例增加或减少0.1。而且,当您获取日志时,会生成太多onPinchUpdated。我要在每次捏合时记录1步。

qt qml pinchzoom
1个回答
0
投票

您需要删除pinch.target: image,而是根据对onPinchStarted和onPinchUpdated处理程序中可访问的image值进行四舍五入来手动设置pinch.scale的比例。

© www.soinside.com 2019 - 2024. All rights reserved.