From f538de9b1d26ff2b44fcf5371bed2ae45f142ff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 29 Oct 2009 17:02:54 +0000 Subject: [PATCH] Fix broken navigation in tabbox if a tabular layout is used and there is an odd number of items. svn path=/trunk/KDE/kdebase/workspace/; revision=1042344 --- tabbox/tabboxhandler.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tabbox/tabboxhandler.cpp b/tabbox/tabboxhandler.cpp index d9d0c3a4bc..8de10c1a0e 100644 --- a/tabbox/tabboxhandler.cpp +++ b/tabbox/tabboxhandler.cpp @@ -503,6 +503,8 @@ QModelIndex TabBoxHandler::nextPrev( bool forward ) const row = 0; } ret = model->index( row, column ); + if( !ret.isValid() ) + ret = model->index( 0, 0 ); } else { @@ -516,6 +518,16 @@ QModelIndex TabBoxHandler::nextPrev( bool forward ) const row = model->rowCount() - 1; } ret = model->index( row, column ); + if( !ret.isValid() ) + { + row = model->rowCount() - 1; + for( int i = model->columnCount() - 1; i >= 0; i-- ) + { + ret = model->index( row, i ); + if( ret.isValid() ) + break; + } + } } if( ret.isValid() ) return ret;