diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-01-16 22:24:23 +0200 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-01-16 22:24:23 +0200 |
commit | 26540bd12081d3144e8cf4c27cc8b413e2fe5659 (patch) | |
tree | e48a19a6a3554ac374146f1b14488d802bc989c6 /include | |
parent | Fix emoji as avatars issue for the receipts (diff) | |
download | nheko-26540bd12081d3144e8cf4c27cc8b413e2fe5659.tar.xz |
Hack to work around layout flickering when adding new timeline items
Diffstat (limited to 'include')
-rw-r--r-- | include/timeline/TimelineView.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/timeline/TimelineView.h b/include/timeline/TimelineView.h index c120ed69..1ebf6eb7 100644 --- a/include/timeline/TimelineView.h +++ b/include/timeline/TimelineView.h @@ -123,6 +123,17 @@ protected: private: using TimelineEvent = mtx::events::collections::TimelineEvents; + //! HACK: Fixing layout flickering when adding to the bottom + //! of the timeline. + void pushTimelineItem(TimelineItem *item) + { + item->hide(); + QTimer::singleShot(0, this, [=]() { + scroll_layout_->addWidget(item); + item->show(); + }); + }; + void init(); void addTimelineItem(TimelineItem *item, TimelineDirection direction); void updateLastSender(const QString &user_id, TimelineDirection direction); @@ -229,7 +240,8 @@ TimelineView::addUserMessage(const QString &url, TimelineItem *view_item = new TimelineItem(widget, local_user_, with_sender, scroll_widget_); - scroll_layout_->addWidget(view_item); + + pushTimelineItem(view_item); lastMessageDirection_ = TimelineDirection::Bottom; |