From 8b5b12b722485dcb10fdb3d70d7c3b832aedc22b Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Fri, 23 May 2025 18:03:59 -0700 Subject: [PATCH] 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. --- src/core/scriptmodel.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/core/scriptmodel.cpp b/src/core/scriptmodel.cpp index df9776d1..6837c4ab 100644 --- a/src/core/scriptmodel.cpp +++ b/src/core/scriptmodel.cpp @@ -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(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;