diff --git a/common/src/parameters.mjs b/common/src/parameters.mjs index 0da11a8..755d4aa 100644 --- a/common/src/parameters.mjs +++ b/common/src/parameters.mjs @@ -377,4 +377,4 @@ export function serializesByPropertyType(propertyType, value) { } else throw new TypeError(`Exportation error: Unknown property type ${propertyType}.`) return result -} \ No newline at end of file +} diff --git a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/Editor/CustomPropertyList.qml b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/Editor/CustomPropertyList.qml index 6e33b71..113b8bd 100644 --- a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/Editor/CustomPropertyList.qml +++ b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/Editor/CustomPropertyList.qml @@ -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 diff --git a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/Editor/Dialog.qml b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/Editor/Dialog.qml index d762da2..a5352d4 100644 --- a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/Editor/Dialog.qml +++ b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/Editor/Dialog.qml @@ -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() } } diff --git a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectLists.qml b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectLists.qml index d37a015..8047573 100644 --- a/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectLists.qml +++ b/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectLists.qml @@ -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 }