Treeview does not reload correctly replaced items



  • Hi all,
    I want to know if someone already have the same troubleshoot than me.

    I have a treeview which show my C++ custom class objects.
    I can add, select and delete all items in this treeview.

    My troubleshoot is when I deleted any item an add another with the same "modelIndex", the treeview does not reload correctly the new item. When I tried to debug the "delegateItem" of treeview through "Component.onCompleted", I realize to treeview does not has access to the new item but I can edit it.

    Do someone has any idea to resolve this ?



  • Finally, I have isolated the code which cause this behavior. But I do not know how fix it. Can you help me to understand the problem , please?

     Text{
                    id: componentNameLabel
                    anchors.horizontalCenter: parent.horizontalCenter
                    anchors.verticalCenter: parent.verticalCenter
    
                    Component.onCompleted:
                    {
                        if(component.name === '')
                            componentNameLabel.text = component.type
                        else
                            componentNameLabel.text = component.name
                    }
                }
    

Log in to reply
 

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