-void ChatView::sceneHeightChanged(qreal h) {
- Q_UNUSED(h)
- bool scrollable = qAbs(verticalScrollBar()->value() - verticalScrollBar()->maximum()) <= 2; // be a bit tolerant here, also FIXME (why we need this?)
- setSceneRect(scene()->sceneRect());
- if(scrollable) verticalScrollBar()->setValue(verticalScrollBar()->maximum());
-}
-
-void ChatView::setBufferForBacklogFetching(BufferId id) {
- scene()->setBufferForBacklogFetching(id);
-}
-
-void ChatView::sliderPressed() {
- verticalScrollbarChanged(verticalScrollBar()->value());
-}
-
-void ChatView::sliderReleased() {
- if(scene()->isFetchingBacklog()) scene()->setIsFetchingBacklog(false);
+void ChatView::sceneHeightChanged(qreal dh) {
+ QAbstractSlider *vbar = verticalScrollBar();
+ Q_ASSERT(vbar);
+ if(vbar->maximum() - vbar->value() <= dh + 5) // in case we had scrolled only about half a line to the bottom we allow a grace of 5
+ vbar->setValue(vbar->maximum());