mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
paginatemodel: Avoid to disconnect if model is the same because it's not reconnected after
The quick settings is not updated because sometimes is set to the same model but here, we disconnect all signals to previous model without check if is the same model, but we don't reconnect the signals if is the same model.
This commit is contained in:
parent
6bc80a7bce
commit
f9d4bd9a83
1 changed files with 28 additions and 26 deletions
|
|
@ -73,11 +73,14 @@ QAbstractItemModel *PaginateModel::sourceModel() const
|
|||
|
||||
void PaginateModel::setSourceModel(QAbstractItemModel *model)
|
||||
{
|
||||
if (model == d->m_sourceModel) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (d->m_sourceModel) {
|
||||
disconnect(d->m_sourceModel, nullptr, this, nullptr);
|
||||
}
|
||||
|
||||
if (model != d->m_sourceModel) {
|
||||
beginResetModel();
|
||||
d->m_sourceModel = model;
|
||||
if (model) {
|
||||
|
|
@ -107,7 +110,6 @@ void PaginateModel::setSourceModel(QAbstractItemModel *model)
|
|||
}
|
||||
endResetModel();
|
||||
Q_EMIT sourceModelChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> PaginateModel::roleNames() const
|
||||
|
|
|
|||
Loading…
Reference in a new issue