Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

PinchArea inside a Flickable and returnToBounds()

$
0
0
Apologies if this has already been brought up, but my searches didn’t return anything. I’ve got an image viewer app in QML that has a PinchArea inside of a flickable (I think there’s a PinchFlickable example around here somewhere — that’s the one I’m using). I have it set up so the PinchArea zooms an image inside of the PinchArea, and onPinchFinished() does some calculations pertaining to the visible area. The problem is, I need to call returnToBounds() in onPinchFinished(), and returnToBounds() doesn’t seem to trigger the Flickable’s MovementFinished() signal — that, and onPinchFinished() is capturing the visible portion of the image before returnToBounds() is completed. A snippet of the code below shows the mechanics I’m working with: Flickable {     id: flick;     onMovementFinished: {         // Triggers when the image is panned.         // Calculate visible area & update C++ bindings.     }       PinchArea {         onPinchStarted: {             flick.interactive = false;         }         onPinchUpdated: {                 flick.contentX += pinch.previousCenter.x - pinch.center.x;                 flick.contentY += pinch.previousCenter.y - pinch.center.y;                   // resize content                 var scale = 1.0 + pinch.scale - pinch.previousScale;                 flick.resizeContent(flick.contentWidth * scale,                     flick.contentHeight * scale, pinch.center);         }         onPinchFinished: {             // Triggered when a pinch gesture is completed.             flick.returnToBounds();             flick.interactive = true;         }           Image { /* ... Stuff ... */ }     } } So how would I go about catching the visible portion of the image after the call to flick.returnToBounds() in pinch.onPinchFinished() is complete?

Viewing all articles
Browse latest Browse all 4972

Trending Articles