[Development] Nested Mousearea don't pass events

Antonio Aloisio antonio.aloisio at gmail.com
Mon May 20 16:01:34 CEST 2013


IIRC every time you click a mouse area, click related mouse events are
generated in this order: pressed, released, (pressed + released) clicked,
(pressed + released + pressed) double click.
So I think what you get it's okay.

Anyway...  I don't understand what's the problem about defining two
handlers (clicked and DoubleClicked) for the same mouseArea.




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

> I'm making some more test and this sample:
>
> Rectangle {
>     width: 1024
>     height: 768
>     color: "blue"
>
>     MouseArea {
>          anchors.fill: parent;
>          onClicked: console.log("Click")
>          onDoubleClicked: console.log("Double Click")
>     }
> }
>
> Give me the following:
> On a single click => single click event
> On a double click => single click event + double click event
>
> Is that the expected behaviour? Why if I double-click my area a single
> click event is passed before the double one?
>
> Regards.
>
> ________________________________________
> Da: development-bounces+mbrichese=came.it at qt-project.org[development-bounces+mbrichese=
> came.it at qt-project.org] per conto di Matteo Brichese [mbrichese at came.it]
> Inviato: lunedì 20 maggio 2013 15.14
> Cc: development at qt-project.org
> Oggetto: Re: [Development] Nested Mousearea don't pass events
>
> I know that the last mousearea covert the first one, but I was hoping that
> the event will pass if I not handle it.
>
> However, even if I override the onPressed event on the last mousearea with
> a mouse.accepted = false it doesn't work.
>
> I need to handle the single click and the double click in two separate
> objects with the same clickable area.
>
> ---
> Matteo Brichese
> Software Engineer
> mbrichese at came.it
> [Came Cancelli Automatici S.p.A.]<http://www.came.com/>
> Il messaggio di posta elettronica contiene informazioni di carattere
> confidenziale specifiche per il destinatario. Nel caso non ne siate il
> destinatario, segnalatelo immediatamente al mittente ed eliminate dai
> vostri archivi quanto ricevuto (compresi i file allegati). L'uso, la
> diffusione, distribuzione o riproduzione del presente messaggio e dei suoi
> allegati da parte di ogni altra persona costituisce reato. Rif. Decreto
> legislativo 30 giugno 2003, n. 196 - Codice in materia di protezione dei
> dati personali.
>
> The email message contains confidential information specific to the
> recipient. If you are not the recipient, write it to the sender immediately
> and delete from your files as received (including file attachments). Use,
> dissemination, distribution or reproduction of this message and its
> attachments by any other person is a criminal offense. References
> Legislative Decree 30 June 2003, n. 196 - Code for the protection of
> personal data.
>
> Right to opposition:
> The person concerned who receives the message has the right at any time to
> oppose its processing for forwarding commercial messages, advertising
> material or direct sales proposals, by clicking on the e-mail address below
> (or by traditional postal services by writing to: Came Cancelli Automatici
> Spa, Via Martiri della Libertà 15, 31030 Dosson di Casier (TV) - Italy, or
> by sending a fax to +39 0422 4941. Furthermore the person concerned may
> exercise all the rights of access to the personal data as provided by art.
> 7, Legislative Decree no. 196/2003, including the rights to amendment,
> updating and deletion, by sending an e-mail to privacy at came.com<mailto:
> privacy at came.com>.
>
> ________________________________
> Da: Antonio Aloisio [antonio.aloisio at gmail.com]
> Inviato: lunedì 20 maggio 2013 15.08
> A: Matteo Brichese
> Cc: development at qt-project.org
> Oggetto: Re: [Development] Nested Mousearea don't pass events
>
> 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
> <mailto: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<mailto:mbrichese at came.it>
> Came Cancelli Automatici S.p.A.
> www.came.com<http://www.came.com>
> _______________________________________________
> Development mailing list
> Development at qt-project.org<mailto:Development at qt-project.org>
> http://lists.qt-project.org/mailman/listinfo/development
>
> _______________________________________________
> 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/4386b408/attachment.html>


More information about the Development mailing list