Hi

I just would like to know whether this is the way to do it.

I've a QSortFilterProxyModel attached to a QTreeView. Clicking in one of the tree view header columns sorts the column accordingly. Now I want to get rid of the sorting because all data gets removed from the model and then it gets filled with new data again. I tried several approaches amongst others with a model->clear() but didn't succeed. But I was successfull with model->sort(-1) i.e. I sorted a non-existent column. Nice that it works but actually I found nothing in the Qt docs which gives me the proof that this is correct and will also work with future Qt releases (I'm using Qt 4.1.4).

The working piece of code looks like this:

Qt Code:
  1. treeView->header()->setSortIndicatorShown(false);
  2. model->sort(-1);
To copy to clipboard, switch view to plain text mode 

Can anybody tell me whether this is good practice or if not how to do it better?

Thanks!
Ernst