Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED]How to write onMinimunScaleCange event handler on PinchArea
QtWS25 Last Chance

[SOLVED]How to write onMinimunScaleCange event handler on PinchArea

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 1.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dFrontia
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Adrien Leravat
      wrote on last edited by
      #2

      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
      }
      }
      @

      Adeneo Embedded - www.adeneo-embedded.com

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dFrontia
        wrote on last edited by
        #3

        Thanks for replay.

        your replay has big hit!

        This has been resolved.

        correct code is....

        @ PinchArea{
        id:panelBase
        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
            Connections{
                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...")
            //}
        
        }
        

        @

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Adrien Leravat
          wrote on last edited by
          #4

          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 ?

          Adeneo Embedded - www.adeneo-embedded.com

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dFrontia
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved