You can now switch buffers via mousewhell, when the cursor is over a buffer view.
authorMarcus Eggenberger <egs@quassel-irc.org>
Sun, 24 Feb 2008 18:16:33 +0000 (18:16 +0000)
committerMarcus Eggenberger <egs@quassel-irc.org>
Sun, 24 Feb 2008 18:16:33 +0000 (18:16 +0000)
 Thanks to Ian "eean" Monroe for the patch!

src/uisupport/bufferview.cpp
src/uisupport/bufferview.h
version.inc

index 9b1b93c..380828d 100644 (file)
@@ -220,3 +220,27 @@ void BufferView::showContextMenu(const QPoint &pos) {
   }
 }
 
+void BufferView::wheelEvent(QWheelEvent* event)
+{
+    int rowDelta = ( event->delta() > 0 ) ? -1 : 1;
+    QModelIndex currentIndex = selectionModel()->currentIndex();
+    QModelIndex resultingIndex;
+    if( model()->hasIndex(  currentIndex.row() + rowDelta, currentIndex.column(), currentIndex.parent() ) )
+    {
+        resultingIndex = currentIndex.sibling( currentIndex.row() + rowDelta, currentIndex.column() );
+    }
+    else //if we scroll into a the parent node...
+    {
+        QModelIndex parent = currentIndex.parent();
+        QModelIndex aunt = parent.sibling( parent.row() + rowDelta, parent.column() );
+        if( rowDelta == -1 )
+            resultingIndex = aunt.child( model()->rowCount( aunt ) - 1, 0 );
+        else
+            resultingIndex = aunt.child( 0, 0 );
+        if( !resultingIndex.isValid() )
+            return;
+    }
+    selectionModel()->setCurrentIndex( resultingIndex, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows );
+    selectionModel()->select( resultingIndex, QItemSelectionModel::ClearAndSelect );
+}
+
index 76201b2..f0fc2b6 100644 (file)
@@ -47,6 +47,7 @@ private slots:
   void rowsInserted (const QModelIndex & parent, int start, int end);
   void toggleHeader(bool checked);
   void showContextMenu(const QPoint &);
+  void wheelEvent(QWheelEvent *);
 };
 
 
index 1a7e6b4..a682746 100644 (file)
@@ -5,7 +5,7 @@
 
   quasselVersion = "0.2.0-alpha1";
   quasselDate = "2008-02-24";
-  quasselBuild = 583;
+  quasselBuild = 584;
 
   //! Minimum client build number the core needs
   clientBuildNeeded = 563;