Re: [Qt-qml] How to ignore MouseArea signals
Hello, Is there a reason why accepted isn't handled in the other mouse events? Cheers, Jerome P. From: qt-qml-boun...@trolltech.com [qt-qml-boun...@trolltech.com] On Behalf Of ext Halton Huo [halton@intel.com] Sent: Wednesday, December 08, 2010 4:40 AM To: Jones Martin (Nokia-MS-Qt/Brisbane) Cc: qt-qml@trolltech.com Subject: Re: [Qt-qml] How to ignore MouseArea signals Thanks, http://bugreports.qt.nokia.com/browse/QTBUG-15929 is filed. On Wed, 2010-12-08 at 10:41 +0800, martin.jo...@nokia.com wrote: Log a bug. It would be good if you could suggest where the docs are lacking - i.e. where you started looking when this didn't work as expected. The accepted behavior is documented in the MouseArea signal documentation. BR, Martin. -Original Message- From: ext Halton Huo [mailto:halton@intel.com] Sent: Wednesday, 8 December 2010 11:56 AM To: Jones Martin (Nokia-MS-Qt/Brisbane) Cc: adriano.reze...@openbossa.org; qt-qml@trolltech.com Subject: RE: [Qt-qml] How to ignore MouseArea signals Woo, OnPressed works, thanks very much. The document need to be improved. Any process to do that? Cheers, Halton. On Wed, 2010-12-08 at 09:46 +0800, martin.jo...@nokia.com wrote: You need to accept in onPressed. accepted is ignored for any other event. BR, Martin. -Original Message- From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On Behalf Of ext Halton Huo Sent: Wednesday, 8 December 2010 11:42 AM To: Adriano Rezende Cc: qt-qml@trolltech.com Subject: Re: [Qt-qml] How to ignore MouseArea signals enabled does not match my case. I need receive the MouseArea signals but as well as those below the top item can receive the signals also. Refer to MouseEvent element document, seems accepted can do that. - accepted : bool Setting accepted to true prevents the mouse event from being propagated to items below this item. Generally, if the item acts on the mouse event then it should be accepted so that items lower in the stacking order do not also respond to the same event. But following code does not work as I wish MouseArea { anchors.fill: parent onClicked: { console.log(mouse.accepted=+mouse.accepted) mouse.accepted = false console.log(mouse.accepted=+mouse.accepted) } } Thanks, Halton. On Wed, 2010-12-08 at 02:55 +0800, Adriano Rezende wrote: On Tue, Dec 7, 2010 at 4:31 AM, Halton Huo halton@intel.com wrote: So my questions how to ignore the received signals to let other items to continue deal with those signals? You can set enabled property to false or ignore the event on mouse press. MouseArea { anchors.fill: parent onClicked: console.log(background clicked); } MouseArea { anchors.fill: parent enabled: false //onPressed: mouse.accepted = false; onClicked: console.log(foreground clicked); } Br, Adriano ___ Qt-qml mailing list Qt-qml@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-qml ___ Qt-qml mailing list Qt-qml@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-qml ___ Qt-qml mailing list Qt-qml@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-qml
Re: [Qt-qml] How to ignore MouseArea signals
On Thu, Dec 9, 2010 at 10:36 AM, jerome.pas...@nokia.com wrote: Hello, Is there a reason why accepted isn't handled in the other mouse events? I believe the reason is that after accepting mouse press event that item becomes the mouse grabber and mouse move/released events will be delivered directly to it. The grabber condition can be removed calling ungrabMouse() manually. Br, Adriano ___ Qt-qml mailing list Qt-qml@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-qml
Re: [Qt-qml] How to ignore MouseArea signals
This behavior is inherited from QGraphicsView. I don't know why it is this way. Perhaps the QGraphicsView documentation has some hints. BR, Martin. -Original Message- From: ext Adriano Rezende [mailto:adriano.reze...@openbossa.org] Sent: Friday, 10 December 2010 12:02 AM To: Pasion Jerome (Nokia-MS-Qt/Oslo) Cc: halton@intel.com; Jones Martin (Nokia-MS-Qt/Brisbane); qt- q...@trolltech.com Subject: Re: [Qt-qml] How to ignore MouseArea signals On Thu, Dec 9, 2010 at 10:36 AM, jerome.pas...@nokia.com wrote: Hello, Is there a reason why accepted isn't handled in the other mouse events? I believe the reason is that after accepting mouse press event that item becomes the mouse grabber and mouse move/released events will be delivered directly to it. The grabber condition can be removed calling ungrabMouse() manually. Br, Adriano ___ Qt-qml mailing list Qt-qml@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-qml
Re: [Qt-qml] How to ignore MouseArea signals
enabled does not match my case. I need receive the MouseArea signals but as well as those below the top item can receive the signals also. Refer to MouseEvent element document, seems accepted can do that. - accepted : bool Setting accepted to true prevents the mouse event from being propagated to items below this item. Generally, if the item acts on the mouse event then it should be accepted so that items lower in the stacking order do not also respond to the same event. But following code does not work as I wish MouseArea { anchors.fill: parent onClicked: { console.log(mouse.accepted=+mouse.accepted) mouse.accepted = false console.log(mouse.accepted=+mouse.accepted) } } Thanks, Halton. On Wed, 2010-12-08 at 02:55 +0800, Adriano Rezende wrote: On Tue, Dec 7, 2010 at 4:31 AM, Halton Huo halton@intel.com wrote: So my questions how to ignore the received signals to let other items to continue deal with those signals? You can set enabled property to false or ignore the event on mouse press. MouseArea { anchors.fill: parent onClicked: console.log(background clicked); } MouseArea { anchors.fill: parent enabled: false //onPressed: mouse.accepted = false; onClicked: console.log(foreground clicked); } Br, Adriano ___ Qt-qml mailing list Qt-qml@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-qml
Re: [Qt-qml] How to ignore MouseArea signals
Log a bug. It would be good if you could suggest where the docs are lacking - i.e. where you started looking when this didn't work as expected. The accepted behavior is documented in the MouseArea signal documentation. BR, Martin. -Original Message- From: ext Halton Huo [mailto:halton@intel.com] Sent: Wednesday, 8 December 2010 11:56 AM To: Jones Martin (Nokia-MS-Qt/Brisbane) Cc: adriano.reze...@openbossa.org; qt-qml@trolltech.com Subject: RE: [Qt-qml] How to ignore MouseArea signals Woo, OnPressed works, thanks very much. The document need to be improved. Any process to do that? Cheers, Halton. On Wed, 2010-12-08 at 09:46 +0800, martin.jo...@nokia.com wrote: You need to accept in onPressed. accepted is ignored for any other event. BR, Martin. -Original Message- From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On Behalf Of ext Halton Huo Sent: Wednesday, 8 December 2010 11:42 AM To: Adriano Rezende Cc: qt-qml@trolltech.com Subject: Re: [Qt-qml] How to ignore MouseArea signals enabled does not match my case. I need receive the MouseArea signals but as well as those below the top item can receive the signals also. Refer to MouseEvent element document, seems accepted can do that. - accepted : bool Setting accepted to true prevents the mouse event from being propagated to items below this item. Generally, if the item acts on the mouse event then it should be accepted so that items lower in the stacking order do not also respond to the same event. But following code does not work as I wish MouseArea { anchors.fill: parent onClicked: { console.log(mouse.accepted=+mouse.accepted) mouse.accepted = false console.log(mouse.accepted=+mouse.accepted) } } Thanks, Halton. On Wed, 2010-12-08 at 02:55 +0800, Adriano Rezende wrote: On Tue, Dec 7, 2010 at 4:31 AM, Halton Huo halton@intel.com wrote: So my questions how to ignore the received signals to let other items to continue deal with those signals? You can set enabled property to false or ignore the event on mouse press. MouseArea { anchors.fill: parent onClicked: console.log(background clicked); } MouseArea { anchors.fill: parent enabled: false //onPressed: mouse.accepted = false; onClicked: console.log(foreground clicked); } Br, Adriano ___ Qt-qml mailing list Qt-qml@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-qml ___ Qt-qml mailing list Qt-qml@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-qml