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
|
} else
|
||||||
throw new TypeError(`Exportation error: Unknown property type ${propertyType}.`)
|
throw new TypeError(`Exportation error: Unknown property type ${propertyType}.`)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,12 @@ Repeater {
|
||||||
Object whose properties to list and edit.
|
Object whose properties to list and edit.
|
||||||
*/
|
*/
|
||||||
property var obj
|
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
|
\qmlproperty var CustomPropertyList::positionPicker
|
||||||
Reference to the global PositionPicker QML object.
|
Reference to the global PositionPicker QML object.
|
||||||
|
@ -280,15 +286,15 @@ Repeater {
|
||||||
Loader {
|
Loader {
|
||||||
id: propertyEditor
|
id: propertyEditor
|
||||||
width: dlgProperties.width - pointerButton.width
|
width: dlgProperties.width - pointerButton.width
|
||||||
property string propertyName: modelData[0]
|
property string propertyName: modelData
|
||||||
property var propertyType: modelData[1]
|
property var propertyType: objPropertyTypes[modelData]
|
||||||
property string propertyLabel: qsTranslate('prop',propertyName)
|
property string propertyLabel: qsTranslate('prop',propertyName)
|
||||||
property string propertyIcon: propertyName
|
property string propertyIcon: propertyName
|
||||||
|
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
if(propertyName.startsWith('comment'))
|
if(propertyName.startsWith('comment'))
|
||||||
return commentComponent
|
return commentComponent
|
||||||
else if(propertyType == 'boolean')
|
else if(propertyType === 'boolean')
|
||||||
return checkboxComponent
|
return checkboxComponent
|
||||||
else if(paramTypeIn(propertyType, ['Expression']))
|
else if(paramTypeIn(propertyType, ['Expression']))
|
||||||
return expressionEditorComponent
|
return expressionEditorComponent
|
||||||
|
|
|
@ -164,8 +164,9 @@ Popup.BaseDialog {
|
||||||
*/
|
*/
|
||||||
function open() {
|
function open() {
|
||||||
dlgCustomProperties.model = [] // Reset
|
dlgCustomProperties.model = [] // Reset
|
||||||
let objProps = Modules.Objects.types[objEditor.objType].properties()
|
const objProps = Modules.Objects.types[objEditor.objType].properties()
|
||||||
dlgCustomProperties.model = Object.keys(objProps).map(prop => [prop, objProps[prop]]) // Converted to 2-dimentional array.
|
dlgCustomProperties.objPropertyTypes = objProps
|
||||||
|
dlgCustomProperties.model = Object.keys(objProps)
|
||||||
objEditor.show()
|
objEditor.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ ScrollView {
|
||||||
*/
|
*/
|
||||||
function paramTypeIn(parameter, types = []) {
|
function paramTypeIn(parameter, types = []) {
|
||||||
if(types.includes(parameter.toString())) return true
|
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 types.includes(parameter.type)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue