Work around problems in QTreeView when using Qt 4.8
authorManuel Nickschas <sputnick@quassel-irc.org>
Fri, 3 Feb 2012 12:04:08 +0000 (13:04 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Fri, 3 Feb 2012 12:04:08 +0000 (13:04 +0100)
Looks like having animated QTreeViews lead to problems with rendering nested trees.
This affects both the NickView and BufferView. Maybe it's something in our code,
but looks like simply disabling animations for Qt >= 4.8 does the trick as well...

src/uisupport/bufferview.cpp
src/uisupport/nickview.cpp

index b2fbc0f..ef1d927 100644 (file)
@@ -65,11 +65,14 @@ void BufferView::init() {
   hideColumn(1);
   hideColumn(2);
   setIndentation(10);
+
   expandAll();
 
   header()->hide(); // nobody seems to use this anyway
 
-  setAnimated(true);
+  // breaks with Qt 4.8
+  if(QString("4.8.0") > qVersion()) // FIXME breaks with Qt versions >= 4.10!
+    setAnimated(true);
 
   // FIXME This is to workaround bug #663
   setUniformRowHeights(true);
index bdba62f..34fb554 100644 (file)
@@ -44,7 +44,6 @@ NickView::NickView(QWidget *parent)
   : QTreeView(parent)
 {
   setIndentation(10);
-  setAnimated(true);
   header()->hide();
   setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
   setSortingEnabled(true);
@@ -53,6 +52,10 @@ NickView::NickView(QWidget *parent)
   setContextMenuPolicy(Qt::CustomContextMenu);
   setSelectionMode(QAbstractItemView::ExtendedSelection);
 
+  // breaks with Qt 4.8
+  if(QString("4.8.0") > qVersion()) // FIXME breaks with Qt versions >= 4.10!
+    setAnimated(true);
+
   connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(showContextMenu(const QPoint&)));
 
 #if defined Q_WS_QWS || defined Q_WS_X11