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 Jan 10, 2025
1 parent 3234bb9 commit 5fdfa51
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions meshroom/ui/qml/GraphEditor/AttributePin.qml
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,24 @@ RowLayout {
id: nameLabel

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
width: {
if (hovered) {
return icon.width + label.contentWidth
} else {
if (nameContainer.width > 0 && icon.width + label.contentWidth < nameContainer.width)
return icon.width + label.contentWidth
return nameContainer.width
}
}

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

Expand All @@ -259,6 +270,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 5fdfa51

Please sign in to comment.