From 98788b69b685ba723b5c745bac04a8aec82b0253 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 30 Jul 2015 12:13:32 +0200 Subject: [PATCH] small changes --- mix/qml/QAddressView.qml | 12 ++++++++---- mix/qml/QBoolTypeView.qml | 1 - mix/qml/StructView.qml | 17 ++++++++++++----- mix/qml/TransactionDialog.qml | 4 +--- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/mix/qml/QAddressView.qml b/mix/qml/QAddressView.qml index 2b5521124..0a8d09056 100644 --- a/mix/qml/QAddressView.qml +++ b/mix/qml/QAddressView.qml @@ -88,6 +88,7 @@ ColumnLayout function init() { + btnAdd.visible = isArray() textinput.readOnly = readOnly if (isArray() || readOnly) displayInput = true @@ -101,25 +102,28 @@ ColumnLayout if (!trCombobox.visible) { + rowCombobox.visible = false + rowCombobox.height = 0 trCombobox.height = 0 textinput.anchors.top = textinput.parent.top } - if (!readOnly) { + trCombobox.currentIndex = 0 for (var k = 0; k < ctrModel.count; k++) { if (ctrModel.get(k).value === value) { - trCombobox.currentIndex = k; - return; + trCombobox.currentIndex = k + break } } - trCombobox.currentIndex = 0; } if (!isArray()) trCombobox.update() + else if (value === "") + textinput.text = "[]" } function select(address) diff --git a/mix/qml/QBoolTypeView.qml b/mix/qml/QBoolTypeView.qml index 200b6b405..25577b1ea 100644 --- a/mix/qml/QBoolTypeView.qml +++ b/mix/qml/QBoolTypeView.qml @@ -53,7 +53,6 @@ Item for (var k in JSON.parse(boolArray.text)) formattedparam.push(parseInt(format(param[k]))) boolArray.text = JSON.stringify(formattedparam) - } } diff --git a/mix/qml/StructView.qml b/mix/qml/StructView.qml index 2f55b0a73..bc3f9499e 100644 --- a/mix/qml/StructView.qml +++ b/mix/qml/StructView.qml @@ -16,8 +16,10 @@ Column spacing: 0 property int colHeight - onValueChanged: + function clear() { + value = {} + members = [] colHeight = 0 } @@ -119,18 +121,23 @@ Column } item.onValueChanged.connect(function() { - vals[pname] = item.value; - valueChanged(); + syncValue(vals, pname) }); var newWidth = nameLabel.width + typeLabel.width + item.width + 108; if (root.width < newWidth) root.width = newWidth; - if (item.finalize) - item.finalize() + syncValue(vals, pname) } + function syncValue(vals, pname) + { + vals[pname] = item.value; + valueChanged(); + } + + function getValue() { var r = ""; diff --git a/mix/qml/TransactionDialog.qml b/mix/qml/TransactionDialog.qml index a60ea05b3..4c0dff366 100644 --- a/mix/qml/TransactionDialog.qml +++ b/mix/qml/TransactionDialog.qml @@ -120,7 +120,6 @@ Dialog { var type = parameter.type; var pname = parameter.name; paramsModel.push({ name: pname, type: type }); - console.log(JSON.stringify(paramsModel)) } function loadParameters() { @@ -153,8 +152,7 @@ Dialog { function initTypeLoader() { - paramScroll.value = {} - paramScroll.members = [] + paramScroll.clear() paramScroll.value = paramValues; paramScroll.members = paramsModel; paramScroll.updateView()