Skip to content

Commit

Permalink
Fix ValueMap widget to save key instead of value
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Mar 31, 2016
1 parent 445b610 commit 5d33573
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
7 changes: 1 addition & 6 deletions src/qml/FeatureForm.qml
Expand Up @@ -119,7 +119,7 @@ Rectangle {
id: attributeEditorLoader
anchors { left: parent.left; right: parent.right }

visible: form.state != "ReadOnly"
enabled: form.state != "ReadOnly"
property var value: AttributeValue
property var config: EditorWidgetConfig

Expand All @@ -136,11 +136,6 @@ Rectangle {
onValueChanged: featureFormList.model.setAttribute( index, value, FeatureModel.AttributeValue )
}

Text {
visible: form.state == "ReadOnly"
text: AttributeValue || 'N/A'
}

Controls.CheckBox {
id: rememberValueCheckbox

Expand Down
12 changes: 9 additions & 3 deletions src/qml/editorwidgets/ValueMap.qml
Expand Up @@ -9,18 +9,24 @@ Item {

height: childrenRect.height

property var _reverseConfig: ({})

ComboBox {
id: comboBox

currentIndex: find(value)
currentIndex: find(_reverseConfig[value])

Component.onCompleted: {
model = Object.keys(config);
currentIndex = find(value)
for(var key in config) {
_reverseConfig[json[key]] = key;
}

currentIndex = find(_reverseConfig[value])
}

onCurrentTextChanged: {
valueChanged( currentText )
valueChanged( config[currentText] )
}
}
}

0 comments on commit 5d33573

Please sign in to comment.