Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, August 2006
Clearing *all* rows in QAbstractItemModel (tree)


Message 1 in thread

I've derived from QAbstractItemModel to implement my own "tree"
model (e.g., a file system tree).

I now want to clear *all* the nodes, and re-populate it.

Must I recursively iterate each node and call

  beginRemoveRows(parent,first,last);
  // ...do it
  endRemoveRows();

Or, is there a simpler way to permit me to clear all (row) state 
in the model?



--
 [ signature omitted ] 

Message 2 in thread

On 03.08.06 06:08:59, Charley Bay wrote:
> I've derived from QAbstractItemModel to implement my own "tree"
> model (e.g., a file system tree).
> 
> I now want to clear *all* the nodes, and re-populate it.
> 
> Must I recursively iterate each node and call
> 
>   beginRemoveRows(parent,first,last);
>   // ...do it
>   endRemoveRows();
> 
> Or, is there a simpler way to permit me to clear all (row) state 
> in the model?

It should be sufficient to do this only on the top-level-items.

Andreas

-- 
 [ signature omitted ]