summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-01-25 16:49:31 +0200
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-01-25 16:49:31 +0200
commit2cf3161bff195a862a6853235530ecea7853dedc (patch)
treeaee160436ae414cc0a7801608dab4b3b51797b5f /src
parentGenerate compile_commands.json (diff)
downloadnheko-2cf3161bff195a862a6853235530ecea7853dedc.tar.xz
Call processEvents while rendering new events
Diffstat (limited to 'src')
-rw-r--r--src/timeline/TimelineView.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/timeline/TimelineView.cc b/src/timeline/TimelineView.cc

index 31d190cc..85f01b5d 100644 --- a/src/timeline/TimelineView.cc +++ b/src/timeline/TimelineView.cc
@@ -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