List setting deletion + minor changes

This commit is contained in:
Adsooi 2020-12-27 19:42:03 +01:00
parent a3ba0724ab
commit d48e4e844c
4 changed files with 26 additions and 5 deletions

View file

@ -71,6 +71,7 @@ MenuBar {
visible: Objects.types[modelData].createable() visible: Objects.types[modelData].createable()
height: visible ? implicitHeight : 0 height: visible ? implicitHeight : 0
icon.source: './icons/'+modelData+'.svg' // Default to dark version icon.source: './icons/'+modelData+'.svg' // Default to dark version
icon.name: modelData
icon.color: sysPalette.windowText icon.color: sysPalette.windowText
onTriggered: { onTriggered: {
Objects.createNewRegisteredObject(modelData) Objects.createNewRegisteredObject(modelData)

View file

@ -90,7 +90,7 @@ Column {
TextField { TextField {
id: valueInput id: valueInput
height: parent.height height: parent.height
width: parent.width - x width: parent.width - x - deleteButton.width - 5
validator: RegExpValidator { validator: RegExpValidator {
regExp: control.valueRegexp 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)
}
}
} }
} }

View file

@ -257,14 +257,14 @@ ListView {
id: dlgCustomProperties id: dlgCustomProperties
Item { Item {
height: customPropListDict.visible ? customPropListDict.height : 30 height: customPropComment.height + customPropText.height + customPropCheckBox.height + customPropCombo.height + customPropListDict.height
width: dlgProperties.width width: dlgProperties.width
property string label: Utils.camelCase2readable(modelData[0]) property string label: Utils.camelCase2readable(modelData[0])
Text { Text {
id: customPropComment id: customPropComment
height: 30
width: parent.width width: parent.width
height: visible ? implicitHeight : 0
visible: modelData[0].startsWith('comment') visible: modelData[0].startsWith('comment')
text: visible ? modelData[1].replace(/\{name\}/g, objEditor.obj.name) : '' text: visible ? modelData[1].replace(/\{name\}/g, objEditor.obj.name) : ''
color: sysPalette.windowText color: sysPalette.windowText
@ -298,6 +298,7 @@ ListView {
CheckBox { CheckBox {
id: customPropCheckBox id: customPropCheckBox
visible: modelData[1] == 'Boolean' visible: modelData[1] == 'Boolean'
height: visible ? implicitHeight : 0
width: parent.width width: parent.width
text: parent.label text: parent.label
checked: visible ? objEditor.obj[modelData[0]] : false checked: visible ? objEditor.obj[modelData[0]] : false
@ -310,8 +311,8 @@ ListView {
ComboBoxSetting { ComboBoxSetting {
id: customPropCombo id: customPropCombo
height: 30
width: dlgProperties.width width: dlgProperties.width
height: visible ? implicitHeight : 0
label: parent.label label: parent.label
// True to select an object of type, false for enums. // True to select an object of type, false for enums.
property bool selectObjMode: paramTypeIn(modelData[1], ['ObjectType']) property bool selectObjMode: paramTypeIn(modelData[1], ['ObjectType'])
@ -345,6 +346,7 @@ ListView {
ListSetting { ListSetting {
id: customPropListDict id: customPropListDict
width: parent.width width: parent.width
height: visible ? implicitHeight : 0
visible: paramTypeIn(modelData[1], ['List', 'Dict']) visible: paramTypeIn(modelData[1], ['List', 'Dict'])
label: parent.label label: parent.label
@ -401,6 +403,7 @@ ListView {
visible: Objects.types[modelData].createable() visible: Objects.types[modelData].createable()
height: visible ? implicitHeight : 0 height: visible ? implicitHeight : 0
icon.source: './icons/'+modelData+'.svg' // Default to dark version icon.source: './icons/'+modelData+'.svg' // Default to dark version
icon.name: modelData
icon.color: sysPalette.windowText icon.color: sysPalette.windowText
onClicked: { onClicked: {

View file

@ -120,7 +120,6 @@ class Sequence extends Expression {
} }
var expr = parser.parse(str).simplify() var expr = parser.parse(str).simplify()
if(expr.evaluate(evalVariables) == 0) expr = parser.parse('0') if(expr.evaluate(evalVariables) == 0) expr = parser.parse('0')
console.log(n, expr.toString())
expr = parser.parse(Utils.simplifyExpression(expr.toString())).simplify() expr = parser.parse(Utils.simplifyExpression(expr.toString())).simplify()
this.calcValues[n] = expr this.calcValues[n] = expr
} }