-void ChatView::sceneHeightChanged(qreal h) {
- Q_UNUSED(h)
- bool scrollable = verticalScrollBar()->value() == verticalScrollBar()->maximum();
- setSceneRect(scene()->sceneRect());
- if(scrollable) verticalScrollBar()->setValue(verticalScrollBar()->maximum());
-}
-
-void ChatView::clear()
-{
-}
-
-void ChatView::prependMsg(AbstractUiMsg *msg) {
- //ChatLine *line = dynamic_cast<ChatLine*>(msg);
- //Q_ASSERT(line);
- //prependChatLine(line);
-}
-
-void ChatView::prependChatLine(ChatLine *line) {
- //qDebug() << "prepending";
+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());