Commit 31321a4d authored by Ronan Abhamon's avatar Ronan Abhamon

fix(src/components/chat/ChatProxyModel): fix `loadMoreEntries` to support the switch between views

parent b08682a3
...@@ -32,18 +32,20 @@ ChatProxyModel::ChatProxyModel (QObject *parent) : QSortFilterProxyModel(parent) ...@@ -32,18 +32,20 @@ ChatProxyModel::ChatProxyModel (QObject *parent) : QSortFilterProxyModel(parent)
} }
void ChatProxyModel::loadMoreEntries () { void ChatProxyModel::loadMoreEntries () {
int count = rowCount();
int parent_count = m_chat_model_filter.rowCount();
if (count < parent_count) {
// Do not increase `m_n_max_displayed_entries` if it's not necessary... // Do not increase `m_n_max_displayed_entries` if it's not necessary...
// Limit qml calls. // Limit qml calls.
if (m_chat_model_filter.rowCount() <= m_n_max_displayed_entries) if (count == m_n_max_displayed_entries)
return;
int count = rowCount();
m_n_max_displayed_entries += ENTRIES_CHUNK_SIZE; m_n_max_displayed_entries += ENTRIES_CHUNK_SIZE;
invalidateFilter(); invalidateFilter();
if (count < rowCount()) if (count < rowCount())
emit moreEntriesLoaded(); emit moreEntriesLoaded();
}
} }
void ChatProxyModel::setEntryTypeFilter (ChatModel::EntryType type) { void ChatProxyModel::setEntryTypeFilter (ChatModel::EntryType type) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment