diff options
author | Loïc Vital <mugulmotion@gmail.com> | 2022-09-29 11:45:55 +0300 |
---|---|---|
committer | Fabien Castan <fabcastan@gmail.com> | 2022-10-19 11:50:18 +0300 |
commit | c71449535d57cd8a9343038f9204f371939d0ad8 (patch) | |
tree | 7305ec0a8540a2f4743de17f0a8cad8abf41ba17 | |
parent | 38b1caf647e1a74296c9201fafdd0ff3e20d88c5 (diff) |
[ui] use label instead of name in outputAttribute ComboBox
-rw-r--r-- | meshroom/ui/qml/Viewer/Viewer2D.qml | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index dd82aecf..a7ca3547 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -1082,27 +1082,18 @@ FocusScope { id: outputAttribute clip: true Layout.minimumWidth: 0 - Layout.preferredWidth: 3.0 * Qt.application.font.pixelSize flat: true property var names: [] property string name: names[currentIndex] ? names[currentIndex] : "" - model: names + model: displayedNode ? names.map(n => (n == "gallery") ? "Gallery" : displayedNode.attributes.get(n).label) : [] enabled: count > 0 FontMetrics { id: fontMetrics } - - onNamesChanged: { - // update width (set size to max name length + add margin for the dropdown icon) - var maxWidth = 0; - for (var i = 0; i < names.length; i++) { - maxWidth = Math.max(maxWidth, fontMetrics.boundingRect(names[i]).width); - } - Layout.preferredWidth = maxWidth + 3.0 * Qt.application.font.pixelSize; - } + Layout.preferredWidth: model.reduce((acc, label) => Math.max(acc, fontMetrics.boundingRect(label).width), 0) + 3.0*Qt.application.font.pixelSize } MaterialToolButton { |