[Development] Nested Mousearea don't pass events

Antonio Aloisio antonio.aloisio at gmail.com
Mon May 20 15:08:08 CEST 2013


Hi Matteo,
IIRC the declarative engine creates objects in the order specified by the
QML file if you do not define any "z" attribute for the objects.
Hence, in your case, the second MouseArea covers the first one and eats
every click event.

If you want to propagate MouseEvents, I guess you have to explicitly
instruct the topmost area to ignore such events.

So it should not be a bug.

Ciao,
Antonio


On Mon, May 20, 2013 at 3:36 PM, Matteo Brichese <mbrichese at came.it> wrote:

> Hi everyone, I'm having some issue on passing the right event from a
> mousearea to another.
>
> This is a sample of my code:
>
> import QtQuick 2.0
>
> Rectangle {
>     width: 1024
>     height: 768
>
>     MouseArea {
>          anchors.fill: parent;
>          onClicked: console.log("Click")
>      }
>
>     MouseArea {
>         anchors.fill: parent;
>         onDoubleClicked: console.log("Double Click")
>     }
> }
>
> I can only see logs of the double click.
> I was hoping that if I single click the last mousearea the event passed to
> the second one, but it don't work, is that a bug?
>
> I'm using Qt5.0.2
>
> Regards
> ---
> Matteo Brichese
> Software Engineer
> mbrichese at came.it
> Came Cancelli Automatici S.p.A.
> www.came.com
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130520/b2425032/attachment.html>


More information about the Development mailing list