the model can be null, be careful with that (and use emit for signals!)
This commit is contained in:
parent
4e78f327bb
commit
f5275fc57a
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user