summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMahmoud Badri <mahmoud.badri@qt.io>2019-02-22 11:58:48 +0200
committerMahmoud Badri <mahmoud.badri@qt.io>2019-02-22 12:33:21 +0000
commit6c3cd5b982c22e006421a611cc3595737e3dabd6 (patch)
tree86de136ea56b0ad88d52cc544d64bcb511c075d8
parentc9d077037e44d49180b53bfdd32bd1e669725567 (diff)
Variants: make all group labels have equal width as the widest one
Task-number: QT3DS-2983 Change-Id: I90ba9612354809b3d690029c735b62a7e64c6f2d Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml
index 4ccff8ee..ab0b8db3 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml
@@ -1148,19 +1148,37 @@ Rectangle {
}
Repeater {
- id: tagsReeater
+ id: tagsRepeater
model: _variantsGroupModel
+ property int maxGroupLabelWidth;
+
+ onItemAdded: {
+ // make all group labels have equal width as the widest one
+ if (index == 0)
+ maxGroupLabelWidth = 20; // min group label width
+
+ if (item.groupLabelWidth > maxGroupLabelWidth) {
+ maxGroupLabelWidth = item.groupLabelWidth;
+
+ if (maxGroupLabelWidth > 150) // max group label width
+ maxGroupLabelWidth = 150;
+ }
+ }
Row {
id: variantTagsRow
+ spacing: 5
readonly property var tagsModel: model.tags
readonly property var groupModel: model
+ readonly property int groupLabelWidth: tLabel.implicitWidth
Text {
+ id: tLabel
text: model.group
color: model.color
- width: 50
+ width: tagsRepeater.maxGroupLabelWidth;
+ elide: Text.ElideRight
anchors.top: parent.top
anchors.topMargin: 5