[Interest] QML MouseArea containsMouse is set to true even if it's not actually

Jérôme Godbout godboutj at amotus.ca
Mon Feb 15 18:41:01 CET 2021

Check if you can tweak the following property on your mouse area. https://doc.qt.io/qt-5/qml-qtquick-mousearea.html#preventStealing-prop

·         preventStealing<https://doc.qt.io/qt-5/qml-qtquick-mousearea.html#preventStealing-prop> : bool

·         propagateComposedEvents<https://doc.qt.io/qt-5/qml-qtquick-mousearea.html#propagateComposedEvents-prop>
You could also handle the mouse event of the mouse area and put the accepted to false to avoid eating the event: https://doc.qt.io/qt-5/qml-qtquick-mouseevent.html#accepted-prop

Hope that help you find the proper behaviour are after.

Jérôme Godbout
Software / Firmware Lead

C: (581) 777-0050
O: (418) 800-1073 ext.: 109
godbotuj at amotus.ca<mailto:godbotuj at amotus.ca>
[cid:image001.png at 01D70397.D06C4320]
dimonoff.com<https://www.dimonoff.com/>   |    amotus.ca<https://www.amotus-solutions.com/>

From: Interest <interest-bounces at qt-project.org> On Behalf Of Alexander Dyagilev
Sent: February 15, 2021 12:14 PM
To: interest at qt-project.org
Subject: [Interest] QML MouseArea containsMouse is set to true even if it's not actually


In our code we have one MouseArea which fills entire parent:
MouseArea {

    id: mouseAreaRow

    hoverEnabled: true

    anchors.fill: parent

    propagateComposedEvents: true

    onPressed: { mouse.accepted = false }


And we have another MouseArea which fills a small part of the same area which the first MouseArea fills:

MouseArea {

    id: mouseAreaUp

    hoverEnabled: true

    anchors.fill: parent

    cursorShape: Qt.PointingHandCursor


The problem is that sometimes mouseAreaUp.containsMouse continues to be set to true even after the mouse left its area. Most of the time it happens when the mouse pointer is moved very fast.

Is this a known issue or maybe some misunderstanding on our side?

Is there any workaround? Is it possible to at least force MouseArea to recheck if it really contains the mouse pointer?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210215/db53be19/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 7814 bytes
Desc: image001.png
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210215/db53be19/attachment.png>

More information about the Interest mailing list