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:
Florian RICHER (aka MrDev023) 2025-06-16 21:04:32 +02:00 committed by Devin Lin
parent 6bc80a7bce
commit f9d4bd9a83

View file

@ -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