From 323952cc3c1cc5d0e4f21dd9ac74736207cc544a Mon Sep 17 00:00:00 2001
From: Simon Rit <simon.rit@creatis.insa-lyon.fr>
Date: Thu, 17 Nov 2011 13:02:32 +0100
Subject: [PATCH] Corrected tab key bugs for one image and reverse order with
 shift

---
 vv/vvMainWindow.cxx | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx
index 10df05b..6bd2d79 100644
--- a/vv/vvMainWindow.cxx
+++ b/vv/vvMainWindow.cxx
@@ -2372,10 +2372,13 @@ void vvMainWindow::RemoveLink(QString image1,QString image2)
 //------------------------------------------------------------------------------
 void vvMainWindow::ChangeImageWithIndexOffset(vvSlicerManager *sm, int slicer, int offset)
 {
+  if(mSlicerManagers.size()==1)
+    return;
+
   int index = 0;
   while(sm != mSlicerManagers[index])
     index++;
-  index = (index+offset) % mSlicerManagers.size();
+  index = (index+offset+mSlicerManagers.size()) % mSlicerManagers.size();
 
   QTreeWidgetItem* item = GetItemFromSlicerManager(mSlicerManagers[index]);
   item->setData(slicer+1,Qt::CheckStateRole,2);         //change checkbox
@@ -2657,7 +2660,7 @@ void vvMainWindow::SaveScreenshotAllSlices()
                                                   "Images( *.png);;Images( *.jpg)");
 
   // Loop on slices
-  for(uint i=0; i<nbSlices; i++) {
+  for(int i=0; i<nbSlices; i++) {
     // Change the slice
     slicer->SetSlice(i); // -> change the slice of the current slicer
     SM->UpdateSlice(0); // --> this one emit UpdateSlice
-- 
2.47.1