core/scriptmodel: update model data after objectProp eq

Updates the values list and sends dataChanged if objectProp
compared equal but the new value is actually different.
This commit is contained in:
outfoxxed 2025-05-23 18:03:59 -07:00
parent 2e33ef5b7f
commit 8b5b12b722
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E

View file

@ -131,6 +131,22 @@ void ScriptModel::updateValuesUnique(const QVariantList& newValues) {
iter = std::copy(startNewIter, newIter, iter);
this->endInsertRows();
}
} else if (*newIter != *iter) {
auto first = static_cast<qint32>(std::distance(this->mValues.begin(), iter));
auto index = first;
do {
this->mValues.replace(index, *newIter);
++iter;
++newIter;
++index;
} while (iter != this->mValues.end() && newIter != newValues.end() && *newIter != *iter);
this->dataChanged(
this->index(first, 0, QModelIndex()),
this->index(index - 1, 0, QModelIndex()),
{Qt::UserRole}
);
} else {
++iter;
++newIter;