[Problem]QML PinchArea can't receive touch event



  • HI All!

    I try pincharea in my project, but it's seem can't receive the event.
    I write console.log in pincharea but show nothing.
    The same code I try in another new project that can work.
    There are something let pincharea can't receive touch event.
    what could cause this happen?@@

    @import QtQuick 1.1

    Item {
    width: 100
    height: 62

         Flickable
         {
             id:flickable
             width: 360; height: 520
             
             contentWidth: Math.max(flickable.width,pix.width)
             contentHeight: Math.max(flickable.height,pix.height)
    
            Image
            {
              id:pix
              cache: false
              source: "images/22.png"
    
            }
    
    
            PinchArea {
                    id: pincharea
    
                    property double __oldZoom
                    anchors.fill: parent
                    pinch.target:pix
    
                    function calcZoomDelta(zoom, percent)
                    {
                        return zoom + Math.log(percent)/Math.log(2)
                    }
                    onPinchStarted: {
                        __oldZoom = pinch.scale
                        console.log(pinch.scale)
                    }
                    onPinchUpdated: {
                        pix.height = pix.height*calcZoomDelta(__oldZoom, pinch.scale)
                       pix.width = pix.width*calcZoomDelta(__oldZoom, pinch.scale)
                        console.log(pinch.scale)
                    }
                    onPinchFinished: {
                        pix.height = pix.height*calcZoomDelta(__oldZoom, pinch.scale)
                        pix.width = pix.width*calcZoomDelta(__oldZoom, pinch.scale)
                        console.log(pinch.scale)
                    }
                }
    
            State
            { name: 'loaded'; when: pix.status = Image.Ready
               PropertyChanges { target: pincharea; pinch.active:true }
            }
    
    
    
    
    
     }
    

    }@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.