Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.7.0
-
None
-
Debian GNU/Linux, Qt 4.7.0 Tech-Preview
-
3b68034fc7690afc95aba8c049b94b1c6e0f4179
Description
When I set element visible to "false" and then set it to "true" - MouseArea is not refresh mouse position. See code below.
untitled.qml
import Qt 4.7 Item { width: 200; height: 200 Rectangle { // square id: rect x: 40; y: 40; width: 48; height: 48 color: ma.containsMouse ? "red" : "green" visible: false Text { text: "click!"; anchors.centerIn: parent } MouseArea { id: ma anchors.fill: parent hoverEnabled: true onClicked: rect.visible = false } } Rectangle { // button border.color: "black" x: 20; y: 100; width: 100; height: 24 color: gray Text { text: "click me!"; anchors.centerIn: parent } MouseArea { anchors.fill: parent onClicked: rect.visible = !rect.visible } } }
When running this code first press button, then press square. Again press button. Square still selected, however mouse is not positioned at square.
This makes many difficulties in work, when you need to create disappearing panels or elements. 'Cause next time it will be still selected when panel visible sets to "true".
My suggestion is to include mouse position check to visibleChanged event or make something like this to fix this inconvenience behaviour.