[Qt-qml] QML overlaid QGraphicsView with QTouchEvents enabled

Tarantism tarantism at ntlworld.com
Sun Dec 11 14:50:58 CET 2011


I have a QGraphicsView main scene with a QML layer over the top for
buttons, menus etc.

This all worked fine when I used mousePressEvents to control the main
scene but I've got problems now that I've enabled QTouchEvents for the
main scene.

The QML layer doesn't intercept the touch events so they arrive at the
main scene. This is clearly a problem if a menu overlays the entire
screen. The menu still works fine but unwanted touch events arrive at
the scene below.

I can think of a couple options to fix the problem:
1. Use logic to disable event processing when the scene is obscured but
that seems a bit ugly
2. Write a custom TouchShield qml component that would acceptTouchEvents
and fill each qml control with one of those

Is there a "right" way of doing it?







More information about the Qt-qml mailing list