QHeaderView - do not keep indexes from an obsolete model
authorThorbjørn Lund Martsum <tmartsum@gmail.com>
Thu, 8 Nov 2012 14:09:00 +0000 (15:09 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Tue, 20 Nov 2012 13:13:07 +0000 (14:13 +0100)
When we call setModel persistentHiddenSections are no longer relevant.
It contains indexes from the previous model.

This solves:

Task-number: QTBUG-18196

Change-Id: Ida02fa63a915695e3730fd63995ac5f8520ae827
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
src/widgets/itemviews/qheaderview.cpp

index 21c2e90..feda750 100644 (file)
@@ -350,6 +350,7 @@ void QHeaderView::setModel(QAbstractItemModel *model)
     if (model == this->model())
         return;
     Q_D(QHeaderView);
+    d->persistentHiddenSections.clear();
     if (d->model && d->model != QAbstractItemModelPrivate::staticEmptyModel()) {
     if (d->orientation == Qt::Horizontal) {
         QObject::disconnect(d->model, SIGNAL(columnsInserted(QModelIndex,int,int)),