Call processEvents while rendering new events
This commit is contained in:
parent
208ca4f638
commit
2cf3161bff
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user