Wacom and Qt Quick 2



  • Hi,

    I want to retrieve events from a Wacom Bamboo and use them for Zoom, Pan and Rotate behavior in a Qt Quick 2 application.

    Looking at photosurface example, it seems they are doing something like:

    @ MouseArea
    {
    id: dragArea
    hoverEnabled: true
    anchors.fill: parent

        onWheel:
        {
          if (wheel.modifiers & Qt.ControlModifier)
          {
             ...
          }
          else
          {
             ...
          }
        }
      }@
    

    However, wheel event does not provide enough information to determine the gesture performed. And photosurface example does not work correctly with Wacom Bamboo. So, what is the correct way to integrate Wacom device with a Qt Quick 2 application?

    ADDITIONAL INFORMATION

    PAN

    !http://i.stack.imgur.com/D79FX.png!

    The events I get are (changing values are surrounded by "<< >>", specific values with respect to other gestures are surrounded by "== =="):

    @ wheel.buttons: 0
    wheel.modifiers: == 0 ==
    wheel.pixelDelta: QPoint(0, 0)
    wheel.angleDelta: QPoint(0, << 21 >>)
    wheel.x: 205
    wheel.y: 279@

    Here, only one value changed for both vertical and horizontal pan.

    ZOOM

    !http://i.stack.imgur.com/ZyL3A.png!

    The events I get are (changing values are surrounded by "<< >>", specific values with respect to other gestures are surrounded by "== =="):

    Here, the same value is changing. Note that zoom gesture is sent as a "Ctrl + mouse wheel" event

    @ wheel.buttons: 0
    wheel.modifiers: == 67108864 ==
    wheel.pixelDelta: QPoint(0, 0)
    wheel.angleDelta: QPoint(0, << 40 >>)
    wheel.x: 323
    wheel.y: 291@

    ROTATE
    I get the exact same values as for the ZOOM gesture...

    Thanks for any help and best regards.





  • I tried this with no success (no output):

    @import QtQuick 2.2

    Rectangle
    {
    width: 360
    height: 360
    PinchArea
    {
    id: pinchArea
    anchors.fill: parent
    enabled: true

    onPinchUpdated: console.log("PIIIIIIIIINCH")
    onPinchStarted: console.log("PIIIIIIIIINCH")
    onPinchFinished: console.log("PIIIIIIIIINCH")
    

    }
    }
    @



  • The wheel event is not useful here, that is for mouse wheels only.

    In theory PinchArea and MultiPointTouchArea should work with finger touch on the Bamboo, but there might be some platform specific glitches. Which platform are you on?



  • In the photosurface example, they are using the mouse wheel. I believe that Wacom converts touch events into mouse wheel events...

    I already tried using PinchArea (see my previous post) with no success.

    I just tried using MultiPointTouchArea with no success (no output):

    @import QtQuick 2.2

    Rectangle
    {
    width: 360
    height: 360

    MultiPointTouchArea
    {
    id: multiPointTouchArea
    anchors.fill: parent
    enabled: true

    onCanceled: console.log("PIIIIIIIIINCH")
    onGestureStarted: console.log("PIIIIIIIIINCH")
    onPressed: console.log("PIIIIIIIIINCH")
    onReleased: console.log("PIIIIIIIIINCH")
    onTouchUpdated: console.log("PIIIIIIIIINCH")
    onUpdated: console.log("PIIIIIIIIINCH")
    

    }
    }
    @

    I am using Windows 7 + Wacom Bamboo with Qt 5.2.1 for MSVC2012. I need to implement Zoom, Rotate and Pan in a Qt Quick 2 application. I could also, while not optimal, live with a solution using C++ Qt Widgets integrated into a Qt Quick 2 application;)

    I just tested the same QML script on a Mac Pro (Mac OSX 10.9) and still no success...;(

    Thanks for your help and best regards.



  • Hi,

    I am still looking for a solution. Even if it involves using the C++ Qt API instead of Qt Quick.

    Best regards.



  • You are right, the Bamboo sends mouse wheel events and control key events for zooming.

    The photosurface example works in fact with the Bamboo but not out of the box. If you check photosurface.qml, there's a MouseArea that handles the wheel events. The problems are that

    1. it rotates for ctrl+wheel which is somewhat unintuitive and does not play well with what the Bamboo and other apps are doing. (Ctrl+wheel should zoom instead)

    2. the angleDelta values are much higher for real mice

    Changing the code to something like
    @
    onWheel: {
    if (!(wheel.modifiers & Qt.ControlModifier)) {
    ...
    } else {
    photoFrame.rotation += wheel.angleDelta.x * 10 / 120;
    ...
    image.scale += image.scale * wheel.angleDelta.y * 10 / 120 / 10;
    ...
    }
    }
    @

    makes at least zoom working with the Bamboo.

    Pan should just work. Not sure about rotate however. That does not seem to send any wheel events.



  • Thanks for your help.

    The main problem is that ROTATE and ZOOM gestures are sent "the same way". So there is no way to differentiate them. For the pan, horizontal values are missing unfortunately.

    It seems that Wacom QML support is lacking somehow. Any idea if a pure C++ solution is working somewhere?

    UPDATE: after double check, it seems that nothing is sent for ROTATE indeed, you are right.
    Thanks and best regards.



  • Any update on this with the new Qt 5.3?


Log in to reply
 

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