Important: Please read the Qt Code of Conduct -

PinchArea inside a Flickable and returnToBounds()

  • 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 -;
                flick.contentY += pinch.previousCenter.y -;
                // resize content
                var scale = 1.0 + pinch.scale - pinch.previousScale;
                flick.resizeContent(flick.contentWidth * scale, 
                    flick.contentHeight * scale,;
        onPinchFinished: { 
            // Triggered when a pinch gesture is completed.
            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?

Log in to reply