Hi,

I'm debugging a major issue with QtQuick1 I'm seeing with both 5.0.0 and the 
current stable branch: Touch events don't work with QtQuick1's MouseArea 
element.

As QtQuick1 items don't handle touch directly, they they rely on on the 
touch->mouse fallback in QApplication which creates mouse events if a touch 
event wasn't accepted.
That works or TouchBegin events, but fails for subsequent TouchMove and 
TouchEnd events as QGraphicsView silently accepts touch events if it doesn't 
find an item that waits for touch.

If a series of TouchBegin, TouchMove, TouchEnd events is sent to QGraphicsView 
containing QQ1 items, the following happens:

1) GraphicsScenePrivate::touchEventHandler receives a TouchBegin event. As the 
QQ1 items don't accept touch, the event is ignored. That triggers the 
touch-mouse fallback, which works fine.
2) GraphicsScenePrivate::touchEventHandler then receives TouchMove/TouchEnd 
events. The touch handler looks for items needing touch events (items which 
previously accepted a TouchBegin event), but doesn't find any. (because the QQ1 
items received the fallback mouse events, not the touchBegin event)
In that case, it just accepts the touchMove/touchEnd event. As the event is 
accepted, the touch->mouse fallback in QApplication isn't triggered.

I see two ways to fix it, one is a one-liner, one's more work:

 * Don't silently accept touch events if no item is waiting for them. Ignoring 
the events triggers the touch->mouse fallback. That's the approach the attached 
patch takes and seems to work fine (tested with the QQ1 hello world example).
 * Make QQ1 items accept touch events and do the touch to mouse mapping 
internally

Do you see issues with the first approach? I don't see why TouchMove and 
TouchEnd should be accepted if not handled, but TouchBegin is ignored if not 
handled.

Attachment: touch-qquick1-graphicsview.diff
Description: Binary data



-- 
Frank Osterfeld | [email protected] | Senior Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel. Germany +49-30-521325470, Sweden (HQ)  +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to