projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Keep scrolled down views through resizeEvents
[quassel.git]
/
src
/
qtui
/
chatview.cpp
diff --git
a/src/qtui/chatview.cpp
b/src/qtui/chatview.cpp
index
b40b290
..
b8cb2f1
100644
(file)
--- a/
src/qtui/chatview.cpp
+++ b/
src/qtui/chatview.cpp
@@
-126,11
+126,26
@@
bool ChatView::event(QEvent *event)
void ChatView::resizeEvent(QResizeEvent *event)
{
void ChatView::resizeEvent(QResizeEvent *event)
{
+ // if view is currently scrolled to bottom, we want it that way after resizing
+ bool atBottom = (_lastScrollbarPos == verticalScrollBar()->maximum());
+
QGraphicsView::resizeEvent(event);
QGraphicsView::resizeEvent(event);
+ // if scrolling to bottom, do it immediately.
+ if(atBottom)
+ {
+ // we can reduce viewport updates if we scroll to the bottom allready at the beginning
+ verticalScrollBar()->setValue(verticalScrollBar()->maximum());
+ }
+
scene()->updateForViewport(viewport()->width(), viewport()->height());
adjustSceneRect();
scene()->updateForViewport(viewport()->width(), viewport()->height());
adjustSceneRect();
+ if(atBottom)
+ {
+ _lastScrollbarPos = verticalScrollBar()->maximum();
+ verticalScrollBar()->setValue(verticalScrollBar()->maximum());
+ }
checkChatLineCaches();
}
checkChatLineCaches();
}