Hi everyone!
I need help with QAbstractListModel. I develop application where I need show items as tree. I use QML component from here [qt-project.org]. I’ve created the model list object as subclass QAbstractListModel. All works fine, but when I try to change model to another model application calls crash.
When items need to update I’m creating a new model object and send signal to QML component where I call this:
Component.onCompleted: {
createNewController.updateDatas.connect(updateFields);
}
function updateFields(obj)
{
var list = createNewController.newItem.toPropertiesListModel();
console.log("ssss: "+list.getItem(0).path);
propertiesTable.model = list;
}
TreeView {
id: propertiesTable
anchors.top: parent.top
width: parent.width
height: parent.height - 30
model: createNewController.newItem.toPropertiesListModel()
onModelChanged: {
removeSelectedProperty.enabled = (model !== null && model.length > 0);
}
onCurrentItemChanged: {
console.log("parentPath: "+currentItem.node.path);
propertiesSettingsPanel.propertyValue.text = currentItem.node.value;
}
}
Could you tell me when I can find samples about QAbstractListModel? Thanks!
↧