Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Treeview does not reload correctly replaced items
Qt 6.11 is out! See what's new in the release blog

Treeview does not reload correctly replaced items

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 545 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MrEugene
    wrote on last edited by
    #1

    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 ?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MrEugene
      wrote on last edited by
      #2

      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
                      }
                  }
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved