diff options
Diffstat (limited to 'share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml')
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml index 0d9641fa72..10de1f224c 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/IconGizmo.qml @@ -42,12 +42,17 @@ Item { } return false; } + property bool hasMouse: false property alias iconSource: iconImage.source - signal positionCommit() signal clicked(Node node, bool multi) + onSelectedChanged: { + if (selected) + hasMouse = false; + } + visible: activeScene === scene && (targetNode ? targetNode.visible : false) Overlay2D { @@ -58,14 +63,14 @@ Item { Rectangle { id: iconRect + width: iconImage.width height: iconImage.height x: -width / 2 y: -height / 2 color: "transparent" border.color: "#7777ff" - border.width: !iconGizmo.selected - && iconGizmo.highlightOnHover && iconMouseArea.containsMouse ? 2 : 0 + border.width: iconGizmo.highlightOnHover && iconGizmo.hasMouse ? 2 : 0 radius: 5 opacity: iconGizmo.selected ? 0.2 : 1 Image { @@ -87,6 +92,24 @@ Item { mouse.modifiers & Qt.ControlModifier) hoverEnabled: iconGizmo.highlightOnHover && !iconGizmo.selected acceptedButtons: Qt.LeftButton + + // onPositionChanged, onContainsMouseAreaChanged, and hasMouse are used instead + // of just using containsMouse directly, because containsMouse + // cannot be relied upon to update correctly in some situations. + // This is likely because the overlapping 3D mouse areas of the gizmos get + // the mouse events instead of this area, so mouse leaving the area + // doesn't always update containsMouse property. + onPositionChanged: { + if (!iconGizmo.selected) + iconGizmo.hasMouse = containsMouse; + } + + onContainsMouseChanged: { + if (!iconGizmo.selected) + iconGizmo.hasMouse = containsMouse; + else + iconGizmo.hasMouse = false; + } } } } |