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. QML PinchArea not working
Forum Updated to NodeBB v4.3 + New Features

QML PinchArea not working

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
pinchareaqml
2 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.
  • R Offline
    R Offline
    Rikudou_Sennin
    wrote on 19 Nov 2015, 11:23 last edited by p3c0
    #1

    Hello,

    I am trying to make an image zoomable via PinchArea and can't find a way to do it. I log the onPinchStarted and onPinchUpdated events, but they never fire.

    Here is image and pinch area (the source and visibility is set via timer):

    Image {
                id: mainimage
                visible: false
                source: ""
                fillMode: Image.PreserveAspectFit
                width: column.width;
                z: 10
                PinchArea {
                    id: imagepinch
                    width: mainimage.width
                    height: mainimage.height
                    pinch.target: mainimage
                    pinch.minimumScale: 1.0
                    pinch.maximumScale: 5.0
                    pinch.dragAxis: Pinch.XAndYAxis
                    anchors.fill: parent
                    z: 20
                    onPinchStarted: {
                        console.log("started");
                    }
                    onPinchUpdated: {
                        console.log(pinch);
                    }
                }
            }
    

    Here is the timer that sets the source:

    Timer {
                    id: checktimer
                    interval: 1000
                    running: true
                    repeat: true
                    onTriggered: {
                        if(jsondata) {
                            checktimer.running = false;
                            loadinglabel.visible = false;
                            json_o = JSON.parse(jsondata);
                            jsondata = "";
                            mainimage.source = json_o.src;
                            mainimage.visible = true;
                            imagepinch.height = mainimage.height;
                            var koef = mainimage.width / json_o.width;
                            var h = koef * json_o.height;
                            mainimage.height = h;
                            imagepinch.height = h;
                            console.log(imagepinch.x,imagepinch.y);
                        }
                    }
                }
    
    1 Reply Last reply
    0
    • D Offline
      D Offline
      drakebp
      wrote on 19 Nov 2015, 14:44 last edited by
      #2

      Try moving your pincharea outside of the image you are scaling. Either wrap the image inside the pincharea or keep them as siblings. I avoid putting things like pincharea and mouseareas inside things i am scaling as it can really mess with your x,y cordinates on click/select events as things scale.

      1 Reply Last reply
      0

      2/2

      19 Nov 2015, 14:44

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved