[ui][GraphEditor] use 'C' locale for FloatParam validator + minor fixes

* using 'C' locale to ensure floating point values can be written using '.' decimal separator
* make TextField larger by default for numbers and fill width when slider is not defined
* avoid binding loop on height for ListAttributes by using contentHeight as implicitHeight
* add explicitly id for Connections in ComboBox
This commit is contained in:
Yann Lanthony 2018-12-14 16:13:52 +01:00
parent 00feb46667
commit e7b49f31c7

View file

@ -184,13 +184,14 @@ RowLayout {
Component { Component {
id: comboBox_component id: comboBox_component
ComboBox { ComboBox {
id: combo
enabled: root.editable enabled: root.editable
model: attribute.desc.values model: attribute.desc.values
Component.onCompleted: currentIndex = find(attribute.value) Component.onCompleted: currentIndex = find(attribute.value)
onActivated: _reconstruction.setAttribute(attribute, currentText) onActivated: _reconstruction.setAttribute(attribute, currentText)
Connections { Connections {
target: attribute target: attribute
onValueChanged: currentIndex = find(attribute.value) onValueChanged: combo.currentIndex = combo.find(attribute.value)
} }
} }
} }
@ -225,8 +226,10 @@ RowLayout {
} }
DoubleValidator { DoubleValidator {
id: doubleValidator id: doubleValidator
locale: 'C' // use '.' decimal separator disregarding the system locale
} }
implicitWidth: 70 implicitWidth: 100
Layout.fillWidth: !slider.active
enabled: root.editable enabled: root.editable
// cast value to string to avoid intrusive scientific notations on numbers // cast value to string to avoid intrusive scientific notations on numbers
property string displayValue: String(slider.active && slider.item.pressed ? slider.item.formattedValue : attribute.value) property string displayValue: String(slider.active && slider.item.pressed ? slider.item.formattedValue : attribute.value)
@ -306,7 +309,7 @@ RowLayout {
id: lv id: lv
model: listAttribute_layout.expanded ? attribute.value : undefined model: listAttribute_layout.expanded ? attribute.value : undefined
visible: model != undefined && count > 0 visible: model != undefined && count > 0
implicitHeight: Math.min(childrenRect.height, 300) implicitHeight: Math.min(contentHeight, 300)
Layout.fillWidth: true Layout.fillWidth: true
Layout.margins: 4 Layout.margins: 4
clip: true clip: true