From d48e4e844c0b3aa8140d7629fe3b2413374532b1 Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Sun, 27 Dec 2020 19:42:03 +0100 Subject: [PATCH] List setting deletion + minor changes --- qml/AppMenuBar.qml | 1 + qml/ListSetting.qml | 20 +++++++++++++++++++- qml/ObjectLists.qml | 9 ++++++--- qml/js/mathlib.js | 1 - 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/qml/AppMenuBar.qml b/qml/AppMenuBar.qml index 913fe5e..e8de9e8 100644 --- a/qml/AppMenuBar.qml +++ b/qml/AppMenuBar.qml @@ -71,6 +71,7 @@ MenuBar { visible: Objects.types[modelData].createable() height: visible ? implicitHeight : 0 icon.source: './icons/'+modelData+'.svg' // Default to dark version + icon.name: modelData icon.color: sysPalette.windowText onTriggered: { Objects.createNewRegisteredObject(modelData) diff --git a/qml/ListSetting.qml b/qml/ListSetting.qml index 1ee94a4..3265636 100644 --- a/qml/ListSetting.qml +++ b/qml/ListSetting.qml @@ -90,7 +90,7 @@ Column { TextField { id: valueInput height: parent.height - width: parent.width - x + width: parent.width - x - deleteButton.width - 5 validator: RegExpValidator { regExp: control.valueRegexp } @@ -117,6 +117,24 @@ Column { } } } + + Item { + width: 5 + height: parent.height + } + + Button { + id: deleteButton + width: visible ? parent.height : 0 + height: width + icon.source: './icons/delete.svg' + icon.name: 'delete' + visible: !control.forbidAdding + + onClicked: { + control.model.remove(index) + } + } } } diff --git a/qml/ObjectLists.qml b/qml/ObjectLists.qml index 4100973..a91ae70 100644 --- a/qml/ObjectLists.qml +++ b/qml/ObjectLists.qml @@ -257,14 +257,14 @@ ListView { id: dlgCustomProperties Item { - height: customPropListDict.visible ? customPropListDict.height : 30 + height: customPropComment.height + customPropText.height + customPropCheckBox.height + customPropCombo.height + customPropListDict.height width: dlgProperties.width property string label: Utils.camelCase2readable(modelData[0]) Text { id: customPropComment - height: 30 width: parent.width + height: visible ? implicitHeight : 0 visible: modelData[0].startsWith('comment') text: visible ? modelData[1].replace(/\{name\}/g, objEditor.obj.name) : '' color: sysPalette.windowText @@ -298,6 +298,7 @@ ListView { CheckBox { id: customPropCheckBox visible: modelData[1] == 'Boolean' + height: visible ? implicitHeight : 0 width: parent.width text: parent.label checked: visible ? objEditor.obj[modelData[0]] : false @@ -310,8 +311,8 @@ ListView { ComboBoxSetting { id: customPropCombo - height: 30 width: dlgProperties.width + height: visible ? implicitHeight : 0 label: parent.label // True to select an object of type, false for enums. property bool selectObjMode: paramTypeIn(modelData[1], ['ObjectType']) @@ -345,6 +346,7 @@ ListView { ListSetting { id: customPropListDict width: parent.width + height: visible ? implicitHeight : 0 visible: paramTypeIn(modelData[1], ['List', 'Dict']) label: parent.label @@ -401,6 +403,7 @@ ListView { visible: Objects.types[modelData].createable() height: visible ? implicitHeight : 0 icon.source: './icons/'+modelData+'.svg' // Default to dark version + icon.name: modelData icon.color: sysPalette.windowText onClicked: { diff --git a/qml/js/mathlib.js b/qml/js/mathlib.js index d37f99d..e1be802 100644 --- a/qml/js/mathlib.js +++ b/qml/js/mathlib.js @@ -120,7 +120,6 @@ class Sequence extends Expression { } var expr = parser.parse(str).simplify() if(expr.evaluate(evalVariables) == 0) expr = parser.parse('0') - console.log(n, expr.toString()) expr = parser.parse(Utils.simplifyExpression(expr.toString())).simplify() this.calcValues[n] = expr }