May 1, 2012

aabc aabc
Robot Herder
257 posts

Why does QtQuick does not have TouchArea (like MouseArea) ?

Page  
1

Why does QtQuick does not have TouchArea (like MouseArea) ?
Isn’t QtQuick designed for tablets and smartphones ?

17 replies

May 1, 2012

sierdzio sierdzio
Area 51 Engineer
2333 posts

It is. They just work. One-finger gestures are recognised as mouse events. If you want 2-finger operation, you can take a look at PinchArea [qt-project.org].

 Signature 

(Z(:^

May 1, 2012

aabc aabc
Robot Herder
257 posts

The problem is that the touch on QML works much worse than the touch in QWidgets with Qt::WA_AcceptTouchEvents.
Is there a way to make QML touch works like QWidget ?

May 1, 2012

sierdzio sierdzio
Area 51 Engineer
2333 posts

In what way worse? It’s not easy to help you when you don’t specify what is wrong ;)

I have tested on Android, and touch in QML works (for me) perfectly. 2-finger gestures, tapping, flicking, long-tap: no complaints from me :)

 Signature 

(Z(:^

May 1, 2012

aabc aabc
Robot Herder
257 posts

On embedded linux device with touch – when I try QML application – the touch works much worse than QWidget with touch works on the same device.
Did you try QML application on embeddedc linux device ?

May 1, 2012

sierdzio sierdzio
Area 51 Engineer
2333 posts

No, only desktop and Android. Which in a way is an embedded linux device, but I’m sure that is not what you mean :)

 Signature 

(Z(:^

May 1, 2012

aabc aabc
Robot Herder
257 posts

Can you show me a code sample of touch (mouse) interaction you have in QML ?

May 1, 2012

sierdzio sierdzio
Area 51 Engineer
2333 posts

Here is a whole, big project I’m working on: LINK [gitorious.org].

And some relevant pieces of code:

  1. Flickable {
  2.         id: gameArea
  3.         height: someHeight
  4.         contentWidth: map.width
  5.         contentHeight: map.height
  6.         boundsBehavior: Flickable.StopAtBounds
  7.         clip: true
  8.  
  9.         anchors.top: root.top
  10.         anchors.left: root.left
  11.         anchors.right: root.right
  12.  
  13.         PinchArea {
  14.             id: pinchArea
  15.             anchors.fill: parent
  16.  
  17.             onPinchUpdated: {
  18.                 zoom += pinch.scale - pinch.previousScale;
  19.             }
  20.         }
  21. }

Flickable element makes it possible to swype (move the map around), PinchArea is used for zooming. Tapping and long tapping is handled by MouseArea, just like on desktop. In case of my app, the code is quite complicated at that stage, but in principle, it’s just as easy on desktop, as on mobile devices.

 Signature 

(Z(:^

May 1, 2012

aabc aabc
Robot Herder
257 posts

Thanks.
Did you try List dragging and buttons ?

May 1, 2012

sierdzio sierdzio
Area 51 Engineer
2333 posts

Yes. I use GridView for that, it inherits Flickable, so that solves dragging problem. As items for it, I use just rectangles with MouseAreas inside them (one MouseArea per every button).

There were some bugs there, now I think about it, but I think it had more to do with my (at that time) sloppy coding.

 Signature 

(Z(:^

May 1, 2012

aabc aabc
Robot Herder
257 posts

On what HW did you test it (CPU’s, RAM, clock speed, openGL) ?

May 1, 2012

sierdzio sierdzio
Area 51 Engineer
2333 posts

Samsung Galaxy S2 (dualcore ARM 1.2GHz, 1GB RAM), both on Android 2.3 and 4.0.4 (CyanogenMod). I don’t remember if OpenGL support was available at that time (half a year ago).

Currently I have ported my project to Qt5, which is not yet available on droid, so I don’t have up-to-date news.

 Signature 

(Z(:^

May 1, 2012

aabc aabc
Robot Herder
257 posts

Does QT 5 improved your QML apps performance ?

May 1, 2012

sierdzio sierdzio
Area 51 Engineer
2333 posts

Performance was good anyway, so I’ve seen no dramatic improvement because there was nothing to improve on ;) I did not run any benchmarks, though.

Nokia did some tests 1,5 years ago and it was, IIRC, about 200% faster. A lot has been done since then, so it might be even faster now (or not).

I did the move because I wanted to test some new features early (new particle system, ‘var’ properties, V8 engine, etc.). The project I am working on is an after-work hobby anyway, so I can do that easily :)

 Signature 

(Z(:^

May 1, 2012

aabc aabc
Robot Herder
257 posts

Was the touch performance were better with pen (stylus) than with finger touch ?

May 1, 2012

sierdzio sierdzio
Area 51 Engineer
2333 posts

I’ve used my fingers only, no stylus.

 Signature 

(Z(:^

Page  
1

  ‹‹ Can I dynamically add a MapGroup to a Map?      How to programming, like a card shuffle. ››

You must log in to post a reply. Not a member yet? Register here!