[Qt-qml] Mouse Event Filtering in QML 2

aaron.kennedy at nokia.com aaron.kennedy at nokia.com
Fri Jun 10 02:28:03 CEST 2011


Hi,

On 10/06/2011, at 10:02 AM, ext michael.brasser at nokia.com wrote:

> 
> On 07/06/2011, at 10:51 AM, ext Alan Alpert wrote:
> 
>> On Tue, 7 Jun 2011 01:23:51 Cunha Leo (Nokia-MP-Qt/Oslo) wrote:
>>> hi,
>>> 
>>> in qml1 I used to have an empty MouseArea{ enabled: animation.running } to
>>> filter events while an animation was ongoing.
>>> 
>>> in qml2 this empty mouse area is no longer accepting the events by default,
>>> so the only way I found was to declare empty handlers for all mouse
>>> events.
>>> 
>>> is there a better way to achieve mouse events filtering in qml2 ?
>>> 
>>> cheers,
>>> // leo
>> 
>> Currently you do need to declare empty handlers, due to changes in mouse event 
>> propagation, but this is clearly not ideal. I don't think the empty mouse area 
>> was that great either though. Do you have any suggestions on the best way to 
>> accomplish this?
> 
> 
> What about a convenience MouseBlocker element? e.g. something like:
> 
> //MouseBlocker.qml
> import QtQuick 2.0
> MouseArea {
>    onPressed: {}
>    onClicked: {}
>    onPressAndHold: {}
>    onDoubleClicked: {}
> }

Has anyone investigated exactly why this has changed?  As far as I know it wasn't intentional, so we should probably figure it out and decide which behavior we want before we go developing work arounds :)

Cheers,

Aaron


More information about the Qt-qml mailing list