summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2017-03-14 13:41:30 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2017-05-02 06:48:38 +0000
commite9fb5c1669654adbfc7a73c6385df17aef34905b (patch)
tree478f1368b3361215b26ad4304765b5e855576f39
parenta693686709352dee9441f2f2633606e7327e321b (diff)
downloadqttools-e9fb5c1669654adbfc7a73c6385df17aef34905b.tar.gz
Fix setting a source model in BookmarkFilterModel
Pass newly set model to the QAbstractProxyModel::setSourceModel() call, instead of the old model. Make sure the new model is not null. Change-Id: I149b3c6defd070eb7f6f6fd068639ebf784dfcb9 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
-rw-r--r--src/assistant/assistant/bookmarkfiltermodel.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/assistant/assistant/bookmarkfiltermodel.cpp b/src/assistant/assistant/bookmarkfiltermodel.cpp
index 055272532..d0078840d 100644
--- a/src/assistant/assistant/bookmarkfiltermodel.cpp
+++ b/src/assistant/assistant/bookmarkfiltermodel.cpp
@@ -60,32 +60,32 @@ void BookmarkFilterModel::setSourceModel(QAbstractItemModel *_sourceModel)
disconnect(sourceModel, SIGNAL(modelReset()), this, SLOT(modelReset()));
}
- QAbstractProxyModel::setSourceModel(sourceModel);
sourceModel = qobject_cast<BookmarkModel*> (_sourceModel);
+ QAbstractProxyModel::setSourceModel(sourceModel);
- connect(sourceModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this,
- SLOT(changed(QModelIndex,QModelIndex)));
+ if (sourceModel) {
+ connect(sourceModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this,
+ SLOT(changed(QModelIndex,QModelIndex)));
- connect(sourceModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
- this, SLOT(rowsInserted(QModelIndex,int,int)));
+ connect(sourceModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
+ this, SLOT(rowsInserted(QModelIndex,int,int)));
- connect(sourceModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
- this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
- connect(sourceModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this,
- SLOT(rowsRemoved(QModelIndex,int,int)));
+ connect(sourceModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
+ this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
+ connect(sourceModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this,
+ SLOT(rowsRemoved(QModelIndex,int,int)));
- connect(sourceModel, SIGNAL(layoutAboutToBeChanged()), this,
- SLOT(layoutAboutToBeChanged()));
- connect(sourceModel, SIGNAL(layoutChanged()), this,
- SLOT(layoutChanged()));
+ connect(sourceModel, SIGNAL(layoutAboutToBeChanged()), this,
+ SLOT(layoutAboutToBeChanged()));
+ connect(sourceModel, SIGNAL(layoutChanged()), this,
+ SLOT(layoutChanged()));
- connect(sourceModel, SIGNAL(modelAboutToBeReset()), this,
- SLOT(modelAboutToBeReset()));
- connect(sourceModel, SIGNAL(modelReset()), this, SLOT(modelReset()));
+ connect(sourceModel, SIGNAL(modelAboutToBeReset()), this,
+ SLOT(modelAboutToBeReset()));
+ connect(sourceModel, SIGNAL(modelReset()), this, SLOT(modelReset()));
- if (sourceModel)
setupCache(sourceModel->index(0, 0, QModelIndex()).parent());
-
+ }
endResetModel();
}