From f960afb3b3a66c547815425995d6f7c63dc811cd Mon Sep 17 00:00:00 2001
From: tbaudier <thomas.baudier@creatis.insa-lyon.fr>
Date: Tue, 2 Feb 2016 14:10:25 +0100
Subject: [PATCH] Avoid Warnings with QtDesigner include and Qt5 In
 vvSlicerManager.cxx: Debug: when opening a second image, all slicer were
 updated, not only the first

---
 CMakeLists.txt                       |  8 +++++++-
 cmake/build_opt.cmake                | 10 +++++-----
 vv/CMakeLists.txt                    |  2 +-
 vv/vvIntensityValueSlider.h          |  1 +
 vv/vvLabelImageLoaderWidget.h        |  1 +
 vv/vvMainWindow.cxx                  |  4 +++-
 vv/vvToolBinarize.h                  |  1 +
 vv/vvToolCropImage.h                 |  1 +
 vv/vvToolImageArithm.h               |  1 +
 vv/vvToolInputSelectorWidget.h       |  1 +
 vv/vvToolMIP.h                       |  1 +
 vv/vvToolMedianFilter.h              |  3 ++-
 vv/vvToolProfile.h                   |  1 +
 vv/vvToolROIManager.h                |  1 +
 vv/vvToolSegmentation.h              |  1 +
 vv/vvToolSimpleInputSelectorWidget.h |  2 ++
 vv/vvToolWidgetBase.h                |  1 +
 17 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8030908..f0ed562 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,11 +5,17 @@ cmake_minimum_required(VERSION 2.8)
 cmake_policy(VERSION 2.8)
 if(COMMAND cmake_policy)
     cmake_policy(SET CMP0003 NEW)
-    #cmake_policy(SET CMP0007 NEW)
+    cmake_policy(SET CMP0007 NEW)
 endif(COMMAND cmake_policy)
 if(NOT DEFINED CLITK_SOURCE_DIR)
   set(CLITK_SOURCE_DIR ${PROJECT_SOURCE_DIR})
 endif(NOT DEFINED CLITK_SOURCE_DIR)
+# Default build type
+IF(NOT CMAKE_BUILD_TYPE)
+  SET(CMAKE_BUILD_TYPE Release CACHE STRING
+    "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
+    FORCE)
+ENDIF(NOT CMAKE_BUILD_TYPE)
 #=========================================================
 
 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
diff --git a/cmake/build_opt.cmake b/cmake/build_opt.cmake
index 48ba5a6..2829401 100644
--- a/cmake/build_opt.cmake
+++ b/cmake/build_opt.cmake
@@ -26,11 +26,11 @@ option(CLITK_BUILD_REGISTRATION "Build command-line registration tools" OFF)
 option(CLITK_BUILD_VV "Build vv the 4D visualizer (requires VTK and QT)" ON)
 
 if(CLITK_BUILD_VV)
-    set(vv_QT_VERSION "4" CACHE STRING "Expected Qt version")
-    set_property(CACHE vv_QT_VERSION PROPERTY STRINGS 4 5)
-    if(NOT (vv_QT_VERSION VERSION_EQUAL "4" OR vv_QT_VERSION VERSION_EQUAL "5"))
-      message(FATAL_ERROR "Expected value for vv_QT_VERSION is either '4' or '5'")
-    endif()
+ if(VTK_VERSION VERSION_LESS 6.0.0)
+    set(vv_QT_VERSION "4" CACHE INTERNAL "Expected Qt version")
+ else()
+    set(vv_QT_VERSION "5" CACHE INTERNAL "Expected Qt version")
+ endif()
 
   add_subdirectory(${CLITK_SOURCE_DIR}/vv ${PROJECT_BINARY_DIR}/vv)
 endif(CLITK_BUILD_VV)
diff --git a/vv/CMakeLists.txt b/vv/CMakeLists.txt
index 3b72002..c49dae5 100644
--- a/vv/CMakeLists.txt
+++ b/vv/CMakeLists.txt
@@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 2.4)
 # To avoid warning with some version
 if(COMMAND cmake_policy)
   cmake_policy(SET CMP0003 NEW)
-  #cmake_policy(SET CMP0007 NEW)
+  cmake_policy(SET CMP0007 NEW)
 endif(COMMAND cmake_policy)
 #=========================================================
 
diff --git a/vv/vvIntensityValueSlider.h b/vv/vvIntensityValueSlider.h
index 2984663..1055010 100644
--- a/vv/vvIntensityValueSlider.h
+++ b/vv/vvIntensityValueSlider.h
@@ -19,6 +19,7 @@
 #define VVINTENSITYVALUESLIDER_H
 
 // qt
+#include <QtGlobal>
 #if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
 #else
diff --git a/vv/vvLabelImageLoaderWidget.h b/vv/vvLabelImageLoaderWidget.h
index 94b591c..3447dba 100644
--- a/vv/vvLabelImageLoaderWidget.h
+++ b/vv/vvLabelImageLoaderWidget.h
@@ -23,6 +23,7 @@
 #include "vvImage.h"
 
 // qt
+#include <QtGlobal>
 #if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
 #else
diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx
index 0dce60f..bd609b8 100644
--- a/vv/vvMainWindow.cxx
+++ b/vv/vvMainWindow.cxx
@@ -1478,7 +1478,9 @@ void vvMainWindow::InitSlicers()
     mSlicerManagers.back()->SetSlicerWindow(1,NEViewWidget->GetRenderWindow());
     mSlicerManagers.back()->SetSlicerWindow(2,SOViewWidget->GetRenderWindow());
     mSlicerManagers.back()->SetSlicerWindow(3,SEViewWidget->GetRenderWindow());
-    mSlicerManagers.back()->Render(); // SR: displayed #slice is wrong without this
+#if VTK_MAJOR_VERSION <= 5
+    mSlicerManagers.back()->Render(); // SR: displayed #slice is wrong without this / TB: With VTK6 and multiple images, all slicers are updated, not only the first
+#endif
   }
 }
 
diff --git a/vv/vvToolBinarize.h b/vv/vvToolBinarize.h
index 0ab816e..c0aa6d9 100644
--- a/vv/vvToolBinarize.h
+++ b/vv/vvToolBinarize.h
@@ -18,6 +18,7 @@
 #ifndef VVTOOLBINARIZE_H
 #define VVTOOLBINARIZE_H
 
+#include <QtGlobal>
 #if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
 #else
diff --git a/vv/vvToolCropImage.h b/vv/vvToolCropImage.h
index 579ac86..11ee8de 100644
--- a/vv/vvToolCropImage.h
+++ b/vv/vvToolCropImage.h
@@ -19,6 +19,7 @@
 #define VVTOOLCROPIMAGE_H
 
 //qt
+#include <QtGlobal>
 #if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
 #else
diff --git a/vv/vvToolImageArithm.h b/vv/vvToolImageArithm.h
index 7e558f3..e4f1b34 100644
--- a/vv/vvToolImageArithm.h
+++ b/vv/vvToolImageArithm.h
@@ -18,6 +18,7 @@
 #ifndef VVTOOLImageArithm_H
 #define VVTOOLImageArithm_H
 
+#include <QtGlobal>
 #if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
 #else
diff --git a/vv/vvToolInputSelectorWidget.h b/vv/vvToolInputSelectorWidget.h
index c0a4920..4bc487f 100644
--- a/vv/vvToolInputSelectorWidget.h
+++ b/vv/vvToolInputSelectorWidget.h
@@ -19,6 +19,7 @@
 #define VVTOOLINPUTSELECTORWIDGET_H
 
 // qt
+#include <QObject>
 #if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
 #else
diff --git a/vv/vvToolMIP.h b/vv/vvToolMIP.h
index d3c6f7c..8ee1410 100644
--- a/vv/vvToolMIP.h
+++ b/vv/vvToolMIP.h
@@ -47,6 +47,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 #include <vvImage.h>
 
+#include <QtGlobal>
 #if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
 #else
diff --git a/vv/vvToolMedianFilter.h b/vv/vvToolMedianFilter.h
index ff8dafe..af2bbf8 100644
--- a/vv/vvToolMedianFilter.h
+++ b/vv/vvToolMedianFilter.h
@@ -44,7 +44,8 @@
 
   #ifndef VVTOOLMedianFilter_H
   #define VVTOOLMedianFilter_H
-  
+
+#include <QtGlobal>
 #if QT_VERSION < 0x050000
   #include <QtDesigner/QDesignerExportWidget>
 #else
diff --git a/vv/vvToolProfile.h b/vv/vvToolProfile.h
index b17bd5c..d59e803 100644
--- a/vv/vvToolProfile.h
+++ b/vv/vvToolProfile.h
@@ -18,6 +18,7 @@
 #ifndef VVTOOLPROFILE_H
 #define VVTOOLPROFILE_H
 
+#include <QtGlobal>
 #if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
 #else
diff --git a/vv/vvToolROIManager.h b/vv/vvToolROIManager.h
index 5c93de3..c79fefc 100644
--- a/vv/vvToolROIManager.h
+++ b/vv/vvToolROIManager.h
@@ -19,6 +19,7 @@
 #ifndef VVTOOLROIMANAGER_H
 #define VVTOOLROIMANAGER_H
 
+#include <QtGlobal>
 #if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
 #else
diff --git a/vv/vvToolSegmentation.h b/vv/vvToolSegmentation.h
index ba5eb5b..9e3180b 100644
--- a/vv/vvToolSegmentation.h
+++ b/vv/vvToolSegmentation.h
@@ -18,6 +18,7 @@
 #ifndef VVTOOLSEGMENTATION_H
 #define VVTOOLSEGMENTATION_H
 
+#include <QtGlobal>
 #if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
 #else
diff --git a/vv/vvToolSimpleInputSelectorWidget.h b/vv/vvToolSimpleInputSelectorWidget.h
index fccc714..46040e4 100644
--- a/vv/vvToolSimpleInputSelectorWidget.h
+++ b/vv/vvToolSimpleInputSelectorWidget.h
@@ -17,6 +17,8 @@
 ===========================================================================**/
 #ifndef VVTOOLSIMPLEINPUTSELECTORWIDGET_H
 #define VVTOOLSIMPLEINPUTSELECTORWIDGET_H
+
+#include <QtGlobal>
 #if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
 #else
diff --git a/vv/vvToolWidgetBase.h b/vv/vvToolWidgetBase.h
index 915600e..17daa2b 100644
--- a/vv/vvToolWidgetBase.h
+++ b/vv/vvToolWidgetBase.h
@@ -19,6 +19,7 @@
 #ifndef VVTOOLWIDGETBASE_H
 #define VVTOOLWIDGETBASE_H
 
+#include <QtGlobal>
 #if QT_VERSION < 0x050000
 #include <QtDesigner/QDesignerExportWidget>
 #else
-- 
2.49.0