+bool ChatView::eventFilter(QObject* watched, QEvent* event)
+{
+ QAbstractSlider* vbar = verticalScrollBar();
+ Q_ASSERT(vbar);
+
+ if (watched != vbar) {
+ // Ignore and pass through all events not featuring the scrollbar
+ return false;
+ }
+ if (event->type() == QEvent::Show) {
+ // FIXME: Workaround for the ChatView scrolling up a fair bit when transitioning from the
+ // vertical scrollbar not being visible, to becoming visible. This happens especially
+ // often when no initial backlog is loaded.
+ if (_backlogRequestedBeforeScrollable) {
+ _backlogRequestedBeforeScrollable = false;
+ vbar->setValue(vbar->maximum());
+ }
+ }
+ // Pass through all events
+ return false;
+}
+