mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2024-10-01 01:06:10 -04:00
Update the right index when removing.
This commit is contained in:
parent
f13f4f4700
commit
f4f27fc38f
@ -99,7 +99,9 @@ public:
|
||||
Q_ASSERT(nextChat);
|
||||
setCurrentChat(nextChat);
|
||||
}
|
||||
beginRemoveRows(QModelIndex(), index, index);
|
||||
|
||||
const int newIndex = m_chats.indexOf(chat);
|
||||
beginRemoveRows(QModelIndex(), newIndex, newIndex);
|
||||
m_chats.removeAll(chat);
|
||||
endRemoveRows();
|
||||
delete chat;
|
||||
@ -167,6 +169,15 @@ private Q_SLOTS:
|
||||
emit dataChanged(index, index, {NameRole});
|
||||
}
|
||||
|
||||
void printChats()
|
||||
{
|
||||
for (auto c : m_chats) {
|
||||
qDebug() << c->name()
|
||||
<< (c == m_currentChat ? "currentChat: true" : "currentChat: false")
|
||||
<< (c == m_newChat ? "newChat: true" : "newChat: false");
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Chat* m_newChat;
|
||||
Chat* m_currentChat;
|
||||
|
Loading…
Reference in New Issue
Block a user