From cfb364f033d3d80dde6c5ff4967c1e7e6e1187f3 Mon Sep 17 00:00:00 2001 From: Petr Mironychev <9195189+Palm1r@users.noreply.github.com> Date: Thu, 24 Apr 2025 01:32:01 +0200 Subject: [PATCH] fix: Correct removing latest item in messages list --- ChatView/ChatModel.cpp | 2 +- ChatView/qml/ChatItem.qml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ChatView/ChatModel.cpp b/ChatView/ChatModel.cpp index ce56563..df382eb 100644 --- a/ChatView/ChatModel.cpp +++ b/ChatView/ChatModel.cpp @@ -202,7 +202,7 @@ void ChatModel::resetModelTo(int index) if (index < 0 || index >= m_messages.size()) return; - if (index < m_messages.size() - 1) { + if (index < m_messages.size()) { beginRemoveRows(QModelIndex(), index, m_messages.size() - 1); m_messages.remove(index, m_messages.size() - index); endRemoveRows(); diff --git a/ChatView/qml/ChatItem.qml b/ChatView/qml/ChatItem.qml index c0c62cd..9ae570d 100644 --- a/ChatView/qml/ChatItem.qml +++ b/ChatView/qml/ChatItem.qml @@ -140,8 +140,7 @@ Rectangle { anchors { right: parent.right - bottom: parent.bottom - bottomMargin: 2 + top: parent.top } text: qsTr("ResetTo")