Crash Application when I using QAbstractListModel as subclass to custom ListModel



  • Hi everyone!

    I need help with QAbstractListModel. I develop application where I need show items as tree. I use QML component from "here":http://qt-project.org/forums/viewthread/30521/#146845. 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!



  • Try Qt example.
    examples\quick\models\abstractitemmodel



  • [quote author="Vincent007" date="1387375127"]Try Qt example.
    examples\quick\models\abstractitemmodel[/quote]

    Thanks I will check!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.