Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. PinchArea do not work well in Qt 5.4
Forum Updated to NodeBB v4.3 + New Features

PinchArea do not work well in Qt 5.4

Scheduled Pinned Locked Moved Mobile and Embedded
5 Posts 2 Posters 1.6k Views 1 Watching
  • 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.
  • benlauB Offline
    benlauB Offline
    benlau
    Qt Champions 2016
    wrote on last edited by
    #1

    Hi all,

    I am using Flickable +PinchArea to provide pinching gesture for a photo . However, I found that the PinchArea do not work well in Qt 5.4. Here is an example code :

    @
    import QtQuick 2.4
    import QtQuick.Window 2.2

    Window {
    id : window
    visible: true

    Flickable {
        id : flickable
        anchors.fill: parent
        interactive: true
        contentWidth: container.width
        contentHeight: container.height
        flickableDirection: Flickable.HorizontalAndVerticalFlick
    
        PinchArea {
            pinch.target : container
            pinch.maximumScale: 8
            pinch.minimumScale: 0.5
    
            anchors.fill: parent
            onPinchStarted: {
                console.log("pinch started");
                flickable.interactive = false
            }
    
            onPinchFinished: {
                flickable.interactive = true;
            }
        }
    
    
        Item {
            id: container
    
            width: window.width
            height: window.height
            Rectangle {
                anchors.centerIn: parent
                width: window.width * 0.5
                height: window.height * 0.5
                color : "red"
            }
        }
    }
    

    }
    @

    It shows a red rectangle in the center and you may use two fingers to zoom in / out. In Qt 5.3.2 , the PinchArea is working fine.

    But in Qt 5.4, the pinch area's PinchStarted signal is triggered only if both of the fingers touch on the screen at the SAME time. It don't fulfill the common practise for pinching gesture.

    The code has been tested in Android and iOS.

    That is a bug or I should use another component for handling pinching gesture?

    Thanks for any advise.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Johan_R28
      wrote on last edited by
      #2

      Hi !

      Consider examples provide from Qtcreator :
      "PhotoSurface":http://doc.qt.io/qt-5/qtquick-demos-photosurface-example.html in this case

      It's a good way to resolve quickly your issue.

      Regards.

      1 Reply Last reply
      0
      • benlauB Offline
        benlauB Offline
        benlau
        Qt Champions 2016
        wrote on last edited by
        #3

        Hi Johan,

        Thank for your reply. However, the PhotoSurface code do not work with my case. Since I need to integrate Flickable and PinchArea together , but the PhotoSurface just show how PinchArea work.

        Since my example code is copied from another project , it is not pretty/simple enough to show the problem. I have reposted another version.

        As Qt 5.4.1 is launched already , I have tested but still has same problem.

        1 Reply Last reply
        0
        • benlauB Offline
          benlauB Offline
          benlau
          Qt Champions 2016
          wrote on last edited by
          #4

          The reason I need Flickable is because I would like to let user to drag the photo and it will continues to move slightly after released the finger and return to bound afterward.

          May be it is not the problem of PInchArea, but there has something wrong with Flickable that steal the mouse event from PinchArea

          1 Reply Last reply
          0
          • benlauB Offline
            benlauB Offline
            benlau
            Qt Champions 2016
            wrote on last edited by
            #5

            I have reported it as a bug already and it is marked as P2.

            [QTBUG-44645] Flickable and PinchArea are not working well together - Qt Bug Tracker
            https://bugreports.qt.io/browse/QTBUG-44645

            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