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. PinchArea zoom out
Qt 6.11 is out! See what's new in the release blog

PinchArea zoom out

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 962 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.
  • G Offline
    G Offline
    ginar
    wrote on last edited by
    #1

    Hi;
    I'm working on that example:
    http://docs.huihoo.com/qt/5.x/qtquick-touchinteraction-pincharea-flickresize-qml.html
    and wonder how to prevent pinch scale <1. I dont want to zoom- out I want to keep scale
    <1,4>. So I added

    PinchArea {
                    width: Math.max(flick.contentWidth, flick.width)
                    height: Math.max(flick.contentHeight, flick.height)
                    pinch.minimumScale : 1
                    pinch.maximumScale : 4
    

    But still can zoom-out <1.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      ginar
      wrote on last edited by
      #2

      I solve it shomehow.
      1085 - is my minaimal width(scale) of picture below which user cant zoom out

                      onPinchUpdated: {
                          isSaleAllowed = !(initialWidth * pinch.scale < 1085)
      
                          if( isSaleAllowed )
                          {
                              // adjust content pos due to drag
                              flick.contentX += pinch.previousCenter.x - pinch.center.x
                              flick.contentY += pinch.previousCenter.y - pinch.center.y
      
                              // resize content
                              flick.resizeContent(initialWidth * pinch.scale, initialHeight * pinch.scale, pinch.center)
                          }
                      }
      

      Documentation says:

      PinchArea can be used in two ways:
      setting a pinch.target to provide automatic interaction with an item
      using the onPinchStarted, onPinchUpdated and onPinchFinished handlers
      

      Probably

       pinch.minimumScale : 
       pinch.maximumScale :
      

      regards only to the first way.

      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