the model can be null, be careful with that (and use emit for signals!)

This commit is contained in:
Aaron Seigo 2012-10-08 14:28:39 +02:00
parent 4e78f327bb
commit f5275fc57a

View File

@ -74,12 +74,15 @@ void SortFilterModel::setModel(QAbstractItemModel* model)
if (sourceModel()) { if (sourceModel()) {
disconnect(sourceModel(), SIGNAL(modelReset()), this, SLOT(syncRoleNames())); disconnect(sourceModel(), SIGNAL(modelReset()), this, SLOT(syncRoleNames()));
} }
QSortFilterProxyModel::setSourceModel(model);
if (model) { if (model) {
connect(model, SIGNAL(modelReset()), this, SLOT(syncRoleNames())); connect(model, SIGNAL(modelReset()), this, SLOT(syncRoleNames()));
}
QSortFilterProxyModel::setSourceModel(model);
syncRoleNames(); syncRoleNames();
sourceModelChanged(model); }
emit sourceModelChanged(model);
} }