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. [Problem]QML PinchArea can't receive touch event
Forum Updated to NodeBB v4.3 + New Features

[Problem]QML PinchArea can't receive touch event

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 2.3k 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
    rstalin
    wrote on last edited by
    #1

    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 }
            }
    
    
    
    
    
     }
    

    }@

    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