May 11, 2011

nonot1 nonot1
Lab Rat
70 posts

QAbstractItemModel: How to signal major change?

 

Hello,

If I’ve got a QAbstractItemModel based hierarchal model, and I need to make significant changes to it’s structure at run time, what functions do I need to call to alert the view before and after the change?

(Rows would need to be added, removed, and relocated at the same time. Columns would not change.)

Since, I don’t see any generic beginModelReorganization() and endModelReorganization() calls, what is the correct procedure?

Is it just beginResetModel()/endResetModel() to completely clear any viewer state?

Thank you

2 replies

May 11, 2011

Volker Volker
Robot Herder
5428 posts

You should call QAbstractItemModel::beginResetModel() [doc.qt.nokia.com] and QAbstractItemModel::endResetModel() [doc.qt.nokia.com]

May 11, 2011

nonot1 nonot1
Lab Rat
70 posts

Thank you, Volker.

 
  ‹‹ Trouble subclassing QSlider      QCoreApplication::applicationDirPath()..gives different results on Win7 and Mac?? ››

You must log in to post a reply. Not a member yet? Register here!