diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-01-23 17:34:57 +0200 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-01-23 17:34:57 +0200 |
commit | 2274642f1219590b63fd1e407aee403b5bdb9712 (patch) | |
tree | 2e4750c854b67685d574b5ec410c615e17ecdf9b /src/timeline | |
parent | Don't dismiss the loading overlay by clicking (diff) | |
download | nheko-2274642f1219590b63fd1e407aee403b5bdb9712.tar.xz |
Show the scroll-down button when showing the timeline
Diffstat (limited to 'src/timeline')
-rw-r--r-- | src/timeline/TimelineView.cc | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/timeline/TimelineView.cc b/src/timeline/TimelineView.cc index a085b1e0..31d190cc 100644 --- a/src/timeline/TimelineView.cc +++ b/src/timeline/TimelineView.cc @@ -130,15 +130,7 @@ TimelineView::sliderMoved(int position) if (!scroll_area_->verticalScrollBar()->isVisible()) return; - const int maxScroll = scroll_area_->verticalScrollBar()->maximum(); - const int currentScroll = scroll_area_->verticalScrollBar()->value(); - - if (maxScroll - currentScroll > SCROLL_BAR_GAP) { - scrollDownBtn_->show(); - scrollDownBtn_->raise(); - } else { - scrollDownBtn_->hide(); - } + toggleScrollDownButton(); // The scrollbar is high enough so we can start retrieving old events. if (position < SCROLL_BAR_GAP) { @@ -641,6 +633,8 @@ TimelineView::showEvent(QShowEvent *event) scrollDown(); } + toggleScrollDownButton(); + readLastEvent(); QWidget::showEvent(event); @@ -766,3 +760,17 @@ TimelineView::getEventSender(const mtx::events::collections::TimelineEvents &eve return QString(""); } + +void +TimelineView::toggleScrollDownButton() +{ + const int maxScroll = scroll_area_->verticalScrollBar()->maximum(); + const int currentScroll = scroll_area_->verticalScrollBar()->value(); + + if (maxScroll - currentScroll > SCROLL_BAR_GAP) { + scrollDownBtn_->show(); + scrollDownBtn_->raise(); + } else { + scrollDownBtn_->hide(); + } +} |