From 073bd4df59665fd6eb786a448bdec84838e24467 Mon Sep 17 00:00:00 2001 From: Jared Van Bortel Date: Tue, 8 Oct 2024 11:14:15 -0400 Subject: [PATCH] modellist: emit dataChanged on the correct index dataChanged will not work correctly if we emit it on an old index after sorting. Signed-off-by: Jared Van Bortel --- gpt4all-chat/src/modellist.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gpt4all-chat/src/modellist.cpp b/gpt4all-chat/src/modellist.cpp index faf595f02062b..f87bf7c058fba 100644 --- a/gpt4all-chat/src/modellist.cpp +++ b/gpt4all-chat/src/modellist.cpp @@ -1000,11 +1000,11 @@ void ModelList::updateData(const QString &id, const QVector } } + emit dataChanged(createIndex(index, 0), createIndex(index, 0)); + if (shouldSort) resortModel(); - emit dataChanged(createIndex(index, 0), createIndex(index, 0)); - // FIXME(jared): for some reason these don't update correctly when the source model changes, so we explicitly invalidate them m_selectableModels->invalidate(); m_installedModels->invalidate();