X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fchatview.cpp;h=6344c9c2c23564d71566c42f58d02dd21a8eae36;hb=952da9aeecc6c778a7c3cd62b1ecfdc13b24bc8b;hp=ff0460aa15abfa3626ffe22af3651e7d431e80cb;hpb=70ededc490cb201e52b6d8ca4c2364d4a001b6c4;p=quassel.git diff --git a/src/qtui/chatview.cpp b/src/qtui/chatview.cpp index ff0460aa..6344c9c2 100644 --- a/src/qtui/chatview.cpp +++ b/src/qtui/chatview.cpp @@ -50,8 +50,9 @@ void ChatView::init(MessageFilter *filter) { setAlignment(Qt::AlignBottom); setInteractive(true); - _scene = new ChatScene(filter, filter->idString(), viewport()->width(), this); + _scene = new ChatScene(filter, filter->idString(), viewport()->width() - 2, this); // see below: resizeEvent() connect(_scene, SIGNAL(sceneHeightChanged(qreal)), this, SLOT(sceneHeightChanged(qreal))); + connect(_scene, SIGNAL(sceneRectChanged(const QRectF &)), this, SLOT(sceneRectChanged(const QRectF &))); setScene(_scene); _lastScrollbarPos = verticalScrollBar()->maximum(); @@ -59,9 +60,8 @@ void ChatView::init(MessageFilter *filter) { } void ChatView::resizeEvent(QResizeEvent *event) { -// scene()->setWidth(event->size().width() - 2); // FIXME figure out why we have to hardcode the -2 here QGraphicsView::resizeEvent(event); - scene()->setWidth(viewport()->width()); + scene()->setWidth(viewport()->width() - 2); // FIXME figure out why we have to hardcode the -2 here -> Qt-Bug most probably verticalScrollBar()->setValue(verticalScrollBar()->maximum()); } @@ -76,6 +76,9 @@ void ChatView::verticalScrollbarChanged(int newPos) { QAbstractSlider *vbar = verticalScrollBar(); Q_ASSERT(vbar); + if(vbar->maximum() - vbar->value() <= 5) // FIXME workaround the fact that the view gets scrolled up a few px on buffer change + vbar->setValue(vbar->maximum()); + if(newPos < _lastScrollbarPos) { int relativePos = 100; if(vbar->maximum() - vbar->minimum() != 0)