mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-06-25 23:13:06 +00:00
Update the right index when removing.
This commit is contained in:
parent
c217b7538a
commit
6a905d38d9
@ -99,7 +99,9 @@ public:
|
|||||||
Q_ASSERT(nextChat);
|
Q_ASSERT(nextChat);
|
||||||
setCurrentChat(nextChat);
|
setCurrentChat(nextChat);
|
||||||
}
|
}
|
||||||
beginRemoveRows(QModelIndex(), index, index);
|
|
||||||
|
const int newIndex = m_chats.indexOf(chat);
|
||||||
|
beginRemoveRows(QModelIndex(), newIndex, newIndex);
|
||||||
m_chats.removeAll(chat);
|
m_chats.removeAll(chat);
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
delete chat;
|
delete chat;
|
||||||
@ -167,6 +169,15 @@ private Q_SLOTS:
|
|||||||
emit dataChanged(index, index, {NameRole});
|
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:
|
private:
|
||||||
Chat* m_newChat;
|
Chat* m_newChat;
|
||||||
Chat* m_currentChat;
|
Chat* m_currentChat;
|
||||||
|
Loading…
Reference in New Issue
Block a user