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
↧