mirror of
https://github.com/quickshell-mirror/quickshell.git
synced 2026-10-27 02:54:36 +00:00
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:
1 file changed
+16
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user