PDA

View Full Version : Moving MouseArea.containsMouse



benberli
13th September 2016, 11:00
Hi,

So there is limitation in Qt documentation:

Warning: This property is not updated if the area moves under the mouse: containsMouse will not change. In addition, if hoverEnabled is false, containsMouse will only be valid when the mouse is pressed while the mouse cursor is inside the MouseArea.

Is there any way to work around this?
I have buttons with hover states and the buttons move at certain occasions. This results in the containsMouse being set to true but not set to false when the MouseArea of the buttons moves away from the mouse cursor.

I though about disabling the hoverEnable during movement but this didn't work for some reason.

Thanks,
Ben

anda_skoa
14th September 2016, 12:52
Hmm, difficult.

One thing one could try is to send an artifical mouse move event after the components moved, e.g. using QCoreApplication::sendEvent(), but the difficult part will be to find the correct coordinates to send.

Cheers,
_