[SOLVED]How to write onMinimunScaleCange event handler on PinchArea

  • in PinchArea property pinch.minimunScale.

    i want to run script when change the minmunScale.

    I know, properties has "on<property name>Changed" event handler.
    but, Cant written onMinimunScaleChanged.

    How write event handler of minimumScale property changed?

  • Hi dFrontia,

    bq. but, Cant written onMinimunScaleChanged.

    What do you mean ? You cannot write it in place, or you wrote it but it didn't worked ?

    If you cannot edit the component containing the PinchArea, then you can use a Connections object to handle the onMinimumScaleChanged. Have a look at the "QML Connections page":http://doc.qt.digia.com/4.7-snapshot/qml-connections.html

    That would look like
    Connections {
    target: pinchArea
    onMinimumScaleChanged {
    // Handle here

  • Thanks for replay.

    your replay has big hit!

    This has been resolved.

    correct code is....

    @ PinchArea{
    anchors.fill: parent

        //minimumScale are enclosed in "pinch" -refer to PinchArea.
        pinch.minimumScale: width/height
        onWidthChanged: {
            console.debug("It came! width")
        //How to write a successful
            target: panelBase.pinch
            onMinimumScaleChanged :{
                console.debug("It came onMinimunScaleChange!!")
        // I was challenged in the following description.
        // Cannot assign to non-existent propery
        //onMinimumScaleChanged :{
        //    consle.debug("It NOT came...")


  • I'm glad it solved your problem !

    But I'm also very intrigued it doesn't work in the first place. The "Connections" object do the exact same. In your sample you wrote "consle.debug", missing a "o". I guess in the real code you wrote it correctly ?

  • I had misspelled "console".
    But it does not matter.

    Following error when you perform a QML Viewer than that.

    @D:\Qt\4.8.4\bin\qmlviewer.exe D:/DEV/Demo/PinchAreaTest/PinchAreaTest.qml を起動中
    file:///D:/DEV/Demo/PinchAreaTest/PinchAreaTest.qml:28:9: Cannot assign to non-existent property "onMinimumScaleChanged"
    onMinimumScaleChanged :{

    If the error has not occurred, would have pointed out errors are displayed.

Log in to reply