Skip to content

Commit

Permalink
[GraphEditor] AttributePin: Handle width and elide for attributes' name
Browse files Browse the repository at this point in the history
  • Loading branch information
cbentejac committed Dec 31, 2024
1 parent 3234bb9 commit 6aae86c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions meshroom/ui/qml/GraphEditor/AttributePin.qml
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,18 @@ RowLayout {
MaterialToolLabel {
id: nameLabel

property bool hovered: (inputConnectMA.hoverEnabled || outputConnectMA.hoverEnabled) &&
(inputConnectMA.containsMouse || inputConnectMA.drag.active ||
inputDropArea.containsDrag || outputConnectMA.containsMouse ||
outputConnectMA.drag.active || outputDropArea.containsDrag)

width: hovered ? icon.width + label.contentWidth : parent.width
anchors.rightMargin: 0
anchors.right: root.attribute && root.attribute.isOutput ? parent.right : undefined
labelIconRow.layoutDirection: root.attribute.isOutput ? Qt.RightToLeft : Qt.LeftToRight
anchors.right: root.attribute && root.attribute.isOutput ? parent.right : undefined
labelIconRow.spacing: 0

enabled: !root.readOnly
visible: true
property bool hovered: (inputConnectMA.containsMouse || inputConnectMA.drag.active ||
inputDropArea.containsDrag || outputConnectMA.containsMouse ||
outputConnectMA.drag.active || outputDropArea.containsDrag)

labelIconColor: {
if ((root.attribute.hasOutputConnections || root.attribute.isLink) && !root.attribute.enabled) {
Expand All @@ -259,6 +261,7 @@ RowLayout {
// Text
label.text: root.attribute.label
label.font.pointSize: 7
labelWidth: hovered ? label.contentWidth : nameLabel.width - icon.width
label.elide: hovered ? Text.ElideNone : Text.ElideMiddle
label.horizontalAlignment: root.attribute && root.attribute.isOutput ? Text.AlignRight : Text.AlignLeft

Expand Down

0 comments on commit 6aae86c

Please sign in to comment.