In MouseArea.onEntered, detect if the cause is only that the *MouseArea* moved and came to be under the cursor
Unsolved
QML and Qt Quick
-
In MouseArea.onEntered, can I detect if the cause for the event firing is only that the MouseArea moved and came to be under the cursor, rather than the other way round?
I thought of doing something like this: (pseudocode)
MouseArea { // ... property bool positionDirty = false Connections { target: window onAfterRendering: { positionDirty = false; } } onMouseAreaPosChanged: { positionDirty = true; } onEntered: { if(positionDirty) { positionDirty = false; return; } // handle event here } }
But this makes the assumption that
entered
will be fired aftermouseAreaPosChanged
, and beforewindow.afterRendering
. And I'm not confident in that assumption.Also, it doesn't work when an ancestor of the MouseArea moves, or when the MouseArea is positioned/sized via anchoring.