PDA

View Full Version : qt4 - xp - model/view



incapacitant
14th March 2006, 14:45
I have a model called "model" attached to a TreView called "treeView.
In QT4 there was a way to empty all rows.

None of the code below gives result :


qRecap->removeRows(0, qRecap->rowCount(QModelIndex()), QModelIndex());
qRecap->clear();



qRecap is the model.
qRecap has no member removeRows or clear.

How can i remove all entries from the model ?

jpn
14th March 2006, 14:59
What type of model is that?

- The clear() (http://doc.trolltech.com/4.1/qstandarditemmodel.html#clear) method exists for a QStandardItemModel, and should be enough to remove all items in the model.
- The removeRows() (http://doc.trolltech.com/4.1/qabstractitemmodel.html#removeRows) method (but not implementation, necessarily) exists for any QAbstractItemModel derivate so there is supposedly something wrong with your qRecap pointer...