Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] QTreeModel refresh problem

[Solved] QTreeModel refresh problem

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 1.9k 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.
  • G Offline
    G Offline
    Galbarad
    wrote on last edited by
    #1

    Hi everybody

    I have problem with refreshing my QTreeModel
    my tree show db structure so I'm load child after user try expand tree item
    when item expand first time all fine
    but when I try refresh item (just delete all child and add new child)

    in case when I call beginResetModel/endResetModel I get in first call ASSERT failure QVector<T>::operator[]: "index out of range"
    in case when I not call beginResetModel/endResetModel I get in second call access violation at line qlist.h
    @inline int count() const { return p.size(); }@

    my code

    @void QTreeModel::changeItem(QDBTreeItem* item, const QList<QBaseTreeItem*> &children) {
    QModelIndex ind = createIndex(0,0,item->parent());
    if (ind.isValid()) {
    beginResetModel();
    item->cleanData();
    item->setOpened(true);
    item->appendChildren(children);
    endResetModel();
    }
    }@

    please direct me
    thank you

    1 Reply Last reply
    0
    • G Offline
      G Offline
      Galbarad
      wrote on last edited by
      #2

      lock like problem in expanded state of item because if I collapse item before refresh all fine, so I'll try collapse my items automatic

      good luck for all

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Galbarad
        wrote on last edited by
        #3

        It's work

        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