[Solved] QTreeModel refresh problem
-
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 -
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
-
It's work