Details
-
Bug
-
Resolution: Done
-
P4: Low
-
5.2.0
-
None
-
089c3b15b9 (qt/qtdeclarative/dev) 089c3b15b9 (qt/tqtc-qtdeclarative/dev) d4021a8d62 (qt/tqtc-qtdeclarative/5.15) 11ce4362e7 (qt/qtdeclarative/6.3) 11ce4362e7 (qt/tqtc-qtdeclarative/6.3)
Description
Hi,
There's an issue with the clicked signal of a MouseArea when changing its visibility (or any other parent component) and listening for doubleClicked signal too.
Suppose that we have a chatroom list. When we click on a room we show its users and when we double-click we enter it, hiding the chatroom list and entering the selected chatroom. If we leave the room we go back to the chatroom list, making it visible again. If we now single-click one room its users won't show as expected because the onClicked signal won't be emitted.
Here's some simple code that shows the issue:
import QtQuick 2.0 Item { width: 360 height: 360 MouseArea { anchors.fill: parent onClicked: { console.log("clicked") } onDoubleClicked: { console.log("double-clicked") /* Uncomment this to reproduce visible = false visible = true */ } } }
If we double-click and then single-click the window, the log will show "clicked", "double-clicked" and "clicked". If we uncomment the lines at onDoubleClicked and do the same, the log will show "clicked" and "double-clicked", missing the last click. If we then wait a bit and click again, the clicked signal is emitted normally.
This happens most of the time, but not always. You may have to try it a couple of times to reproduce it. Note that it only seems to happen when listening for both clicked and doubleClicked events, if listening for just one of them it works fine.
Also if we use onPressed instead of onClicked the issue persists, but I haven't tried with other signals.
Attachments
Issue Links
- is duplicated by
-
QTBUG-102158 Click signal not emitted in MouseArea after DoubleClicked is emitted and tab changed
- Closed