]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
Merge Qt5 porting.
authorimn <imn@opencascade.com>
Thu, 26 Nov 2015 14:41:19 +0000 (17:41 +0300)
committerrnv <rnv@opencascade.com>
Sat, 26 Dec 2015 14:19:34 +0000 (17:19 +0300)
12 files changed:
CMakeLists.txt
src/PVGUI/CMakeLists.txt
src/PVGUI/PVGUI_Module.cxx
src/PVGUI/PVGUI_Module.h
src/Plugins/ArrayRenamer/CMakeLists.txt
src/Plugins/ArrayRenamer/pqArraysEditorPropertyWidget.cxx
src/Plugins/MEDReader/ParaViewPlugin/CMakeLists.txt
src/Plugins/MEDReader/ParaViewPlugin/VectBoolSpreadSheet.cxx
src/Plugins/TableReader/ParaViewPlugin/CMakeLists.txt
src/Plugins/View/CMakeLists.txt
test/standalone/CMakeLists.txt
test/standalone/gui/CMakeLists.txt

index 08be4910e682b5e5b8da89ff682f8d0f83b023d9..eeb3e46c93cbe3defeb746e4c677227d7d7567a8 100644 (file)
@@ -110,21 +110,26 @@ ENDIF()
 ##
 ## From GUI: part 1 (Qt must be checked before ParaView)
 ##
-FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtHelp)
-# This search for qhelpgenerator is required here
-# to avoid detecting native one due to bug in ParaViewMacros.cmake
-FIND_PROGRAM(QT_HELP_GENERATOR
-    qhelpgenerator
-    PATHS "${QT_BINARY_DIR}"
-    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-    DOC "qhelpgenerator used to compile Qt help project files")
-MARK_AS_ADVANCED(QT_HELP_GENERATOR)
+IF (NOT SALOME_GUI_BUILD_WITH_QT5)
+  FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtHelp)
+  # This search for qhelpgenerator is required here
+  # to avoid detecting native one due to bug in ParaViewMacros.cmake
+  FIND_PROGRAM(QT_HELP_GENERATOR
+              qhelpgenerator
+              PATHS "${QT_BINARY_DIR}"
+              NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+              DOC "qhelpgenerator used to compile Qt help project files")
+  MARK_AS_ADVANCED(QT_HELP_GENERATOR)
+ELSE()
+  FIND_PACKAGE(SalomeQt5 REQUIRED)
+ENDIF()
 
 ##
 ## Specific to ParaViS:
 ##
 FIND_PACKAGE(SalomeParaView REQUIRED)
 
+
 # GUI itself has to be loaded AFTER ParaView: the ParaView config doesn't mix
 # well with the VTK one (and GUI loads VTK):
 FIND_PACKAGE(SalomeGUI REQUIRED)
@@ -179,6 +184,7 @@ ENDIF()
 ##
 ## From SMESH
 ##
+
 IF(SALOME_PARAVIS_BUILD_PLUGINS AND SALOME_PARAVIS_USE_SMESH_SOURCE)
   IF(NOT SALOME_PARAVIS_USE_GEOM_SOURCE)
     SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR} CACHE PATH "Path to the Salome GEOM")
index 40962d0dfb63e0a0b05e6802152d16ba4d698416..db0d0c480893c316b3d21de3fcf577aba28b996f 100644 (file)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -57,7 +57,7 @@ SET(_ui_files
     resources/pqCustomSettingsWidget.ui
     )
 
-QT4_WRAP_UI(_ui_FORMS_HEADERS ${_ui_files})
+QT_WRAP_UIC(_ui_FORMS_HEADERS ${_ui_files})
 
 # header files / to be processed by moc
 SET(_moc_HEADERS
@@ -105,10 +105,10 @@ ENDIF()
 # --- sources ---
 
 # sources / rcc wrappings
-QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
+QT_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
@@ -135,5 +135,5 @@ INSTALL(TARGETS PARAVIS EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_I
 
 # --- header and resources installation ---
 INSTALL(FILES ${PVGUI_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_PARAVIS_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_PARAVIS_INSTALL_RES_DATA}")
 INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_PARAVIS_INSTALL_RES_DATA})
index 2902f451c2f1959468e58b33bb0c23d9cd8a9297..6fa52dbe326922aa6be2150da2569db368740308 100644 (file)
@@ -476,7 +476,7 @@ void PVGUI_Module::showView( bool toShow )
     // this also connects to the pvserver and instantiates relevant PV behaviors
   }
 
-  pvWnd->setShown( toShow );
+  pvWnd->setVisible( toShow );
   if ( toShow ) pvWnd->setFocus();
 }
 
@@ -513,7 +513,7 @@ void PVGUI_Module::endWaitCursor()
 {
   QApplication::restoreOverrideCursor();
 }
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 /*!
   \brief Handler method for the output of messages.
 */
@@ -535,7 +535,29 @@ static void ParavisMessageOutput(QtMsgType type, const char *msg)
     break;
     }
 }
-
+#else
+/*!
+  \brief Handler method for the output of messages.
+*/
+static void ParavisMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
+{
+  switch(type)
+    {
+  case QtDebugMsg:
+    vtkOutputWindow::GetInstance()->DisplayText(msg.toLatin1().constData());
+    break;
+  case QtWarningMsg:
+    vtkOutputWindow::GetInstance()->DisplayErrorText(msg.toLatin1().constData());
+    break;
+  case QtCriticalMsg:
+    vtkOutputWindow::GetInstance()->DisplayErrorText(msg.toLatin1().constData());
+    break;
+  case QtFatalMsg:
+    vtkOutputWindow::GetInstance()->DisplayErrorText(msg.toLatin1().constData());
+    break;
+    }
+}
+#endif
 /*!
   \brief Activate module.
   \param study current study
@@ -544,8 +566,11 @@ static void ParavisMessageOutput(QtMsgType type, const char *msg)
 */
 bool PVGUI_Module::activateModule( SUIT_Study* study )
 {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   myOldMsgHandler = qInstallMsgHandler(ParavisMessageOutput);
-  
+#else
+  myOldMsgHandler = qInstallMessageHandler(ParavisMessageOutput);
+#endif  
   SUIT_ExceptionHandler::addCleanUpRoutine( paravisCleanUp );
 
   storeCommonWindowsState();
@@ -643,8 +668,11 @@ bool PVGUI_Module::deactivateModule( SUIT_Study* study )
   SUIT_ExceptionHandler::removeCleanUpRoutine( paravisCleanUp );
 
   if (myOldMsgHandler)
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     qInstallMsgHandler(myOldMsgHandler);
-
+#else
+    qInstallMessageHandler(myOldMsgHandler);
+#endif
   restoreCommonWindowsState();
   
   return LightApp_Module::deactivateModule( study );
index 7c1a8642d1f27ba11e1991cffa15a7c1e62253ed..64fe64429b9282018204196367bd895c60451d80 100644 (file)
@@ -217,9 +217,11 @@ private:
 
   typedef QMap<int, bool> DockWindowMap;         
   DockWindowMap           myCommonMap; 
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   QtMsgHandler            myOldMsgHandler;
-
+#else  
+  QtMessageHandler        myOldMsgHandler;
+#endif  
   vtkEventQtSlotConnect*  VTKConnect;
 
   pqPythonScriptEditor*   myTraceWindow;
index c70f45ad7699c2ba390250fabd8ed40828297029..4c839fd1c586c5f279790f7fd15fe72d3f426eb9 100644 (file)
@@ -22,13 +22,14 @@ PROJECT(ArrayRenamer)
 
 cmake_minimum_required(VERSION 2.8)
 
+INCLUDE(UseQtExt)
 FIND_PACKAGE(ParaView REQUIRED)
 INCLUDE(${PARAVIEW_USE_FILE})
 
 SET (outifaces)        
 SET (outsrcs)
 
-QT4_WRAP_CPP(moc_srcs pqArraysEditorPropertyWidget.h pqEditComponents.h)
+QT_WRAP_MOC(moc_srcs pqArraysEditorPropertyWidget.h pqEditComponents.h)
 
   ADD_PARAVIEW_PROPERTY_GROUP_WIDGET(outifaces outsrcs
     TYPE "custom_arrays_editor"
index 2de62af5dc22387418bdcaf1b887137b988c7e93..34db037681c3205a9e911a89b9507addb9b0c886 100644 (file)
@@ -435,9 +435,13 @@ pqEditComponents::pqEditComponents( pqComponentsModel* model, QWidget* parent )
   QTableView* componentsTable = new QTableView( this );
   componentsTable->setModel( model );
   aCompsLayout->addWidget( componentsTable );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   componentsTable->horizontalHeader()->setResizeMode( pqComponentsModel::COMPONENT_NAME,  QHeaderView::Stretch );
   componentsTable->horizontalHeader()->setResizeMode( pqComponentsModel::NEW_COMPONENT_NAME, QHeaderView::Stretch );
-  
+#else
+  componentsTable->horizontalHeader()->setSectionResizeMode( pqComponentsModel::COMPONENT_NAME,  QHeaderView::Stretch );
+  componentsTable->horizontalHeader()->setSectionResizeMode( pqComponentsModel::NEW_COMPONENT_NAME, QHeaderView::Stretch );
+#endif
   /// Parameters
   QVBoxLayout *aParamsLayout = new QVBoxLayout( aParams );
   myRenameAllComps = new QCheckBox( "Rename all similar Components", aParams );
@@ -486,10 +490,17 @@ pqArraysEditorPropertyWidget::pqArraysEditorPropertyWidget( vtkSMProxy* smproxy,
   // Layout
   QVBoxLayout* lay = new QVBoxLayout(this);
   lay->addWidget(myArraysTable);
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   myArraysTable->horizontalHeader()->setResizeMode( pqArraysModel::PROCESSING, QHeaderView::ResizeToContents );
   myArraysTable->horizontalHeader()->setResizeMode( pqArraysModel::NAME,  QHeaderView::Stretch);
   myArraysTable->horizontalHeader()->setResizeMode( pqArraysModel::NEW_NAME, QHeaderView::Stretch );
   myArraysTable->horizontalHeader()->setResizeMode( pqArraysModel::COMPONENTS, QHeaderView::ResizeToContents );
+#else
+  myArraysTable->horizontalHeader()->setSectionResizeMode( pqArraysModel::PROCESSING, QHeaderView::ResizeToContents );
+  myArraysTable->horizontalHeader()->setSectionResizeMode( pqArraysModel::NAME,  QHeaderView::Stretch);
+  myArraysTable->horizontalHeader()->setSectionResizeMode( pqArraysModel::NEW_NAME, QHeaderView::Stretch );
+  myArraysTable->horizontalHeader()->setSectionResizeMode( pqArraysModel::COMPONENTS, QHeaderView::ResizeToContents );
+#endif
   myArraysTable->resizeColumnsToContents();
 
   // Connections
index 65991d570a197a4f059562d6b62c2e64bac6c6b8..cd4feaf46561ec06535b5b6642f5a9a35447d293 100644 (file)
@@ -21,7 +21,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../IO )
 
 IF(PARAVIEW_BUILD_QT_GUI)
 
-  QT4_WRAP_UI(CLIENT_UI_SRCS
+  QT_WRAP_UIC(CLIENT_UI_SRCS
     Resources/UI/MEDReaderVectorsWidget.ui
     Resources/UI/MEDReaderTimeModeWidget.ui)
 
@@ -41,7 +41,7 @@ IF(PARAVIEW_BUILD_QT_GUI)
     pqMEDReaderTimesFlagsWidget.cxx
     pqMEDReaderFieldsWidget.cxx)
 
-  QT4_WRAP_CPP(MOC_SRCS
+  QT_WRAP_MOC(MOC_SRCS
     pqExtractGroupFieldsWidget.h
     pqAbstractFieldsWidget.h
     VectBoolSpreadSheet.h
index b878cbb3ba841d06fa6f82eaf8e4d8b4c680587e..286fe5dc9cff124c6c38ea0c2a90b4d21e56b6f3 100644 (file)
@@ -217,8 +217,13 @@ void VectBoolSpreadSheet::init()
   this->verticalHeader()->setMinimumSectionSize(2);
   this->verticalHeader()->setDefaultSectionSize(2);
   this->setItemDelegate(_delegate);
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   this->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
   this->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
+#else
+  this->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
+  this->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
+#endif
   this->resizeColumnsToContents();
   this->resizeRowsToContents();
   //this->verticalHeader()->hide();
index 1b758fe2c3eb7a5af0ce477d112365bf99568836..2892bbc357df02041f475f0b703b28d8a7ad2a99 100644 (file)
 
 IF(PARAVIEW_BUILD_QT_GUI)
    
+    INCLUDE(UseQtExt)
     # Custom object panel for the reader and 
     # custom display panel for line chart view
-    QT4_WRAP_UI(CLIENT_UI_SRCS
+    QT_WRAP_UIC(CLIENT_UI_SRCS
         Resources/UI/TableReaderPanel.ui
        Resources/UI/CustomXYChartDisplayPanel.ui
     )
 
-    QT4_WRAP_CPP(MOC_SRCS 
+    QT_WRAP_MOC(MOC_SRCS 
        pqTableReaderPanel.h
        pqTableTo3DPanel.h
        pqCustomChartDisplayPanelImplementation.h
index f7a1253304b21d78c20bebce8fdfcd44c5c7179f..68ee2e0aef75cb8b86993891e5f109359064e3cc 100755 (executable)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
+INCLUDE(UseQtExt)
+
 # create a plugin with a custom view that shows up in ParaView's multi-view
 # manager.  this plugin also contains a custom display panel
 
 # moc the Qt based .h files
-QT4_WRAP_CPP(MOC_SRCS MyView.h MyDisplay.h MyViewActiveOptions.h MyViewOptions.h)
+QT_WRAP_MOC(MOC_SRCS MyView.h MyDisplay.h MyViewActiveOptions.h MyViewOptions.h)
 
 # invoke macro to create sources for our custom view and display panel
 ADD_PARAVIEW_VIEW_MODULE(
index f8c18436b25544e0b6d3901857486175f4cb5ab9..9479e3fe2795f2005c62165840f4c108b8a9746b 100644 (file)
@@ -25,7 +25,12 @@ SET(CMAKE_BUILD_TYPE "Debug")
 OPTION(LIGHTPARAVIS_WITH_GUI "Build GUI test app" ON)
 
 # Package detection
-FIND_PACKAGE(Qt4 REQUIRED)
+IF (NOT SALOME_GUI_BUILD_WITH_QT5)
+  FIND_PACKAGE(Qt4 REQUIRED)
+ELSE()
+  FIND_PACKAGE(Qt5Core)
+  FIND_PACKAGE(Qt5Gui)
+ENDIF()
 LIST(APPEND CMAKE_PREFIX_PATH "$ENV{PARAVIEW_ROOT_DIR}")
 FIND_PACKAGE(ParaView REQUIRED)
 
index 295798519288524871b7697b56426c9b4b8c067f..91b5642796b21c1c755f82accf2506f71f18b8bc 100644 (file)
@@ -18,6 +18,8 @@
 #
 # Author: Adrien Bruneton (CEA)
 
+INCLUDE(UseQtExt)
+
 SET(pl_HEADERS
     PLMainWindow.hxx
     PLViewTab.hxx
@@ -47,7 +49,6 @@ SET(CMAKE_INCLUDE_CURRENT_DIR ON)
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
 INCLUDE_DIRECTORIES(${PARAVIEW_INCLUDE_DIRS})
 
-INCLUDE(${QT_USE_FILE})
 ADD_DEFINITIONS(${QT_DEFINITIONS})
 
 # Generate resources that will embedded 
@@ -59,11 +60,11 @@ GENERATE_QT_RESOURCE_FROM_FILES(
     "/LightPara/Configuration"
     "${PROJECT_SOURCE_DIR}/gui/xml/ParaViewReaders.xml")
 
-QT4_ADD_RESOURCES(rcs_sources
+QT_ADD_RESOURCES(rcs_sources
     ${ui_resources}
     )
-QT4_WRAP_UI(pl_FORMS_HEADERS ${pl_FORMS})
-QT4_WRAP_CPP(pl_HEADERS_MOC  ${pl_HEADERS})
+QT_WRAP_UIC(pl_FORMS_HEADERS ${pl_FORMS})
+QT_WRAP_MOC(pl_HEADERS_MOC  ${pl_HEADERS})
 
 ADD_EXECUTABLE(paraLight
     ${pl_SOURCES}