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 inside a Flickable and returnToBounds()
Forum Updated to NodeBB v4.3 + New Features

PinchArea inside a Flickable and returnToBounds()

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.0k 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.
  • A Offline
    A Offline
    arobicha
    wrote on last edited by
    #1

    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?

    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