← Back to team overview

multi-touch-dev team mailing list archive

Some notes on trying to write a qml utouch gesture plugin

 

I chatted with a qml developer here at the Qt Contributors Summit to try
to figure out some basic starting points for creating a qml plugin for
utouch. Here's what I've found:

First, we need to look into integrating geis into the Qt main event loop
when the plugin is loaded. This should be the same as any application
inserting extra stuff into the main event loop.

Next, we need to figure out how to do event propagation. We need to
start with the QWidget that represents the X window for the gesture
event. Then, we need to find each QDeclarativeView in the children trees
of the top level widget.

It isn't possible to have a QDeclarativeView be a parent of another
QDeclarativeView, so once we find a QDeclarativeView along a branch we
can stop looking down that branch's children.

>From QDeclarativeView, call the root object method to get the root of
the qml object tree. Qml objects may overlap each other, so you need to
determine the ordering. First, look at the z values of each object. For
objects with the same z value, earlier child objects in the children
array are above later child objects. Reference either QGraphicsView or
QGraphicsScene for example code.

Lastly, for qml acceptance/rejection of gesture events, look to
MouseArea to see how signals are accepted or rejected. In theory, we
create a signal for the gesture event, and then a property called
"accept". If accept evaluates to true (which could be through javascript
in the qml), then the event is accepted. The default should be to accept
gestures if unspecified.

-- Chase