Skip to content

Commit 633957d

Browse files
committed
[GraphEditor] AttributePin: Handle width and elide for attributes' name
1 parent 3234bb9 commit 633957d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

meshroom/ui/qml/GraphEditor/AttributePin.qml

+13-2
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,23 @@ RowLayout {
236236
id: nameLabel
237237

238238
anchors.rightMargin: 0
239-
anchors.right: root.attribute && root.attribute.isOutput ? parent.right : undefined
240239
labelIconRow.layoutDirection: root.attribute.isOutput ? Qt.RightToLeft : Qt.LeftToRight
240+
anchors.right: root.attribute && root.attribute.isOutput ? parent.right : undefined
241241
labelIconRow.spacing: 0
242+
width: {
243+
if (hovered) {
244+
return icon.width + label.contentWidth
245+
} else {
246+
if (icon.width + label.contentWidth < nameContainer.width)
247+
return icon.width + label.contentWidth
248+
return nameContainer.width
249+
}
250+
}
242251

243252
enabled: !root.readOnly
244253
visible: true
245-
property bool hovered: (inputConnectMA.containsMouse || inputConnectMA.drag.active ||
254+
property bool parentNotReady: nameContainer.width == 0
255+
property bool hovered: parentNotReady || (inputConnectMA.containsMouse || inputConnectMA.drag.active ||
246256
inputDropArea.containsDrag || outputConnectMA.containsMouse ||
247257
outputConnectMA.drag.active || outputDropArea.containsDrag)
248258

@@ -259,6 +269,7 @@ RowLayout {
259269
// Text
260270
label.text: root.attribute.label
261271
label.font.pointSize: 7
272+
labelWidth: hovered ? label.contentWidth : nameLabel.width - icon.width
262273
label.elide: hovered ? Text.ElideNone : Text.ElideMiddle
263274
label.horizontalAlignment: root.attribute && root.attribute.isOutput ? Text.AlignRight : Text.AlignLeft
264275

0 commit comments

Comments
 (0)