Add configuration option for a custom stylesheet
[quassel.git] / src / qtui / chatview.cpp
index c8d6699..3c7d8cf 100644 (file)
@@ -28,6 +28,8 @@
 #include "chatview.h"
 #include "client.h"
 #include "messagefilter.h"
+#include "qtui.h"
+#include "qtuistyle.h"
 
 ChatView::ChatView(BufferId bufferId, QWidget *parent)
   : QGraphicsView(parent),
@@ -71,6 +73,7 @@ void ChatView::init(MessageFilter *filter) {
   setScene(_scene);
 
   connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(verticalScrollbarChanged(int)));
+  connect(QtUi::style(), SIGNAL(changed()), this, SLOT(styleChanged()));
 }
 
 bool ChatView::event(QEvent *event) {
@@ -163,6 +166,16 @@ void ChatView::verticalScrollbarChanged(int newPos) {
     }
   }
   _lastScrollbarPos = newPos;
+
+  // FIXME: Fugly workaround for the ChatView scrolling up 1px on buffer switch
+  if(vbar->maximum() - newPos <= 2)
+    vbar->setValue(vbar->maximum());
+}
+
+void ChatView::styleChanged() {
+  invalidateScene();
+  if(scene())
+    scene()->update();
 }
 
 MsgId ChatView::lastMsgId() const {