Call processEvents while rendering new events

This commit is contained in:
Konstantinos Sideris 2018-01-25 16:49:31 +02:00
parent 208ca4f638
commit 2cf3161bff
1 changed files with 10 additions and 3 deletions

View File

@ -249,16 +249,23 @@ TimelineView::parseMessageEvent(const mtx::events::collections::TimelineEvents &
void
TimelineView::renderBottomEvents(const std::vector<TimelineEvent> &events)
{
int counter = 0;
for (const auto &event : events) {
TimelineItem *item = parseMessageEvent(event, TimelineDirection::Bottom);
if (item != nullptr)
if (item != nullptr) {
addTimelineItem(item, TimelineDirection::Bottom);
counter++;
// Prevent blocking of the event-loop
// by calling processEvents every 10 items we render.
if (counter % 10 == 0)
QApplication::processEvents();
}
}
lastMessageDirection_ = TimelineDirection::Bottom;
QApplication::processEvents();
}
int