Fixing issue with Repeater refusing to use ES classes as values.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
04e070058e
commit
5586f0c214
4 changed files with 14 additions and 7 deletions
|
@ -377,4 +377,4 @@ export function serializesByPropertyType(propertyType, value) {
|
|||
} else
|
||||
throw new TypeError(`Exportation error: Unknown property type ${propertyType}.`)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,12 @@ Repeater {
|
|||
Object whose properties to list and edit.
|
||||
*/
|
||||
property var obj
|
||||
|
||||
/*!
|
||||
\qmlproperty var CustomPropertyList::objPropertyTypes
|
||||
Record containing the properties types of the object mapped by their name.
|
||||
*/
|
||||
property var objPropertyTypes
|
||||
/*!
|
||||
\qmlproperty var CustomPropertyList::positionPicker
|
||||
Reference to the global PositionPicker QML object.
|
||||
|
@ -280,15 +286,15 @@ Repeater {
|
|||
Loader {
|
||||
id: propertyEditor
|
||||
width: dlgProperties.width - pointerButton.width
|
||||
property string propertyName: modelData[0]
|
||||
property var propertyType: modelData[1]
|
||||
property string propertyName: modelData
|
||||
property var propertyType: objPropertyTypes[modelData]
|
||||
property string propertyLabel: qsTranslate('prop',propertyName)
|
||||
property string propertyIcon: propertyName
|
||||
|
||||
sourceComponent: {
|
||||
if(propertyName.startsWith('comment'))
|
||||
return commentComponent
|
||||
else if(propertyType == 'boolean')
|
||||
else if(propertyType === 'boolean')
|
||||
return checkboxComponent
|
||||
else if(paramTypeIn(propertyType, ['Expression']))
|
||||
return expressionEditorComponent
|
||||
|
|
|
@ -164,8 +164,9 @@ Popup.BaseDialog {
|
|||
*/
|
||||
function open() {
|
||||
dlgCustomProperties.model = [] // Reset
|
||||
let objProps = Modules.Objects.types[objEditor.objType].properties()
|
||||
dlgCustomProperties.model = Object.keys(objProps).map(prop => [prop, objProps[prop]]) // Converted to 2-dimentional array.
|
||||
const objProps = Modules.Objects.types[objEditor.objType].properties()
|
||||
dlgCustomProperties.objPropertyTypes = objProps
|
||||
dlgCustomProperties.model = Object.keys(objProps)
|
||||
objEditor.show()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ ScrollView {
|
|||
*/
|
||||
function paramTypeIn(parameter, types = []) {
|
||||
if(types.includes(parameter.toString())) return true
|
||||
if(typeof parameter == 'object' && 'type' in parameter)
|
||||
if(typeof parameter === 'object' && 'type' in parameter)
|
||||
return types.includes(parameter.type)
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue