Salome HOME
Merge remote branch 'origin/V7_dev'
authorvsr <vsr@opencascade.com>
Fri, 25 Mar 2016 14:48:10 +0000 (17:48 +0300)
committervsr <vsr@opencascade.com>
Fri, 25 Mar 2016 14:48:10 +0000 (17:48 +0300)
105 files changed:
CMakeLists.txt
SalomeGUIConfig.cmake.in
adm_local/cmake_files/CMakeLists.txt
adm_local/cmake_files/FindPyQt5.cmake [new file with mode: 0644]
adm_local/cmake_files/FindSalomeParaView.cmake
adm_local/cmake_files/FindSalomePyQt5.cmake [new file with mode: 0644]
adm_local/cmake_files/FindSalomeQt5.cmake [new file with mode: 0644]
adm_local/cmake_files/UsePyQt.cmake [new file with mode: 0644]
adm_local/cmake_files/UsePyQt4.cmake [deleted file]
adm_local/cmake_files/UseQt4Ext.cmake [deleted file]
adm_local/cmake_files/UseQtExt.cmake [new file with mode: 0644]
src/CAF/CMakeLists.txt
src/CAM/CAM_Module.cxx
src/CAM/CAM_Module.h
src/CAM/CMakeLists.txt
src/DDS/CMakeLists.txt
src/GLViewer/CMakeLists.txt
src/GLViewer/GLViewer_BaseObjects.cxx
src/GLViewer/GLViewer_Drawer.cxx
src/GLViewer/GLViewer_ViewPort.cxx
src/GLViewer/GLViewer_Viewer.cxx
src/GLViewer/GLViewer_Viewer2d.cxx
src/GUI_PY/CMakeLists.txt
src/GUI_PY/dockwidgets.py
src/GUI_PY/genericdialog.py
src/GUI_PY/mytestdialog.py
src/GUI_PY/qtsalome.py.in [new file with mode: 0644]
src/GUI_PY/selectvars.py
src/GraphicsView/CMakeLists.txt
src/GuiHelpers/CMakeLists.txt
src/HelpBrowser/CMakeLists.txt
src/LightApp/CMakeLists.txt
src/LightApp/LightApp_Application.cxx
src/LightApp/resources/LightApp.xml
src/LightApp/resources/icon_about.png
src/LightApp/resources/icon_applogo.png
src/LogWindow/CMakeLists.txt
src/OCCViewer/CMakeLists.txt
src/OCCViewer/OCCViewer_ViewPort.cxx
src/OCCViewer/OCCViewer_ViewPort3d.cxx
src/OCCViewer/OCCViewer_ViewSketcher.cxx
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/ObjBrowser/CMakeLists.txt
src/PVViewer/CMakeLists.txt
src/Plot2d/CMakeLists.txt
src/PyConsole/CMakeLists.txt
src/PyEditor/CMakeLists.txt
src/PyInterp/CMakeLists.txt
src/PyViewer/CMakeLists.txt
src/QDS/CMakeLists.txt
src/Qtx/CMakeLists.txt
src/Qtx/QtxAction.cxx
src/Qtx/QtxAction.h
src/Qtx/QtxDialog.cxx
src/Qtx/QtxLogoMgr.cxx
src/Qtx/QtxPopupMgr.cxx
src/Qtx/QtxTranslator.cxx
src/Qtx/QtxTranslator.h
src/Qtx/QtxTreeView.cxx
src/Qtx/QtxWorkspaceAction.cxx
src/Qtx/QtxWorkstack.cxx
src/Qtx/QtxWorkstackAction.cxx
src/QxScene/CMakeLists.txt
src/SALOME_PYQT/SALOME_PYQT_GUI/CMakeLists.txt
src/SALOME_PYQT/SALOME_PYQT_GUILight/CMakeLists.txt
src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_GUILight.sip
src/SALOME_PYQT/SalomePyQt/CMakeLists.txt
src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip
src/SOCC/CMakeLists.txt
src/SPlot2d/CMakeLists.txt
src/STD/CMakeLists.txt
src/SUIT/CMakeLists.txt
src/SUIT/SUIT_ActionOperation.cxx
src/SUIT/SUIT_Application.cxx
src/SUIT/SUIT_Application.h
src/SUIT/SUIT_DataBrowser.cxx
src/SUIT/SUIT_FileDlg.cxx
src/SUIT/SUIT_TreeModel.cxx
src/SUITApp/CMakeLists.txt
src/SUITApp/SUITApp.cxx
src/SUITApp/SUITApp_Application.cxx
src/SUITApp/SUITApp_Application.h
src/SVTK/CMakeLists.txt
src/SVTK/SVTK_RenderWindowInteractor.cxx
src/SVTK/SVTK_RenderWindowInteractor.h
src/SVTK/SVTK_SpaceMouse.cxx
src/SVTK/SVTK_SpaceMouse.h
src/SalomeApp/CMakeLists.txt
src/SalomeApp/SalomeApp_ListView.cxx
src/SalomeApp/pluginsdemo/CMakeLists.txt
src/SalomeApp/pluginsdemo/minmax_plugin.py
src/SalomeApp/pluginsdemo/tubedialog.py
src/SalomeApp/pluginsdemo/tubedialog_ui.py
src/SalomeApp/salome_pluginsmanager.py
src/Session/SALOME_Session_Server.cxx
src/Style/CMakeLists.txt
src/Style/Style_Salome.cxx
src/Style/Style_Salome.h
src/TOOLSGUI/CMakeLists.txt
src/TreeData/CMakeLists.txt
src/TreeData/Test/CMakeLists.txt
src/VTKViewer/CMakeLists.txt
src/VTKViewer/VTKViewer_RenderWindow.cxx
src/ViewerTools/CMakeLists.txt
tools/dlgfactory/CMakeLists.txt

index 0f392c83534c0cecd83a03a55c2a2b93a4a10362..2e834cbe40502449c38c1c0e5a2e48f2ff4c5ad8 100755 (executable)
@@ -29,8 +29,8 @@ CMAKE_POLICY(SET CMP0003 NEW)
 # Project name, upper case
 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
 
-SET(${PROJECT_NAME_UC}_MAJOR_VERSION 7)
-SET(${PROJECT_NAME_UC}_MINOR_VERSION 7)
+SET(${PROJECT_NAME_UC}_MAJOR_VERSION 8)
+SET(${PROJECT_NAME_UC}_MINOR_VERSION 0)
 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
 SET(${PROJECT_NAME_UC}_VERSION
   ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
@@ -62,6 +62,7 @@ LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
 OPTION(SALOME_BUILD_DOC "Generate SALOME GUI documentation" ON)
 OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
 OPTION(SALOME_GUI_USE_OBSERVERS "Use study observers in GUI (advanced)" ON)
+OPTION(SALOME_BUILD_WITH_QT5 "Build SALOME with Qt 5" ON)
 
 # Advanced options:
 CMAKE_DEPENDENT_OPTION(SALOME_LIGHT_ONLY "Build SALOME Light only (no CORBA)" OFF
@@ -75,6 +76,7 @@ OPTION(SALOME_USE_PLOT2DVIEWER "Enable Plot2D visualization (Mandatory in classi
 OPTION(SALOME_USE_PYCONSOLE "Enable Python GUI interface (Mandatory in classic configurations)" ON)
 OPTION(SALOME_USE_QXGRAPHVIEWER "Enable QX graph visualization (Mandatory in classic configurations)" ON)
 OPTION(SALOME_USE_PVVIEWER "Enable ParaView visualization (Mandatory in classic configurations)" ON)
+
 CMAKE_DEPENDENT_OPTION(SALOME_USE_SALOMEOBJECT "Enable Salome Object (Mandatory in classic configurations)" ON
                        "SALOME_LIGHT_ONLY" ON)
 OPTION(SALOME_USE_SINGLE_DESKTOP "Enable multiple document interface" ON)
@@ -127,7 +129,7 @@ ENDIF()
 ## GUI specifics
 ##
 
-FIND_PACKAGE(SalomeSIP REQUIRED)  # should come after Python and before PyQt4
+FIND_PACKAGE(SalomeSIP REQUIRED)  # should come after Python and before PyQt
 
 # Build with GUI observers feature
 IF(SALOME_GUI_USE_OBSERVERS)
@@ -147,11 +149,22 @@ IF(SALOME_USE_OCCVIEWER OR SALOME_USE_VTKVIEWER OR SALOME_USE_GLVIEWER)
   FIND_PACKAGE(SalomeOpenGL REQUIRED)
 ENDIF()
 
-# Qt4
-FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtWebKit QtOpenGL QtNetwork)
+# Qt
+IF(NOT SALOME_BUILD_WITH_QT5)
+  FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtWebKit QtOpenGL QtNetwork)
+  ADD_DEFINITIONS("-DUSE_SALOME_STYLE")
+  SET(QT_SALOME_VERSION 4)
+ELSE()
+  FIND_PACKAGE(SalomeQt5 REQUIRED)
+  SET(QT_SALOME_VERSION 5)
+ENDIF()
 
-# PyQt4
-FIND_PACKAGE(SalomePyQt4 REQUIRED)
+# PyQt
+IF (NOT SALOME_BUILD_WITH_QT5)
+  FIND_PACKAGE(SalomePyQt4 REQUIRED)
+ELSE()
+  FIND_PACKAGE(SalomePyQt5 REQUIRED)
+ENDIF()
 
 # Optional packages for GUI and their pre-requisites
 
@@ -184,7 +197,7 @@ ENDIF()
 
 # - Plot2d viewer: Qwt
 IF(SALOME_USE_PLOT2DVIEWER)
-  FIND_PACKAGE(SalomeQwt)  
+  FIND_PACKAGE(SalomeQwt)
   SALOME_LOG_OPTIONAL_PACKAGE(Qwt SALOME_USE_PLOT2DVIEWER)
 ELSE()
   ADD_DEFINITIONS("-DDISABLE_PLOT2DVIEWER")
@@ -224,6 +237,7 @@ SALOME_PACKAGE_REPORT_AND_CHECK()
 # Directories
 # (default values taken from KERNEL)
 # ===========
+
 SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
 SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
@@ -373,7 +387,6 @@ IF(SALOME_USE_PVVIEWER)
   LIST(APPEND _${PROJECT_NAME}_exposed_targets PVViewer PVServerService)
 ENDIF()
 
-
 # Python-based packages specific targets:
 IF(SALOME_USE_PYCONSOLE)
   LIST(APPEND _${PROJECT_NAME}_exposed_targets 
@@ -405,8 +418,13 @@ EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
 # Ensure the variables are always defined for the configure:
 SET(KERNEL_ROOT_DIR "${KERNEL_ROOT_DIR}")
 SET(SIP_ROOT_DIR "${SIP_ROOT_DIR}")
-SET(QT4_ROOT_DIR "${QT4_ROOT_DIR}")
-SET(PYQT4_ROOT_DIR "${PYQT4_ROOT_DIR}")
+IF(NOT SALOME_BUILD_WITH_QT5)
+  SET(QT_ROOT_DIR "${QT4_ROOT_DIR}")
+  SET(PYQT_ROOT_DIR "${PYQT4_ROOT_DIR}")
+ELSE()
+  SET(QT_ROOT_DIR "${QT5_ROOT_DIR}")
+  SET(PYQT_ROOT_DIR "${PYQT5_ROOT_DIR}")
+ENDIF()
 SET(CAS_ROOT_DIR "${CAS_ROOT_DIR}")
 SET(OPENGL_ROOT_DIR "${OPENGL_ROOT_DIR}")
 SET(VTK_ROOT_DIR "${VTK_ROOT_DIR}")
@@ -415,13 +433,17 @@ SET(QWT_ROOT_DIR "${QWT_ROOT_DIR}")
 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
 
 # Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
-SALOME_CONFIGURE_PREPARE(CAS OpenGL PyQt4 Qt4 Qwt SIP VTK)
+IF(NOT SALOME_BUILD_WITH_QT5)
+  SALOME_CONFIGURE_PREPARE(CAS OpenGL Qt4 PyQt4 Qwt SIP VTK)
+ELSE()
+  SALOME_CONFIGURE_PREPARE(CAS OpenGL Qt5 PyQt5 Qwt SIP VTK)
+ENDIF()
 
 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in 
     ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
     INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
     PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
-       KERNEL_ROOT_DIR SIP_ROOT_DIR QT4_ROOT_DIR PYQT4_ROOT_DIR CAS_ROOT_DIR 
+       KERNEL_ROOT_DIR SIP_ROOT_DIR QT_ROOT_DIR PYQT_ROOT_DIR CAS_ROOT_DIR 
        OPENGL_ROOT_DIR VTK_ROOT_DIR QWT_ROOT_DIR)
 
 #   - in the install tree (VSR 16/08/2013: TEMPORARILY COMMENT THIS - TO REMOVE?):
@@ -432,7 +454,7 @@ CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
 #    ${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake
 #    INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
 #    PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX 
-#       KERNEL_ROOT_DIR SIP_ROOT_DIR QT4_ROOT_DIR PYQT4_ROOT_DIR CAS_ROOT_DIR 
+#       KERNEL_ROOT_DIR SIP_ROOT_DIR QT_ROOT_DIR PYQT_ROOT_DIR CAS_ROOT_DIR 
 #       OPENGL_ROOT_DIR VTK_ROOT_DIR QWT_ROOT_DIR)
 
 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
index 94483ffcf6d7a1e573e86902c8f228d57d2af249..0c9f163cd6700c7302ae58b3741c205a4865a2b4 100644 (file)
@@ -47,9 +47,10 @@ SET(GUI_DEFINITIONS "@KERNEL_DEFINITIONS@")
 #### Now the specificities
 
 # Options exported by the package:
-SET(SALOME_GUI_BUILD_DOC    @SALOME_BUILD_DOC@)
-SET(SALOME_GUI_BUILD_TESTS  @SALOME_BUILD_TESTS@)
-SET(SALOME_GUI_LIGHT_ONLY   @SALOME_LIGHT_ONLY@)
+SET(SALOME_GUI_BUILD_DOC      @SALOME_BUILD_DOC@)
+SET(SALOME_GUI_BUILD_TESTS    @SALOME_BUILD_TESTS@)
+SET(SALOME_GUI_LIGHT_ONLY     @SALOME_LIGHT_ONLY@)
+SET(SALOME_GUI_BUILD_WITH_QT5 @SALOME_BUILD_WITH_QT5@)
 
 # Advanced options
 SET(SALOME_USE_OCCVIEWER      @SALOME_USE_OCCVIEWER@)
@@ -109,8 +110,13 @@ ENDIF()
 # Level 1 prerequisites:
 SET_AND_CHECK(KERNEL_ROOT_DIR_EXP "@PACKAGE_KERNEL_ROOT_DIR@")
 SET_AND_CHECK(SIP_ROOT_DIR_EXP "@PACKAGE_SIP_ROOT_DIR@")
-SET_AND_CHECK(QT4_ROOT_DIR_EXP "@PACKAGE_QT4_ROOT_DIR@")
-SET_AND_CHECK(PYQT4_ROOT_DIR_EXP "@PACKAGE_PYQT4_ROOT_DIR@")
+IF(NOT SALOME_GUI_BUILD_WITH_QT5)
+  SET_AND_CHECK(QT4_ROOT_DIR_EXP "@PACKAGE_QT_ROOT_DIR@")
+  SET_AND_CHECK(PYQT4_ROOT_DIR_EXP "@PACKAGE_PYQT_ROOT_DIR@")
+ELSE()
+  SET_AND_CHECK(QT5_ROOT_DIR_EXP "@PACKAGE_QT_ROOT_DIR@")
+  SET_AND_CHECK(PYQT5_ROOT_DIR_EXP "@PACKAGE_PYQT_ROOT_DIR@")
+ENDIF()
 SET_AND_CHECK(CAS_ROOT_DIR_EXP "@PACKAGE_CAS_ROOT_DIR@")    
 
 # Optional level 1 prerequisites:
index b2d13572faaafde177a099e64a087143ed5ad793..074731f7c9dc807d3dab709e8796924b349de09f 100755 (executable)
@@ -29,15 +29,18 @@ SET(_adm_data
   FindGUI.cmake
   FindSIP.cmake
   FindPyQt4.cmake
+  FindPyQt5.cmake
   FindSalomePyQt4.cmake
+  FindSalomePyQt5.cmake
   FindSalomeQt4.cmake
+  FindSalomeQt5.cmake
   FindSalomeQwt.cmake
   FindSalomeSIP.cmake
   FindSalomeGUI.cmake
   FindSalomeOpenGL.cmake
   FindSalomeParaView.cmake
   UseSIP.cmake
-  UsePyQt4.cmake
-  UseQt4Ext.cmake
+  UsePyQt.cmake
+  UseQtExt.cmake
 )
 INSTALL(FILES ${_adm_data} DESTINATION ${SALOME_INSTALL_CMAKE_LOCAL})
diff --git a/adm_local/cmake_files/FindPyQt5.cmake b/adm_local/cmake_files/FindPyQt5.cmake
new file mode 100644 (file)
index 0000000..b72c418
--- /dev/null
@@ -0,0 +1,97 @@
+# Copyright (C) 2013-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+# - Find PyQt5 installation
+# Sets the following variables:
+#    PYQT_PYUIC_EXECUTABLE  - path to the pyuic executable
+#    PYQT_PYRCC_EXECUTABLE  - path to the pyrcc executable
+#    PYQT_PYUIC_PATH        - command to launch pyuic with the correct PYTHONPATH
+#    PYQT_PYRCC_PATH        - command to launch pyrcc with the correct PYTHONPATH
+#    PYQT_PYTHONPATH        - path to the PyQt Python modules
+#    PYQT_SIPS_DIR          - path to main include directory (which contains several sub folders)
+#    PYQT_SIPFLAGS          - compilation flags extracted from PyQt
+#
+#  The executables
+#      pyuic5 (pyuic5.bat)
+#  are searched.
+#  The Python command 
+#      pyqtconfig.Configuration().pyqt_sip_flags
+#  is called to get the compilation flags.
+#  Headers are located by looking for the header file
+#      qobject.sip
+
+IF(NOT PyQt5_FIND_QUIETLY)
+  MESSAGE(STATUS "Looking for PyQt5 ...")
+ENDIF()
+
+IF(NOT SIP_FOUND AND NOT PyQt5_FIND_QUIETLY)
+   MESSAGE(WARNING "PyQt5 needs SIP to be detected correctly!")
+ENDIF()
+
+FIND_PROGRAM(PYQT_PYUIC_EXECUTABLE NAMES pyuic5 pyuic5.bat)
+FIND_PROGRAM(PYQT_PYRCC_EXECUTABLE NAMES pyrcc5 pyrcc5.bat)
+
+# Get root dir locally, going up two levels from the exec:
+GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${PYQT_PYUIC_EXECUTABLE}" PATH)
+GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH)
+
+
+# Typical locations of qobject.sip are: 
+#   - /usr/share/sip/PyQt5/QtCore, for a system install
+#   - or <xyz>/sip/QtCore, for a custom install
+#   - or <xyz>/share/sip/QtCore, for a custom install
+FIND_FILE(PYQT_SIP_MAIN_FILE qobject.sip PATH_SUFFIXES share/sip/QtCore sip/QtCore share/sip/PyQt5/QtCore)
+
+IF(PYQT_SIP_MAIN_FILE)
+  GET_FILENAME_COMPONENT(PYQT_SIPS_DIR "${PYQT_SIP_MAIN_FILE}" PATH)
+  GET_FILENAME_COMPONENT(PYQT_SIPS_DIR "${PYQT_SIPS_DIR}" PATH)
+ENDIF()
+MARK_AS_ADVANCED(PYQT_SIP_MAIN_FILE)
+
+# Get PyQt compilation flags:
+SET(PYQT_PYTHONPATH ${_tmp_ROOT_DIR}/PyQt5)
+SET(PYQT_SIPFLAGS)
+
+EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import sys; 
+sys.path[:0] = '${PYQT_PYTHONPATH}'.split(';');
+sys.path[:0] = '${SIP_PYTHONPATH}'.split(';');
+from PyQt5.QtCore import PYQT_CONFIGURATION;
+sys.stdout.write(PYQT_CONFIGURATION['sip_flags'])"
+  OUTPUT_VARIABLE PYQT_SIPFLAGS)
+SEPARATE_ARGUMENTS(PYQT_SIPFLAGS)
+
+SET(PYQT_SIPFLAGS ${PYQT_SIPFLAGS} -I "${PYQT_SIPS_DIR}")
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PyQt5 REQUIRED_VARS PYQT_PYUIC_EXECUTABLE PYQT_PYRCC_EXECUTABLE PYQT_SIPS_DIR PYQT_SIPFLAGS )
+
+# Wrap the final executables so that they always use the proper environment (PYTHONPATH):
+# The results are put to variables:
+#   PYQT_PYUIC_PATH - command to launch pyuic with the correct PYTHONPATH
+#   PYQT_PYRCC_PATH - command to launch pyrcc with the correct PYTHONPATH
+# TODO: should be done like Sphinx in KERNEL (i.e. generating a shell script)?
+
+IF(WIN32 AND NOT CYGWIN)
+  SET(PYQT_PYUIC_PATH set PYTHONPATH=${PYQT_PYTHONPATH};${SIP_PYTHONPATH};%PYTHONPATH% && ${PYQT_PYUIC_EXECUTABLE})
+  SET(PYQT_PYRCC_PATH set PYTHONPATH=${PYQT_PYTHONPATH};${SIP_PYTHONPATH};%PYTHONPATH% && ${PYQT_PYRCC_EXECUTABLE})
+ELSE()
+  STRING(REPLACE ";" ":" PYQT_PYTHONPATH "${PYQT_PYTHONPATH}")
+  SET(PYQT_PYUIC_PATH /usr/bin/env PYTHONPATH="${PYQT_PYTHONPATH}:${SIP_PYTHONPATH}:$$PYTHONPATH" ${PYQT_PYUIC_EXECUTABLE})
+  SET(PYQT_PYRCC_PATH /usr/bin/env PYTHONPATH="${PYQT_PYTHONPATH}:${SIP_PYTHONPATH}:$$PYTHONPATH" ${PYQT_PYRCC_EXECUTABLE})
+ENDIF()
index 13bae1007f18c5a372ea7aa18e493ef044a59ff8..db4043783183d198b45703d45ebdbdadf12c70f5 100644 (file)
@@ -28,6 +28,12 @@ IF(NOT QT_VERSION)
   MESSAGE(FATAL_ERROR "Detection of ParaView requires Qt to be detected first!")
 ENDIF()
 
+IF (QT_VERSION VERSION_LESS "5.0")
+  SET(PARAVIEW_QT_VERSION "4")
+ELSE()
+  SET(PARAVIEW_QT_VERSION "5")
+ENDIF()
+
 SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(ParaView PARAVIEW_USE_FILE 4)
 
 INCLUDE(${PARAVIEW_USE_FILE})
diff --git a/adm_local/cmake_files/FindSalomePyQt5.cmake b/adm_local/cmake_files/FindSalomePyQt5.cmake
new file mode 100644 (file)
index 0000000..22598cc
--- /dev/null
@@ -0,0 +1,37 @@
+# Copyright (C) 2013-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# Author: Adrien Bruneton
+#
+
+# PyQt5 detection for Salome
+#
+#  !! Please read the generic detection procedure in SalomeMacros.cmake !!
+#
+
+# PyQt needs SIP, call it automatically
+FIND_PACKAGE(SalomeSIP REQUIRED)
+
+SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(PyQt5 PYQT_PYUIC_EXECUTABLE 2)
+MARK_AS_ADVANCED(PYQT_PYUIC_EXECUTABLE PYQT_PYRCC_EXECUTABLE PYQT_SIPS_DIR PYQT_PYUIC_PATH PYQT_PYRCC_PATH)
+
+IF(PYQT5_FOUND) 
+  SALOME_ACCUMULATE_ENVIRONMENT(PATH ${PYQT_PYUIC_EXECUTABLE})
+  SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${PYQT_PYTHONPATH})
+  SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH ${PYQT_PYTHONPATH})
+ENDIF()
diff --git a/adm_local/cmake_files/FindSalomeQt5.cmake b/adm_local/cmake_files/FindSalomeQt5.cmake
new file mode 100644 (file)
index 0000000..31168f3
--- /dev/null
@@ -0,0 +1,72 @@
+# Copyright (C) 2013-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# Author: Adrien Bruneton
+#
+
+# Qt5 detection for Salome
+#
+#  !! Please read the generic detection procedure in SalomeMacros.cmake !!
+#
+
+# Qt5_FIND_COMPONENTS variable is set here to prevent ParaView to reset list of Qt5 modules,
+# just to avoid extra dependencies
+SET(Qt5_FIND_COMPONENTS Core Gui Widgets Network Xml OpenGL PrintSupport WebKit WebKitWidgets Help Test Sql Sensors Positioning Quick Qml Multimedia MultimediaWidgets WebChannel UiTools)
+
+IF(NOT WIN32)
+  LIST(APPEND Qt5_FIND_COMPONENTS X11Extras)
+ENDIF()
+
+SET(QT_INCLUDES)
+SET(QT_DEFINITIONS)
+SET(QT_LIBRARIES)
+
+FOREACH(_Qt5_COMPONENT ${Qt5_FIND_COMPONENTS})
+  SET(_Qt5_COMPONENT Qt5${_Qt5_COMPONENT})
+  SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(${_Qt5_COMPONENT} ${_Qt5_COMPONENT}_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR)
+  LIST(APPEND QT_INCLUDES    ${${_Qt5_COMPONENT}_INCLUDE_DIRS})
+  LIST(APPEND QT_DEFINITIONS ${${_Qt5_COMPONENT}_DEFINITIONS})
+  LIST(APPEND QT_LIBRARIES   ${${_Qt5_COMPONENT}_LIBRARIES})
+ENDFOREACH()
+
+FIND_PACKAGE(Qt5LinguistTools)
+GET_TARGET_PROPERTY(QT_LRELEASE_EXECUTABLE Qt5::lrelease LOCATION)
+MARK_AS_ADVANCED(QT_LRELEASE_EXECUTABLE)
+
+GET_FILENAME_COMPONENT(QT_BINARY_DIR ${QT_LRELEASE_EXECUTABLE} DIRECTORY)
+MARK_AS_ADVANCED(QT_BINARY_DIR)
+
+# This is only needed to correctly detect Qt help generator tool, to workaround an error 
+# coming from ParaView detection procedure
+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(Qt5Core_FOUND) 
+  SALOME_ACCUMULATE_HEADERS(QT_INCLUDES)
+  SALOME_ACCUMULATE_ENVIRONMENT(PATH ${LINGUIST_PATH})
+  SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${Qt5Core_LIBRARIES})
+  SET(QT_VERSION "${Qt5Core_VERSION}")
+  GET_FILENAME_COMPONENT(Qt5_DIR ${Qt5Core_DIR} PATH)
+  FILE(TO_NATIVE_PATH "${Qt5_DIR}/Qt5" Qt5_DIR)
+  SET(SalomeQt5_COMPONENTS ${Qt5_FIND_COMPONENTS})
+  MESSAGE(STATUS "Qt version is ${QT_VERSION}")
+ENDIF()
diff --git a/adm_local/cmake_files/UsePyQt.cmake b/adm_local/cmake_files/UsePyQt.cmake
new file mode 100644 (file)
index 0000000..1c07ecd
--- /dev/null
@@ -0,0 +1,161 @@
+# Copyright (C) 2012-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# Author: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+INCLUDE(UseSIP)
+
+####################################################################
+#
+# _PYQT_WRAP_GET_UNIQUE_TARGET_NAME: internal function
+# 
+# Used to generate unique custom target name for usage in
+# PYQT_WRAP_UIC macro.
+#
+# USAGE: _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(prefix unique_name)
+#
+# ARGUMENTS:
+#   prefix [in] prefix for the name
+#   unique_name [out] unique name generated by function
+#
+####################################################################
+FUNCTION(_PYQT_WRAP_GET_UNIQUE_TARGET_NAME name unique_name)
+   SET(_propertyName "_PYQT_WRAP_UNIQUE_COUNTER_${name}")
+   GET_PROPERTY(_currentCounter GLOBAL PROPERTY "${_propertyName}")
+   IF(NOT _currentCounter)
+      SET(_currentCounter 1)
+   ENDIF()
+   SET(${unique_name} "${name}_${_currentCounter}" PARENT_SCOPE)
+   MATH(EXPR _currentCounter "${_currentCounter} + 1")
+   SET_PROPERTY(GLOBAL PROPERTY ${_propertyName} ${_currentCounter} )
+ENDFUNCTION()
+
+####################################################################
+#
+# PYQT_WRAP_UIC macro
+#
+# Create Python modules by processing input *.ui (Qt designer) files with
+# PyQt pyuic tool.
+#
+# USAGE: PYQT_WRAP_UIC(output_files pyuic_files)
+#
+# ARGUMENTS:
+#   output_files [out] variable where output file names are listed to
+#   pyuic_files  [in]  list of *.ui files
+# 
+# NOTES:
+#   - Input files are considered relative to the current source directory.
+#   - Output files are generated in the current build directory.
+#   - Macro automatically adds custom build target to generate output files
+# 
+####################################################################
+MACRO(PYQT_WRAP_UIC outfiles)
+
+ IF(NOT WIN32)
+
+  FOREACH(_input ${ARGN})
+    GET_FILENAME_COMPONENT(_input_name ${_input} NAME)
+    STRING(REPLACE ".ui" "_ui.py" _input_name ${_input_name})
+    SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name})
+    ADD_CUSTOM_COMMAND(
+      OUTPUT ${_output}
+      COMMAND ${PYQT_PYUIC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
+      MAIN_DEPENDENCY ${_input}
+      )
+    SET(${outfiles} ${${outfiles}} ${_output})
+  ENDFOREACH()
+  _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _uniqueTargetName)
+  ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL DEPENDS ${${outfiles}})
+
+ ELSE(NOT WIN32)
+
+####
+# ANA: Workaround for the Microsoft Visual Studio 2010. Seems there is a bug in 
+# the Microsoft Visual Studio 2010 or CMake 2.8.10.2: custom target doesn't work 
+# for the list of the dependencies. It works only for the first dependency in the 
+# list. So generate separate target for the each input file. This problem will be 
+#investigated in the future.
+####
+
+  SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
+  _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _uniqueTargetName)
+  ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL)
+  FOREACH(_input ${ARGN})
+    GET_FILENAME_COMPONENT(_input_name ${_input} NAME)
+    STRING(REPLACE ".ui" "_ui.py" _input_name ${_input_name})
+    SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name})
+    _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _TgName)
+    ADD_CUSTOM_TARGET(${_TgName} ${PYQT_PYUIC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
+      DEPENDS ${_input}
+      )
+    SET_TARGET_PROPERTIES(${_TgName} PROPERTIES FOLDER PYQT_WRAP_UIC_TARGETS)
+    ADD_DEPENDENCIES(${_uniqueTargetName} DEPEND ${_TgName})
+    SET(${outfiles} ${${outfiles}} ${_output})
+  ENDFOREACH()
+ ENDIF(NOT WIN32)
+ENDMACRO(PYQT_WRAP_UIC)
+
+####################################################################
+#
+# PYQT_WRAP_SIP macro
+#
+# Generate C++ wrappings for *.sip files by processing them with sip.
+#
+# USAGE: PYQT_WRAP_SIP(output_files sip_file [sip_file...] [OPTIONS options] [SOURCES sources])
+#
+# NOTES: See SIP_WRAP_SIP macro from UseSIP.cmake for the usage description.
+# 
+####################################################################
+MACRO(PYQT_WRAP_SIP outfiles)
+  SIP_WRAP_SIP(${outfiles} ${ARGN} OPTIONS ${PYQT_SIPFLAGS})
+ENDMACRO(PYQT_WRAP_SIP)
+
+####################################################################
+#
+# PYQT_WRAP_QRC macro
+#
+# Generate Python wrappings for *.qrc files by processing them with pyrcc5.
+#
+# USAGE: PYQT_WRAP_QRC(output_files qrc_files)
+#
+# ARGUMENTS:
+#   output_files [out] variable where output file names are listed to
+#   qrc_files  [in]  list of *.qrc files
+# 
+# NOTES:
+#   - Input files are considered relative to the current source directory.
+#   - Output files are generated in the current build directory.
+#   - Macro automatically adds custom build target to generate output files
+# 
+####################################################################
+
+MACRO(PYQT_WRAP_QRC outfiles)
+  FOREACH(_input ${ARGN})
+    GET_FILENAME_COMPONENT(_input_name ${_input} NAME)
+    STRING(REPLACE ".qrc" "_qrc.py" _input_name ${_input_name})
+    SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name})
+    ADD_CUSTOM_COMMAND(
+      OUTPUT ${_output}
+      COMMAND ${PYQT_PYRCC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
+      MAIN_DEPENDENCY ${_input}
+      )
+    SET(${outfiles} ${${outfiles}} ${_output})
+  ENDFOREACH()
+  _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_QRC_PY_FILES _uniqueTargetName)
+  ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL DEPENDS ${${outfiles}})
+ENDMACRO(PYQT_WRAP_QRC)
diff --git a/adm_local/cmake_files/UsePyQt4.cmake b/adm_local/cmake_files/UsePyQt4.cmake
deleted file mode 100644 (file)
index 694dfb1..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-# Copyright (C) 2012-2016  CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-# Author: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
-
-INCLUDE(UseSIP)
-
-####################################################################
-#
-# _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME: internal function
-# 
-# Used to generate unique custom target name for usage in
-# PYQT4_WRAP_UIC macro.
-#
-# USAGE: _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(prefix unique_name)
-#
-# ARGUMENTS:
-#   prefix [in] prefix for the name
-#   unique_name [out] unique name generated by function
-#
-####################################################################
-FUNCTION(_PYQT4_WRAP_GET_UNIQUE_TARGET_NAME name unique_name)
-   SET(_propertyName "_PYQT4_WRAP_UNIQUE_COUNTER_${name}")
-   GET_PROPERTY(_currentCounter GLOBAL PROPERTY "${_propertyName}")
-   IF(NOT _currentCounter)
-      SET(_currentCounter 1)
-   ENDIF()
-   SET(${unique_name} "${name}_${_currentCounter}" PARENT_SCOPE)
-   MATH(EXPR _currentCounter "${_currentCounter} + 1")
-   SET_PROPERTY(GLOBAL PROPERTY ${_propertyName} ${_currentCounter} )
-ENDFUNCTION()
-
-####################################################################
-#
-# PYQT4_WRAP_UIC macro
-#
-# Create Python modules by processing input *.ui (Qt designer) files with
-# PyQt4 pyuic4 tool.
-#
-# USAGE: PYQT4_WRAP_UIC(output_files pyuic_files)
-#
-# ARGUMENTS:
-#   output_files [out] variable where output file names are listed to
-#   pyuic_files  [in]  list of *.ui files
-# 
-# NOTES:
-#   - Input files are considered relative to the current source directory.
-#   - Output files are generated in the current build directory.
-#   - Macro automatically adds custom build target to generate output files
-# 
-####################################################################
-MACRO(PYQT4_WRAP_UIC outfiles)
-
- IF(NOT WIN32)
-
-  FOREACH(_input ${ARGN})
-    GET_FILENAME_COMPONENT(_input_name ${_input} NAME)
-    STRING(REPLACE ".ui" "_ui.py" _input_name ${_input_name})
-    SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name})
-    ADD_CUSTOM_COMMAND(
-      OUTPUT ${_output}
-      COMMAND ${PYQT_PYUIC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
-      MAIN_DEPENDENCY ${_input}
-      )
-    SET(${outfiles} ${${outfiles}} ${_output})
-  ENDFOREACH()
-  _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _uniqueTargetName)
-  ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL DEPENDS ${${outfiles}})
-
- ELSE(NOT WIN32)
-
-####
-# ANA: Workaround for the Microsoft Visual Studio 2010. Seems there is a bug in 
-# the Microsoft Visual Studio 2010 or CMake 2.8.10.2: custom target doesn't work 
-# for the list of the dependencies. It works only for the first dependency in the 
-# list. So generate separate target for the each input file. This problem will be 
-#investigated in the future.
-####
-
-  SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
-  _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _uniqueTargetName)
-  ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL)
-  FOREACH(_input ${ARGN})
-    GET_FILENAME_COMPONENT(_input_name ${_input} NAME)
-    STRING(REPLACE ".ui" "_ui.py" _input_name ${_input_name})
-    SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name})
-    _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _TgName)
-    ADD_CUSTOM_TARGET(${_TgName} ${PYQT_PYUIC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
-      DEPENDS ${_input}
-      )
-    SET_TARGET_PROPERTIES(${_TgName} PROPERTIES FOLDER PYQT4_WRAP_UIC_TARGETS)
-    ADD_DEPENDENCIES(${_uniqueTargetName} DEPEND ${_TgName})
-    SET(${outfiles} ${${outfiles}} ${_output})
-  ENDFOREACH()
- ENDIF(NOT WIN32)
-ENDMACRO(PYQT4_WRAP_UIC)
-
-####################################################################
-#
-# PYQT4_WRAP_SIP macro
-#
-# Generate C++ wrappings for *.sip files by processing them with sip.
-#
-# USAGE: PYQT4_WRAP_SIP(output_files sip_file [sip_file...] [OPTIONS options] [SOURCES sources])
-#
-# NOTES: See SIP_WRAP_SIP macro from UseSIP.cmake for the usage description.
-# 
-####################################################################
-MACRO(PYQT4_WRAP_SIP outfiles)
-  SIP_WRAP_SIP(${outfiles} ${ARGN} OPTIONS ${PYQT_SIPFLAGS})
-ENDMACRO(PYQT4_WRAP_SIP)
-
-####################################################################
-#
-# PYQT4_WRAP_QRC macro
-#
-# Generate Python wrappings for *.qrc files by processing them with pyrcc4.
-#
-# USAGE: PYQT4_WRAP_QRC(output_files qrc_files)
-#
-# ARGUMENTS:
-#   output_files [out] variable where output file names are listed to
-#   qrc_files  [in]  list of *.qrc files
-# 
-# NOTES:
-#   - Input files are considered relative to the current source directory.
-#   - Output files are generated in the current build directory.
-#   - Macro automatically adds custom build target to generate output files
-# 
-####################################################################
-
-MACRO(PYQT4_WRAP_QRC outfiles)
-  FOREACH(_input ${ARGN})
-    GET_FILENAME_COMPONENT(_input_name ${_input} NAME)
-    STRING(REPLACE ".qrc" "_qrc.py" _input_name ${_input_name})
-    SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name})
-    ADD_CUSTOM_COMMAND(
-      OUTPUT ${_output}
-      COMMAND ${PYQT_PYRCC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
-      MAIN_DEPENDENCY ${_input}
-      )
-    SET(${outfiles} ${${outfiles}} ${_output})
-  ENDFOREACH()
-  _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_QRC_PY_FILES _uniqueTargetName)
-  ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL DEPENDS ${${outfiles}})
-ENDMACRO(PYQT4_WRAP_QRC)
diff --git a/adm_local/cmake_files/UseQt4Ext.cmake b/adm_local/cmake_files/UseQt4Ext.cmake
deleted file mode 100644 (file)
index 9567779..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-INCLUDE(${QT_USE_FILE})
-
-INSTALL(CODE "MACRO(QT4_COMPILE_TS_ON_INSTALL MYLRELEASE MYTSFILE MYFULLDIR MYOUTQMFILE)
-  FILE(MAKE_DIRECTORY \${MYFULLDIR})
-  MESSAGE(STATUS \"Compiling \${MYTSFILE}\")
-  EXECUTE_PROCESS(COMMAND \${MYLRELEASE} \${MYTSFILE} -qm \${MYFULLDIR}/\${MYOUTQMFILE})
-ENDMACRO(QT4_COMPILE_TS_ON_INSTALL)")
-
-# This MACRO uses the following vars
-# - QT_LRELEASE_EXECUTABLE : (given by default by FindQT.cmake)
-#
-# MYTSFILES containing all ts files to be compiled.
-# WHERETOINSTALL contains directory (relative to install_prefix) where to install files after compilation of ts files too qm.
-MACRO(QT4_INSTALL_TS_RESOURCES MYTSFILES WHERETOINSTALL)
-  INSTALL(CODE "SET(INSTALL_TS_DIR ${WHERETOINSTALL})")
-  SET(MYSOURCES)
-  FOREACH(input ${MYTSFILES})
-    GET_FILENAME_COMPONENT(input2 ${input} NAME)
-    STRING(REGEX REPLACE ".ts" "" base ${input2})
-    SET(output "${base}.qm")
-    INSTALL(CODE "QT4_COMPILE_TS_ON_INSTALL( \"${QT_LRELEASE_EXECUTABLE}\" \"${CMAKE_CURRENT_SOURCE_DIR}/${input}\" \"${CMAKE_INSTALL_PREFIX}/\${INSTALL_TS_DIR}\" ${output})")
-  ENDFOREACH(input ${MYIDLFILES})
-ENDMACRO(QT4_INSTALL_TS_RESOURCES)
diff --git a/adm_local/cmake_files/UseQtExt.cmake b/adm_local/cmake_files/UseQtExt.cmake
new file mode 100644 (file)
index 0000000..95985b7
--- /dev/null
@@ -0,0 +1,68 @@
+# Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+IF (QT_VERSION VERSION_LESS "5.0")
+  INCLUDE(${QT_USE_FILE})
+ENDIF()
+
+INSTALL(CODE "MACRO(QT_COMPILE_TS_ON_INSTALL MYLRELEASE MYTSFILE MYFULLDIR MYOUTQMFILE)
+  FILE(MAKE_DIRECTORY \${MYFULLDIR})
+  MESSAGE(STATUS \"Compiling \${MYTSFILE}\")
+  EXECUTE_PROCESS(COMMAND \${MYLRELEASE} \${MYTSFILE} -qm \${MYFULLDIR}/\${MYOUTQMFILE})
+ENDMACRO(QT_COMPILE_TS_ON_INSTALL)")
+
+# This MACRO uses the following vars
+# - QT_LRELEASE_EXECUTABLE : (given by default by FindQT.cmake)
+#
+# MYTSFILES containing all ts files to be compiled.
+# WHERETOINSTALL contains directory (relative to install_prefix) where to install files after compilation of ts files too qm.
+MACRO(QT_INSTALL_TS_RESOURCES MYTSFILES WHERETOINSTALL)
+  INSTALL(CODE "SET(INSTALL_TS_DIR ${WHERETOINSTALL})")
+  SET(MYSOURCES)
+  FOREACH(input ${MYTSFILES})
+    GET_FILENAME_COMPONENT(input2 ${input} NAME)
+    STRING(REGEX REPLACE ".ts" "" base ${input2})
+    SET(output "${base}.qm")
+    INSTALL(CODE "QT_COMPILE_TS_ON_INSTALL( \"${QT_LRELEASE_EXECUTABLE}\" \"${CMAKE_CURRENT_SOURCE_DIR}/${input}\" \"${CMAKE_INSTALL_PREFIX}/\${INSTALL_TS_DIR}\" ${output})")
+  ENDFOREACH(input ${MYIDLFILES})
+ENDMACRO(QT_INSTALL_TS_RESOURCES)
+
+MACRO(QT_WRAP_MOC)
+IF (QT_VERSION VERSION_LESS "5.0")
+  QT4_WRAP_CPP(${ARGN})
+ELSE()
+  QT5_WRAP_CPP(${ARGN})
+ENDIF()
+ENDMACRO(QT_WRAP_MOC)
+
+MACRO(QT_WRAP_UIC)
+IF (QT_VERSION VERSION_LESS "5.0")
+  QT4_WRAP_UI(${ARGN})
+ELSE()
+  QT5_WRAP_UI(${ARGN})
+ENDIF()
+ENDMACRO(QT_WRAP_UIC)
+
+MACRO(QT_ADD_RESOURCES)
+IF (QT_VERSION VERSION_LESS "5.0")
+  QT4_ADD_RESOURCES(${ARGN})
+ELSE()
+  QT5_ADD_RESOURCES(${ARGN})
+ENDIF()
+ENDMACRO(QT_ADD_RESOURCES)
index 29b844282aa37a2c26f02e4bf560f72dc8c01926..6872baf2c384acf7c3b62cece07a63a5c1da6431 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -66,7 +66,7 @@ SET(_ts_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
@@ -86,4 +86,4 @@ TARGET_LINK_LIBRARIES(caf ${QT_LIBRARIES} ${_link_LIBRARIES})
 INSTALL(TARGETS caf EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${caf_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
index ce41df95ae454251e3ec0e719cf45fceac22c7cd..6a8e49f3628e2d33e76c4d7c649c7ad2d534792a 100755 (executable)
@@ -940,6 +940,33 @@ QAction* CAM_Module::createAction( const int id, const QString& text, const QIco
                                    const QString& menu, const QString& tip, const int key,
                                    QObject* parent, const bool toggle, QObject* reciever,
                                   const char* member, const QString& shortcutAction )
+{
+  return createAction( id, text, icon, menu, tip, QKeySequence(key), parent, toggle, reciever, member, shortcutAction );
+}
+
+/*!
+  \brief Create new instance of QtxAction and register action with specified \a id.
+
+  Resulting action ID may differ from the requested one. This can happen if
+  requested ID is already in use.
+
+  If \a id < 0, the action ID is generated automatically.
+
+  \param id required action ID
+  \param text tooltip text
+  \param icon action icon
+  \param menu menu text
+  \param tip status bar tip
+  \param key keyboard accelerator
+  \param parent parent object
+  \param toggle if \c true, the action will be toggled
+  \param reciever action activation signal receiver object
+  \param member action activation signal receiver slot
+*/
+QAction* CAM_Module::createAction( const int id, const QString& text, const QIcon& icon,
+                                   const QString& menu, const QString& tip, const QKeySequence& key,
+                                   QObject* parent, const bool toggle, QObject* reciever,
+                                  const char* member, const QString& shortcutAction )
 {
   QtxAction* a = new QtxAction( text, icon, menu, key, parent, toggle, shortcutAction );
   a->setStatusTip( tip );
index 9f1f4568a6c6aa49dcd5df3ec2a14219dec69fbd..bc96dc908617f9cc695a106239584c5e44a1d020 100755 (executable)
@@ -99,6 +99,9 @@ public:
   virtual QAction*       createAction( const int, const QString&, const QIcon&, const QString&,
                                        const QString&, const int, QObject* = 0,
                                        const bool = false, QObject* = 0, const char* = 0, const QString& = QString() );
+  virtual QAction*       createAction( const int, const QString&, const QIcon&, const QString&,
+                                       const QString&, const QKeySequence&, QObject* = 0,
+                                       const bool = false, QObject* = 0, const char* = 0, const QString& = QString() );
   QtxActionGroup*        createActionGroup( const int, const bool = true );
 
   int                    createTool( const QString&, const QString& = QString() );
index bb2f139a4f8d73e66623265f5d43880789a430d5..206f88e45a3e686e2f39178f56f34281cc0f9e1d 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -67,7 +67,7 @@ SET(_ts_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
@@ -88,4 +88,4 @@ TARGET_LINK_LIBRARIES(CAM ${_link_LIBRARIES})
 INSTALL(TARGETS CAM EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${CAM_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
index b8ba37ceb42f8f04a1b99b42d5067dd37f7590ff..e41b124b811b8c294436de9adb9da8cf1e51b6be 100755 (executable)
@@ -61,4 +61,3 @@ TARGET_LINK_LIBRARIES(DDS ${_link_LIBRARIES})
 INSTALL(TARGETS DDS EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${DDS_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-
index 490302aa02f6e0efc747c29c8630a456e9681b5d..2198d7eb45e4e3593c9dca30063452f161d95a54 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -104,7 +104,7 @@ SET(_other_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
@@ -144,6 +144,6 @@ TARGET_LINK_LIBRARIES(GLViewer ${_link_LIBRARIES})
 INSTALL(TARGETS GLViewer EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${GLViewer_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
 
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
 INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
index b6b121fb0fa903f09a639181a9265a7e6019cb1c..0a45bb38a9a07905640c1a984f86fa822abe6425 100644 (file)
@@ -1438,7 +1438,6 @@ bool GLViewer_TextObject::translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerC
            y = double( yPos );
 
     aViewerCS->transform( *aEMFCS, x, y );
-    const char* str = aText.toLatin1();
 
     int nHeight = 35*14;       // height of font
     int nWidth = 35*12;        // average character width
@@ -1467,7 +1466,7 @@ bool GLViewer_TextObject::translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerC
     HGDIOBJ old1 = SelectObject( dc, aFont );
     HGDIOBJ old2 = SelectObject( dc, aBrush );
 
-    TextOut( dc, x, y, str, aText.length() );
+    TextOut( dc, x, y, aText.toLatin1().constData(), aText.length() );
 
     SelectObject ( dc, old1 );
     SelectObject ( dc, old2 );
index 4fc3e70588b12f26121bc0499b3e6680da747a38..089d8a8109c809a48852c99747aa7a12feb2b5c7 100644 (file)
@@ -398,7 +398,9 @@ static GLuint displayListBase( QFont* theFont )
     listBase += 256;
 
     HDC glHdc = ::wglGetCurrentDC();
+ #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     ::SelectObject( glHdc, theFont->handle() );
+ #endif
     if ( !::wglUseFontBitmaps( glHdc, 0, 256, listBase ) )
       listBase = 0;
     aList = listBase;
@@ -442,8 +444,11 @@ static GLuint displayListBase( QFont* theFont )
     int aFontCont = 0;
     QString aFontDef = theFont->toString();
     char** xFontList = XListFonts( aDisp, aFontDef.toLatin1()/*aFindFont.myFontString.data()*/, 1, &aFontCont  );
+// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     if( !theFont->handle() )
-    {       
+    {
+#endif
 #ifdef _DEBUG_
       printf( "Can't load font %s. loading default font....\n", aFontDef.toLatin1().data()/*aFindFont.myFontString.data()*/ );
 #endif
@@ -455,17 +460,18 @@ static GLuint displayListBase( QFont* theFont )
       aFontMask += "-*-*-*-m-*-*-*";
       xFontList = XListFonts( aDisp, aFontMask.toLatin1().constData()/*"-*-*-*-r-*-*-12-*-*-*-m-*-*-*"*/, 1, &aFontCont  );
       if( aFontCont == 0 )
-      {      
+      {
 #ifdef _DEBUG_
         printf( "Can't load default font\n" );
 #endif
         return 0;
       }
       glXUseXFont( (Font)(XLoadFont( aDisp,xFontList[0] )), 0, 256, listBase );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     }
     else
       glXUseXFont( (Font)(theFont->handle()), 0, 256, listBase );
-    
+#endif
     aList = listBase;
     GLViewer_TexFont::BitmapFontCache[aFindFont] = aList;
   }
index 4f759174f2bba93c194fa4238849eab7fb06ac5f..733b1a392bde11c55bf7088ad24e50df4f144e8c 100644 (file)
@@ -122,6 +122,7 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi )
     cout << "Choosing cmap for vID = " << vi->visualid << endl;
 #endif
 
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     if ( vi->visualid == XVisualIDFromVisual( (Visual*)QX11Info::appVisual() ) )
     {
 #ifdef DEBUG
@@ -129,7 +130,15 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi )
 #endif
         return QX11Info::appColormap();
     }
-
+#else
+    if ( vi->visualid == XVisualIDFromVisual( XDefaultVisual( QX11Info::display(), -1 ) ) )
+    {
+#ifdef DEBUG
+        cout << "Using XDefaultColormap" << endl;
+#endif
+        return XDefaultColormap( QX11Info::display(), -1 );
+    }
+#endif
     if ( mesa_gl )
     {
         Atom hp_cmaps = XInternAtom( dpy, "_HP_RGB_SMOOTH_MAP_LIST", true );
index f1599348a7bb7b8925d0ebaa8c36515ee50a65aa..663ab4dcee425892d7ad96cb69a1b83ecfce7ded 100644 (file)
@@ -888,7 +888,9 @@ void GLViewer_ViewSketcher::onSketch( SketchState state )
 
     if ( state == Fin )
     {
-        QApplication::syncX();  /* force rectangle redrawing */
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+       QApplication::syncX();  /* force rectangle redrawing */
+#endif
         myViewer->activateSketching( GLViewer_Viewer::NoSketching );
     }
 }
index 9463956683a0a8ce6b3b6e7a1992e0010274b6aa..b91b6248a06ee626798685744e943e25b998d576 100644 (file)
@@ -793,7 +793,7 @@ bool GLViewer_Viewer2d::translateTo( VectorFileType aType, QString FileName, Pap
         HDC screen_dc = GetDC( 0 ); //The screen device context
         HDC bitDC = CreateCompatibleDC ( screen_dc ); //The context compatible with screen
 
-        hMetaFileDC = CreateEnhMetaFile( bitDC, FileName.toLatin1(), &r, "" );
+        hMetaFileDC = CreateEnhMetaFile( bitDC, FileName.toLatin1().data(), &r, "" );
         SetMapMode( hMetaFileDC, MM_HIMETRIC );
         SetWindowOrgEx( hMetaFileDC, 0, r.bottom, NULL );
         HRGN ClipRgn = CreateRectRgn( 0, 0, AW, AH );
index dbe11ceb387c03432c6369122ad155f924124c8e..098f5b1283e540e420c916ee4cdc799e4a28810b 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UsePyQt4)
+INCLUDE(UsePyQt)
 
 # --- resources ---
 
@@ -31,8 +31,7 @@ SET(_pyuic_files
 # --- scripts ---
 
 # scripts / pyuic wrappings
-
-PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files})
+PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files})
 
 # scripts / static
 SET(_other_SCRIPTS 
@@ -47,11 +46,17 @@ SET(_bin_SCRIPTS
   test_dockwidgets.py
 )
 
+SALOME_CONFIGURE_FILE(qtsalome.py.in qtsalome.py)
+
+SET(_gen_SCRIPTS
+    ${CMAKE_CURRENT_BINARY_DIR}/qtsalome.py
+)
+
 # scripts / to install
 
 SET(_all_SCRIPTS ${_other_SCRIPTS} ${_pyuic_SCRIPTS})
 
 # --- rules ---
-
+SALOME_INSTALL_SCRIPTS("${_gen_SCRIPTS}" ${SALOME_INSTALL_PYTHON})
 SALOME_INSTALL_SCRIPTS("${_all_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/gui)
 SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_DATA})
index e6e10bcf9a8038850715fcdfb43aa42374f55833..08a9bc77be36580be2fd70d84c42f43e8ca8f1c9 100644 (file)
@@ -17,8 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-from PyQt4.QtCore import *
-from PyQt4.QtGui import *
+from qtsalome import *
 
 import SalomePyQt
 
@@ -44,7 +43,7 @@ def findDockWidgetByTitle( title ):
     """
     sg = SalomePyQt.SalomePyQt()
     dwl = sg.getDesktop().findChildren( QDockWidget )
-    dw = filter(lambda a: a.windowTitle() == QString( title ), dwl)
+    dw = filter(lambda a: a.windowTitle() == str( title ), dwl)
     if dw: return dw[0]
     return None
 
index c1eeacf6f752494d8c85bd7b087189b628166c06..2a310a4e7c8bfbab87460b15cbec2d7d28aa8685 100644 (file)
@@ -21,7 +21,7 @@
 __author__="gboulant"
 __date__ ="$31 mars 2010 17:09:53$"
 
-from PyQt4.QtGui import QDialog, QMessageBox
+from qtsalome import QDialog, QMessageBox
 
 from genericdialog_ui import Ui_GenericDialog
 
@@ -113,10 +113,9 @@ class GenericDialog(QDialog):
 #
 def TEST_GenericDialog():
     import sys
-    from PyQt4.QtGui import QApplication
-    from PyQt4.QtCore import QObject, SIGNAL, SLOT
+    from qtsalome import QApplication
     app = QApplication(sys.argv)
-    QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
+    app.lastWindowClosed.connect(app.quit)
 
     dlg=GenericDialog()
     dlg.displayAndWait()
index fafcb5edcd735324f10d2dda309386154adbb456..2c975c11315c64e80e7e49fcc5764b38f143ceb5 100644 (file)
@@ -20,7 +20,7 @@
 
 __author__="gboulant"
 __date__ ="$31 mars 2010 17:09:53$"
-
+from qtsalome import *
 from mytestdialog_ui import Ui_MyTestDialog
 from genericdialog import GenericDialog
 
@@ -71,13 +71,15 @@ class MyTestDialog(GenericDialog):
         return name
 
 
-from PyQt4.QtCore import SIGNAL
 class MyTestDialogWithSignals(MyTestDialog):
     """
     This class is to illustrate the usage of the GenericDialog in the
     case where the dialog windows is not modal. In such a case, the
     controller must be warn of close events using Qt signals.
     """
+
+    inputValidated = pyqtSignal()
+
     def __init__(self, parent=None, name="MyTestDialogWithSignals"):
         MyTestDialog.__init__(self, parent, name)
 
@@ -92,7 +94,7 @@ class MyTestDialogWithSignals(MyTestDialog):
         # has been validated so that it can process the event
         MyTestDialog.accept(self)
         if self.wasOk():
-            self.emit(SIGNAL('inputValidated()'))
+            self.inputValidated.emit()
 
 
 
@@ -104,10 +106,9 @@ class MyTestDialogWithSignals(MyTestDialog):
 
 def TEST_MyTestDialog_modal():
     import sys
-    from PyQt4.QtCore import QObject, SIGNAL, SLOT
-    from PyQt4.QtGui import QApplication
+    from qtsalome import QApplication
     app = QApplication(sys.argv)
-    QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
+    app.lastWindowClosed.connect(app.quit)
 
     dlg=MyTestDialog()
     dlg.setData("A default name")
@@ -126,10 +127,8 @@ class DialogListener:
 
 def TEST_MyTestDialog_non_modal():
     import sys
-    from PyQt4.QtCore import QObject, SIGNAL, SLOT
-    from PyQt4.QtGui import QApplication
     app = QApplication(sys.argv)
-    QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
+    app.lastWindowClosed.connect(app.quit)
 
     dlg=MyTestDialogWithSignals()
     # This dialog window will emit a inputValidated() signal when the
@@ -137,7 +136,7 @@ def TEST_MyTestDialog_non_modal():
     # connect this signal to a local slot so that the event can be
     # processed.
     dlgListener = DialogListener()
-    app.connect(dlg, SIGNAL('inputValidated()'), dlgListener.onProcessEvent)
+    dlg.inputValidated.connect(dlgListener.onProcessEvent)
     # This connect instruction means that the signal inputValidated()
     # emited by the dlg Qt object will raise a call to the slot
     # dlgListener.onProcessEvent
diff --git a/src/GUI_PY/qtsalome.py.in b/src/GUI_PY/qtsalome.py.in
new file mode 100644 (file)
index 0000000..d22dfe6
--- /dev/null
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+QT_SALOME_VERSION=@QT_SALOME_VERSION@
+
+try:
+    from PyQt@QT_SALOME_VERSION@.Qt import *
+except:
+    pass
index 95a4664371535c1831036ce7e74d0d61dfbfcf54..07386820131ab39b0380bc4653cd72588a653097 100644 (file)
@@ -21,8 +21,8 @@
 #
 
 import os
-from PyQt4 import QtGui, QtCore
-from PyQt4.QtCore import Qt
+
+from qtsalome import *
 
 import salome
 from salome.kernel.studyedit import getStudyEditor
@@ -34,23 +34,23 @@ from salome.kernel.parametric import study_exchange_vars
 
 from SelectVarsDialog_ui import Ui_SelectVarsDialog
 
-class MySelectVarsDialog(Ui_SelectVarsDialog, QtGui.QDialog):
+class MySelectVarsDialog(Ui_SelectVarsDialog, QDialog):
 
     def __init__(self, parent = None, modal = 0):
-        QtGui.QDialog.__init__(self, parent)
+        QDialog.__init__(self, parent)
         Ui_SelectVarsDialog.__init__(self)
         self.setupUi(self)
-        self.connect(self.cancelButton, QtCore.SIGNAL("clicked()"), self.close)
-        self.connect(self.OKButton, QtCore.SIGNAL("clicked()"), self.accept)
-        self.connect(self.selectButton, QtCore.SIGNAL("clicked()"), self.initPotentialVariablesFromSelection)
-        self.connect(self.addInputVarButton, QtCore.SIGNAL("clicked()"), self.addSelectedInputVar)
-        self.connect(self.removeInputVarButton, QtCore.SIGNAL("clicked()"), self.removeSelectedInputVar)
-        self.connect(self.newInputVarButton, QtCore.SIGNAL("clicked()"), self.newInputVar)
-        self.connect(self.addOutputVarButton, QtCore.SIGNAL("clicked()"), self.addSelectedOutputVar)
-        self.connect(self.removeOutputVarButton, QtCore.SIGNAL("clicked()"), self.removeSelectedOutputVar)
-        self.connect(self.newOutputVarButton, QtCore.SIGNAL("clicked()"), self.newOutputVar)
-        self.connect(self.loadVarsButton, QtCore.SIGNAL("clicked()"), self.loadVars)
-        self.connect(self.saveVarsButton, QtCore.SIGNAL("clicked()"), self.saveVars)
+        self.cancelButton.clicked.connect(self.close)
+        self.OKButton.clicked.connect(self.accept)
+        self.selectButton.clicked.connect(self.initPotentialVariablesFromSelection)
+        self.addInputVarButton.clicked.connect(self.addSelectedInputVar)
+        self.removeInputVarButton.clicked.connect(self.removeSelectedInputVar)
+        self.newInputVarButton.clicked.connect(self.newInputVar)
+        self.addOutputVarButton.clicked.connect(self.addSelectedOutputVar)
+        self.removeOutputVarButton.clicked.connect(self.removeSelectedOutputVar)
+        self.newOutputVarButton.clicked.connect( self.newOutputVar)
+        self.loadVarsButton.clicked.connect(self.loadVars)
+        self.saveVarsButtonself.clicked.connect(self.saveVars)
         self.refEntry = None
 
     def setExchangeVariables(self, exchangeVariables):
@@ -62,8 +62,8 @@ class MySelectVarsDialog(Ui_SelectVarsDialog, QtGui.QDialog):
     def initPotentialVariablesFromSelection(self):
         entries = salome.sg.getAllSelected()
         if len(entries) != 1 :
-            QtGui.QMessageBox.warning(self, self.tr("Error"),
-                                      self.tr("One item must be selected in the object browser"))
+            QMessageBox.warning(self, self.tr("Error"),
+                                self.tr("One item must be selected in the object browser"))
             return
         selectedEntry = entries[0]
         self._initPotentialVariables(selectedEntry)
@@ -71,13 +71,13 @@ class MySelectVarsDialog(Ui_SelectVarsDialog, QtGui.QDialog):
     def _initPotentialVariables(self, entry):
         sobj = getStudyEditor().study.FindObjectID(entry)
         if sobj is None:
-            QtGui.QMessageBox.warning(self, self.tr("Error"),
-                                      self.tr('No item at entry %s' % entry))
+            QMessageBox.warning(self, self.tr("Error"),
+                                self.tr('No item at entry %s' % entry))
             return
         exchangeVariables = study_exchange_vars.getExchangeVariablesFromSObject(sobj)
         if exchangeVariables is None:
-            QtGui.QMessageBox.warning(self, self.tr("Error"),
-                                      self.tr('Item at entry %s is not a valid '
+            QMessageBox.warning(self, self.tr("Error"),
+                                self.tr('Item at entry %s is not a valid '
                                               '"Variable List" object' % entry))
             return
         self.refEntry = entry
@@ -89,27 +89,27 @@ class MySelectVarsDialog(Ui_SelectVarsDialog, QtGui.QDialog):
 
     def addSelectedInputVar(self):
         for item in self.allInputVarListWidget.selectedItems():
-            self.selectedInputVarListWidget.addItem(QtGui.QListWidgetItem(item))
+            self.selectedInputVarListWidget.addItem(QListWidgetItem(item))
 
     def removeSelectedInputVar(self):
         for item in self.selectedInputVarListWidget.selectedItems():
             self.selectedInputVarListWidget.takeItem(self.selectedInputVarListWidget.row(item))
 
     def newInputVar(self):
-        newItem = QtGui.QListWidgetItem("TO EDIT!")
+        newItem = QListWidgetItem("TO EDIT!")
         newItem.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEditable|Qt.ItemIsUserCheckable|Qt.ItemIsEnabled)
         self.selectedInputVarListWidget.addItem(newItem);
 
     def addSelectedOutputVar(self):
         for item in self.allOutputVarListWidget.selectedItems():
-            self.selectedOutputVarListWidget.addItem(QtGui.QListWidgetItem(item))
+            self.selectedOutputVarListWidget.addItem(QListWidgetItem(item))
 
     def removeSelectedOutputVar(self):
         for item in self.selectedOutputVarListWidget.selectedItems():
             self.selectedOutputVarListWidget.takeItem(self.selectedOutputVarListWidget.row(item))
 
     def newOutputVar(self):
-        newItem = QtGui.QListWidgetItem("TO EDIT!")
+        newItem = QListWidgetItem("TO EDIT!")
         newItem.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEditable|Qt.ItemIsUserCheckable|Qt.ItemIsEnabled)
         self.selectedOutputVarListWidget.addItem(newItem);
 
@@ -125,7 +125,7 @@ class MySelectVarsDialog(Ui_SelectVarsDialog, QtGui.QDialog):
         return study_exchange_vars.ExchangeVariables(inputVarList, outputVarList, self.refEntry)
 
     def loadVars(self):
-        filename = QtGui.QFileDialog.getOpenFileName(self, self.tr("Import variables from file"),
+        filename = QFileDialog.getOpenFileName(self, self.tr("Import variables from file"),
                                                      os.getenv("HOME"),
                                                      self.tr("XML Files (*.xml)"))
         if not filename:
@@ -135,12 +135,12 @@ class MySelectVarsDialog(Ui_SelectVarsDialog, QtGui.QDialog):
             exchange_variables = study_exchange_vars.loadExchangeVariablesFromXmlFile(filename)
             self.setExchangeVariables(exchange_variables)
         except Exception, e:
-            QtGui.QMessageBox.critical(self, self.tr("Error"),
-                                       self.tr("Cannot load file %s:\n%s" % (filename, e)))
+            QMessageBox.critical(self, self.tr("Error"),
+                                 self.tr("Cannot load file %s:\n%s" % (filename, e)))
 
     def saveVars(self):
         default = os.path.join(os.getenv("HOME"), "vars.xml")
-        filename = QtGui.QFileDialog.getSaveFileName(self, self.tr("Export variables to file"),
+        filename = QFileDialog.getSaveFileName(self, self.tr("Export variables to file"),
                                                      default, self.tr("XML Files (*.xml)"))
         if not filename:
             return
@@ -149,5 +149,5 @@ class MySelectVarsDialog(Ui_SelectVarsDialog, QtGui.QDialog):
             exchange_variables = self.getSelectedExchangeVariables()
             exchange_variables.saveToXmlFile(filename)
         except Exception, e:
-            QtGui.QMessageBox.critical(self, self.tr("Error"),
-                                       self.tr("Cannot save file %s:\n%s" % (filename, e)))
+            QMessageBox.critical(self, self.tr("Error"),
+                                 self.tr("Cannot save file %s:\n%s" % (filename, e)))
index d8e982ccf7410487dec5c4123eed201ba393ba7e..15c5fc1a4849c375a41812d552cfa88f8fea92f3 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -85,7 +85,7 @@ SET(_other_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
@@ -109,6 +109,6 @@ TARGET_LINK_LIBRARIES(GraphicsView ${_link_LIBRARIES})
 INSTALL(TARGETS GraphicsView EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${GraphicsView_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
 
 INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
index bc60a3b53023117f168223a1fdf994ff195c2815..8e934d4d73f054bc9ada6ff4bf18c71d1eda92c7 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # additional include directories
 INCLUDE_DIRECTORIES(
@@ -71,7 +71,7 @@ SET(SalomeGuiHelpers_HEADERS ${_moc_HEADERS} ${_other_HEADERS})
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
index dbfae32a1b29757d6c856d0cebe4ba2830411ee2..4eaa40ccfb9287ada6f7b7caa111fbddfa88864a 100644 (file)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
 # additional include directories
 INCLUDE_DIRECTORIES(
-  ${QT_INCLUDES}
+  ${QT_INCLUDES} 
   ${PROJECT_SOURCE_DIR}/src/Qtx
 )
 
@@ -53,11 +53,11 @@ SET(_rcc_RESOURCES HelpBrowser.qrc)
 
 # --- sources ---
 
-# sources / rcc wrappings
-QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
-
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
+
+# sources / rcc wrappings
+QT_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
 
 # sources / to compile
 SET(_other_SOURCES
index d4a69eab3c388fd5c48bd43e2e8a305f340c11d5..770f9690f74dfb40ea555a0b28eb9cbb51d49554 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -233,11 +233,11 @@ SET(_other_RESOURCES
 
 # --- sources ---
 
-# sources / rcc wrappings
-QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
-
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
+
+# sources / rcc wrappings
+QT_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
 
 # sources / static
 SET(_other_SOURCES
@@ -300,6 +300,6 @@ TARGET_LINK_LIBRARIES(LightApp ${_link_LIBRARIES})
 INSTALL(TARGETS LightApp EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${LightApp_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
 
 INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
index 4bf97d8ca2e815371ad2ad487afc1f9bd555de95..b9ec2df18862eca635d6850ef4aa2598fcb71148 100644 (file)
 
 #include <SALOME_Event.h>
 
+#ifdef USE_SALOME_STYLE
 #include <Style_Salome.h>
 #include <Style_PrefDlg.h>
+#endif // USE_SALOME_STYLE
 
 #include <CAM_Module.h>
 #include <CAM_DataModel.h>
@@ -780,8 +782,10 @@ void LightApp_Application::createActions()
   createMenu( MRUId, fileMenu, 100, -1 );
   createMenu( separator(), fileMenu, -1, 100, -1 );
 
+#ifdef USE_SALOME_STYLE
   createAction( StyleId, tr( "TOT_THEME" ), QIcon(), tr( "MEN_DESK_THEME" ), tr( "PRP_THEME" ),
                 0, desk, false, this, SLOT( onStylePreferences() ) );
+#endif // USE_SALOME_STYLE
 
   createAction( FullScreenId, tr( "TOT_FULLSCREEN" ), QIcon(), tr( "MEN_DESK_FULLSCREEN" ), tr( "PRP_FULLSCREEN" ),
                 Qt::Key_F11, desk, false, this, SLOT( onFullScreen() ) );
@@ -789,7 +793,9 @@ void LightApp_Application::createActions()
 
   int viewMenu = createMenu( tr( "MEN_DESK_VIEW" ), -1 );
   createMenu( separator(), viewMenu, -1, 20, -1 );
+#ifdef USE_SALOME_STYLE
   createMenu( StyleId, viewMenu, 20, -1 );
+#endif // USE_SALOME_STYLE
   createMenu( FullScreenId, viewMenu, 20, -1 );
 
   int modTBar = createTool( tr( "INF_TOOLBAR_MODULES" ),    // title (language-dependant)
@@ -2016,8 +2022,11 @@ QWidget* LightApp_Application::createWindow( const int flag )
 
     // Create OBSelector
     new LightApp_OBSelector( ob, mySelMgr );
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     ob->treeView()->header()->setResizeMode(SUIT_DataObject::VisibilityId, QHeaderView::Fixed);
+#else
+    ob->treeView()->header()->setSectionResizeMode(SUIT_DataObject::VisibilityId, QHeaderView::Fixed);
+#endif
     ob->treeView()->header()->moveSection(SUIT_DataObject::NameId,SUIT_DataObject::VisibilityId);
     ob->treeView()->setColumnWidth(SUIT_DataObject::VisibilityId, VISIBILITY_COLUMN_WIDTH);
     ob->setProperty( "shortcut", QKeySequence( "Alt+Shift+O" ) );
@@ -4310,10 +4319,12 @@ void LightApp_Application::onMRUActivated( const QString& name )
 
 void LightApp_Application::onStylePreferences()
 {
+#ifdef USE_SALOME_STYLE
   Style_PrefDlg dlg( desktop() );
   dlg.exec();
 
   resourceMgr()->setValue( "Style", "use_salome_style", Style_Salome::isActive() );
+#endif // USE_SALOME_STYLE
 }
 
 void LightApp_Application::onFullScreen(){
index eee9a6d6fd73c6b44d42a0f38c7b22bf7813a7d9..81ec0eae12c3a83c22d214c8b0add7678121834b 100644 (file)
     <!-- Splash screen settings -->
     <parameter name="image"             value="${GUI_ROOT_DIR}/share/salome/resources/gui/icon_about.png" />
     <parameter name="constant_info"     value="%A [ %V ]" />
-    <parameter name="text_colors"       value="#ffffff|#777777" />
+    <parameter name="text_colors"       value="#ffffff" />
     <parameter name="hide_on_click"     value="yes" />
     <parameter name="show_progress"     value="yes" />
     <parameter name="show_message"      value="yes" />
     <parameter name="show_percents"     value="yes" />
-    <parameter name="margin"            value="50" />
+    <parameter name="margin"            value="30" />
     <parameter name="progress_width"    value="20" />
     <parameter name="progress_flags"    value="bottom,left_to_right" />
     <parameter name="opacity"           value="0.85" />
     <parameter name="font"              value="Tahoma,12,normal" />
     <parameter name="alignment"         value="top,left" />
-    <parameter name="progress_colors"   value="#929ca7|#aebac7|v" />
+    <parameter name="progress_colors"   value="#ffffff,#ff0000,v" />
   </section>
   <section name="resources">
     <!-- Resource directories (resource manager)-->
index dfdc7e618906cfabcfa9ce8b4ab44b4ab688ec31..761653d112055f78aa95fabc0851a71a3e85d303 100755 (executable)
Binary files a/src/LightApp/resources/icon_about.png and b/src/LightApp/resources/icon_about.png differ
index df849dcac3c920eb47d324d859058a30fe33c240..1e7605dcb90b19f2d9f12d5d7705423b942dba1c 100755 (executable)
Binary files a/src/LightApp/resources/icon_applogo.png and b/src/LightApp/resources/icon_applogo.png differ
index 5a9b75799b9cf0a4833f567bcc63b34a4523fbcc..1004586042606cb7e4022fbc4fc6f77958822363 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -54,7 +54,7 @@ SET(_ts_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES LogWindow.cxx)
@@ -69,4 +69,4 @@ TARGET_LINK_LIBRARIES(LogWindow ${_link_LIBRARIES})
 INSTALL(TARGETS LogWindow EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${LogWindow_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
index acbb7dd25d675ec7592aa9bd0b7719c64eda4bfe..16c7237f215aad126c7e96476b65aa8f482e6181 100755 (executable)
@@ -20,7 +20,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -153,10 +153,10 @@ SET(_other_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / rcc wrappings
-QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
+QT_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
 
 # sources / static
 SET(_other_SOURCES
@@ -196,6 +196,6 @@ TARGET_LINK_LIBRARIES(OCCViewer ${_link_LIBRARIES})
 INSTALL(TARGETS OCCViewer EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${OCCViewer_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
 
 INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
index 9f0c7e34860dc104cdacd909677f65e2b3c6f3e3..0ce25d0df19a41d4a432681623473881ec2c2d5e 100755 (executable)
@@ -115,6 +115,7 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi )
   //cout << "Choosing cmap for vID = " << vi->visualid << endl;
   //#endif
 
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   if ( vi->visualid == XVisualIDFromVisual( (Visual*)QX11Info::appVisual() ) )
   {
 #ifdef DEBUG
@@ -122,7 +123,15 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi )
 #endif
     return QX11Info::appColormap();
   }
-
+#else
+  if ( vi->visualid == XVisualIDFromVisual( XDefaultVisual( QX11Info::display(), -1 ) ) )
+  {
+#ifdef DEBUG
+//    cout << "Using XDefaultColormap" << endl;
+#endif
+    return XDefaultColormap( QX11Info::display(), -1 );
+  }
+#endif
   if ( mesa_gl )
   {
     Atom hp_cmaps = XInternAtom( dpy, "_HP_RGB_SMOOTH_MAP_LIST", true );
@@ -209,7 +218,9 @@ void OCCViewer_ViewPort::initialize()
   setBackgroundRole( QPalette::NoRole );//NoBackground );
   // set focus policy to threat QContextMenuEvent from keyboard  
   setFocusPolicy( Qt::StrongFocus );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) && OCC_VERSION_LARGE < 0x07000000
   setAttribute( Qt::WA_PaintOnScreen );
+#endif
   setAttribute( Qt::WA_NoSystemBackground );
 }
 
index e6591773b137085750874871df9feb87d427a038..b0ba526d440ae4db77d3cfc0cc9e2074180b359d 100755 (executable)
@@ -592,7 +592,9 @@ void OCCViewer_ViewPort3d::paintEvent( QPaintEvent* e )
     mapView( activeView() );
 #endif
   if ( !myWindow.IsNull() ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     QApplication::syncX();
+#endif
     QRect rc = e->rect();
     if ( !myPaintersRedrawing )
       activeView()->Redraw( rc.x(), rc.y(), rc.width(), rc.height() );
@@ -606,12 +608,14 @@ void OCCViewer_ViewPort3d::paintEvent( QPaintEvent* e )
 */
 void OCCViewer_ViewPort3d::resizeEvent( QResizeEvent* e )
 {
-#ifdef WIN32
+#if defined WIN32 || QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
   /* Win32 : map before first show to avoid flicker */
   if ( !mapped( activeView() ) )
     mapView( activeView() );
 #endif
-  QApplication::syncX();
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+    QApplication::syncX();
+#endif
   if ( !activeView().IsNull() )
     activeView()->MustBeResized();
 }
index f249227868a96f118a636d284ab0c5c8440ab3fc..103880d525d32046e562446532140f8b50ccf95e 100755 (executable)
@@ -298,7 +298,9 @@ void OCCViewer_RectSketcher::onSketch( SketchState state )
 
   if ( state == Fin )
   {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     QApplication::syncX();  /* force rectangle redrawing */
+#endif
     mypViewWindow->activateSketching( OCCViewer_ViewWindow::NoSketching );
   }
 }
@@ -515,7 +517,9 @@ void OCCViewer_PolygonSketcher::onSketch( SketchState state )
         mypPolyRB->clearGeometry();
         mypPolyRB->hide();
       }
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     QApplication::syncX();
+#endif
     mypViewWindow->activateSketching( OCCViewer_ViewWindow::NoSketching );
   }
 }
index be4a7358ba8b819081e25ab043c85a6451e99359..d8682208616b21f387de6bf6e060800fff7099f9 100755 (executable)
 
 static QEvent* l_mbPressEvent = 0;
 
-#ifdef WIN32
-# include <QWindowsStyle>
-#endif
+//#ifdef WIN32
+//# include <QWindowsStyle>
+//#endif
 
 #include <GL/gl.h>
 
index 7369bf11d9fbbb849e6b869e9d4aaf0021203d31..fc201e7248ee79e67232e9b8626678b047bf5afb 100644 (file)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -56,7 +56,7 @@ SET(_ts_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES OB_Browser.cxx)
@@ -71,4 +71,4 @@ TARGET_LINK_LIBRARIES(ObjBrowser ${_link_LIBRARIES})
 INSTALL(TARGETS ObjBrowser EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${ObjBrowser_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
index a31a8192e7efc3f0d18e6375228912b7dbafed9f..c52d03bf1f5e9c355fa1d875aa4db20515e7f283 100644 (file)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
-
 # Install ParaView filters, etc ...
 ADD_SUBDIRECTORY(resources)
 
+INCLUDE(UseQtExt)
+
 # --- options ---
 
 INCLUDE_DIRECTORIES(
@@ -81,10 +81,10 @@ SET(_ts_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / rcc wrappings
-QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
+QT_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
 
 # sources / static
 SET(_other_SOURCES
@@ -110,7 +110,7 @@ ADD_LIBRARY(PVViewer ${PVViewer_SOURCES})
 TARGET_LINK_LIBRARIES(PVViewer ${_link_LIBRARIES})
 INSTALL(TARGETS PVViewer EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
 
 # --- header and resources installation ---
 INSTALL(FILES ${PVViewer_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
index a8e721eece72aa3b297ff2e096785adfe54635dc..b70709226b4b6f043716236f2d095a0cb5cdd09d 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -108,7 +108,7 @@ SET(_other_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
@@ -144,6 +144,6 @@ TARGET_LINK_LIBRARIES(Plot2d ${_link_LIBRARIES})
 INSTALL(TARGETS Plot2d EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${Plot2d_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
 
 INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
index bc49aebc68abd454f5c8a18458ddbfdaf22cc96e..713769e8b1f81716b186feacf7405ff2c30ea6aa 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -65,7 +65,7 @@ SET(_ts_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
@@ -86,4 +86,4 @@ TARGET_LINK_LIBRARIES(PyConsole ${_link_LIBRARIES})
 INSTALL(TARGETS PyConsole EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${PyConsole_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
index 35b4e8b907cd7dfb4c184fa97538dab9b70133b4..be15881f7eeddb1ff0fcfe0fa69cac8118b47357 100644 (file)
@@ -19,7 +19,7 @@
 # Author : Maxim GLIBIN, Open CASCADE S.A.S. (maxim.glibin@opencascade.com)
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -66,7 +66,7 @@ SET(_ts_RESOURCES
 )
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
@@ -86,4 +86,4 @@ TARGET_LINK_LIBRARIES(PyEditor ${_link_LIBRARIES})
 INSTALL(TARGETS PyEditor EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${PyEditor_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
index 987380dac8d9457b5126b735c5f38ac1f7b121ff..d44a73ff3063df2884840b6a91429fc93f1020ab 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -55,7 +55,7 @@ SET(PyInterp_HEADERS ${_moc_HEADERS} ${_other_HEADERS})
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
index 49d546fd5c5b6f3b0a887c69d6a3d919c53286d0..90c645fc606c9a2ef95f24364ccb783a7819e669 100644 (file)
@@ -19,7 +19,7 @@
 # Author : Maxim GLIBIN, Open CASCADE S.A.S. (maxim.glibin@opencascade.com)
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # additional include directories
 INCLUDE_DIRECTORIES(
@@ -62,11 +62,13 @@ SET(_ts_RESOURCES
 # resource files / to be processed by rcc
 SET(_rcc_RESOURCES ${RESOURCES_PATH}/PyEditor.qrc)
 
+# --- sources ---
+
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / rcc wrappings
-QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
+QT_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
 
 # sources / static
 SET(_other_SOURCES
@@ -89,4 +91,4 @@ TARGET_LINK_LIBRARIES(DummyPyEditor ${_link_LIBRARIES} PyEditor PyViewer)
 INSTALL(TARGETS DummyPyEditor EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS})
 
 INSTALL(FILES ${PyViewer_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
index 1f967a7e2391818d63392fc24e9cca917b1e6286..2a6586ced93722a7c3b1e786d83207fa21bdaa2e 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -74,7 +74,7 @@ SET(_ts_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
@@ -104,4 +104,4 @@ TARGET_LINK_LIBRARIES(QDS ${_link_LIBRARIES})
 INSTALL(TARGETS QDS EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${QDS_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
index 93d0f73fb3a61bcce0ade2786b3af466bd44f159..96dc1f8df9987359a7f7ee384258970c5dd709cb 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -111,11 +111,11 @@ SET(_ts_RESOURCES resources/Qtx_msg_fr.ts
 
 # --- sources ---
 
-# sources / rcc wrappings
-QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
-
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
+
+# sources / rcc wrappings
+QT_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
 
 # sources / static
 SET(_other_SOURCES
@@ -186,4 +186,4 @@ TARGET_LINK_LIBRARIES(qtx ${_link_LIBRARIES})
 INSTALL(TARGETS qtx EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${qtx_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
index 2d6b6a23c1094b9c89b7824b3ee54e15e11272db..dc487e6a1a0f7d3b23f5f7b8124f0ea9c3fafff1 100755 (executable)
@@ -116,6 +116,38 @@ QtxAction::QtxAction( const QString& text, const QIcon& icon, const QString& men
   QApplication::instance()->installEventFilter( this );
 }
 
+/*!
+  \brief Constructor.
+
+  Creates an action owned by \a parent. Parameters \a text,
+  \a icon, \a menuText and \a accel specify the action's attributes.
+  Parameter \a toggle can be used to make the action checkable.
+  Parameter \a shortcutAction can be used to assign the shortcut from
+  preferences. This parameter value corresponds to shortcut action identifier
+  in shortcut preferences.
+
+  \param text tooltip text
+  \param icon iconset
+  \param menuText menu text
+  \param accel shortcut key sequence
+  \param parent parent object
+  \param toggle if \c true the action will be a toggle action
+  \param shortcutAction shortcut action identifier
+*/
+QtxAction::QtxAction( const QString& text, const QIcon& icon, const QString& menuText, 
+                     const QKeySequence& accel, QObject* parent, bool toggle, const QString& shortcutAction )
+: QWidgetAction( parent )
+{
+  setIcon( icon );
+  setText( menuText );
+  setToolTip( text );
+  setShortcut( accel );
+  setCheckable( toggle );
+  setShortcutActionName(shortcutAction);
+
+  QApplication::instance()->installEventFilter( this );
+}
+
 /*!
   \brief Constructor.
 
@@ -146,6 +178,36 @@ QtxAction::QtxAction( const QString& text, const QString& menuText,
   QApplication::instance()->installEventFilter( this );
 }
 
+/*!
+  \brief Constructor.
+
+  Creates an action owned by \a parent. Parameters \a text,
+  \a menuText and \a accel specify the action's attributes.
+  Parameter \a toggle can be used to make the action checkable.
+  Parameter \a shortcutAction can be used to assign the shortcut from
+  preferences. This parameter value corresponds to shortcut action identifier
+  in shortcut preferences.
+
+  \param text tooltip text
+  \param menuText menu text
+  \param accel shortcut key sequence
+  \param parent parent object
+  \param toggle if \c true the action is a toggle action
+  \param shortcutAction shortcut action identifier
+*/
+QtxAction::QtxAction( const QString& text, const QString& menuText,
+                      const QKeySequence& accel, QObject* parent, bool toggle, const QString& shortcutAction )
+: QWidgetAction( parent )
+{
+  setText( menuText );
+  setToolTip( text );
+  setShortcut( accel );
+  setCheckable( toggle );
+  setShortcutActionName(shortcutAction);
+  
+  QApplication::instance()->installEventFilter( this );
+}
+
 /*!
   \brief Destructor.
 */
index 03aa70076e497a4955629b59995338dca74eb5a4..c0704fc65f14b58061dc5e4dda4843ca72ba3eef 100755 (executable)
@@ -45,7 +45,9 @@ class QTX_EXPORT QtxAction : public QWidgetAction
 public:
   QtxAction( QObject* = 0, bool = false, const QString& = QString() );
   QtxAction( const QString&, const QString&, int, QObject*, bool = false, const QString& = QString() );
+  QtxAction( const QString&, const QString&, const QKeySequence&, QObject*, bool = false, const QString& = QString() );
   QtxAction( const QString&, const QIcon&, const QString&, int, QObject*, bool = false, const QString& = QString() );
+  QtxAction( const QString&, const QIcon&, const QString&, const QKeySequence&, QObject*, bool = false, const QString& = QString() );
   virtual ~QtxAction();
 
   virtual bool eventFilter( QObject*, QEvent* );
index e61ca27e604799da3defbe7ca8a1a327743527f0..0479b99f5c8248720d7df53eb81ab210c7e2c625 100755 (executable)
@@ -1442,8 +1442,9 @@ void QtxDialog::reject()
 void QtxDialog::emitSignal()
 {
   QApplication::instance()->processEvents();
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   QApplication::syncX();
-
+#endif
   int id = buttonId( (QAbstractButton*)mySender );
   mySender = 0;
 
index d5b2c138c477342d97ce13fb4f39a8971af23ac0..75eb432d14a89ff6d62e2594468d784ab76763c3 100644 (file)
@@ -98,7 +98,7 @@ bool QtxLogoMgr::LogoBox::eventFilter( QObject* o, QEvent* e )
   if ( o != menuBar() )
     return false;
 
-  if ( e->type() == QEvent::MenubarUpdated || e->type() == QEvent::Resize )
+  if ( e->type() == QEvent::Resize )
     updateCorner();
 
   if ( e->type() == QEvent::ChildAdded || e->type() == QEvent::ChildRemoved )
index 1d38b6cfecee7ca00ae1fc4d6fa5e72811041286..0bf17f45f76b2882232f43859722809b3d2fafb7 100644 (file)
 #include "QtxPopupMgr.h"
 #include "QtxAction.h"
 #include "QtxEvalExpr.h"
+#include <QList>
 #include <QMenu>
+#include <QVariant>
 
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 /*!
   \brief Used for comparing of two QVariant values.
   \param v1 first argument for comparison
@@ -56,7 +60,7 @@ bool operator<( const QVariant& v1, const QVariant& v2 )
       for ( ; anIt1 != aLast1 && anIt2 != aLast2;  anIt1++, anIt2++ )
       {
         if ( (*anIt1) != (*anIt2) )
-          return (*anIt1)<(*anIt2);
+          return (*anIt1) < (*anIt2);
       }
       return anIt1 == aLast1 && anIt2 != aLast2;
     }
@@ -67,6 +71,22 @@ bool operator<( const QVariant& v1, const QVariant& v2 )
   return t1 < t2;
 }
 
+#else
+
+bool operator<( const QList<QVariant>& v1, const QList<QVariant>& v2 )
+{
+  QList<QVariant>::const_iterator anIt1 = v1.begin(), aLast1 = v1.end(),
+    anIt2 = v2.begin(), aLast2 = v2.end();
+  for ( ; anIt1 != aLast1 && anIt2 != aLast2;  anIt1++, anIt2++ )
+  {
+    if ( (*anIt1) != (*anIt2) )
+      return (*anIt1) < (*anIt2);
+  }
+  return anIt1 == aLast1 && anIt2 != aLast2;
+}
+
+#endif // QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+
 /*!
   \class QtxPopupMgr::PopupCreator
   \internal
index cb322b022178c52e43d285cdad23e87e2295db9e..a5f4997278c2595eec5947fc6f43a7efa08bcfe5 100644 (file)
@@ -63,17 +63,39 @@ QtxTranslator::~QtxTranslator()
 {
 }
 
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+
 /*!
   \brief Returns the translation for the key.
   \param context message context
   \param sourceText message source name
-  \param comment message comment (optional)
+  \param disambiguation message comment (optional)
   \return Translated text if found or \a sourceText otherwise
 */
-QString QtxTranslator::translate( const char* context, const char* sourceText, const char* comment ) const
+QString QtxTranslator::translate( const char* context, const char* sourceText, const char* disambiguation ) const
 {
-  QString res = QTranslator::translate( context, sourceText, comment );
-  if( res.isNull() )
-    res = QTranslator::translate( GLOBAL_CONTEXT, sourceText, comment );
+  QString res = QTranslator::translate( context, sourceText, disambiguation );
+  if ( res.isNull() )
+    res = QTranslator::translate( GLOBAL_CONTEXT, sourceText, disambiguation );
   return res;
 }
+
+#else
+
+/*!
+  \brief Returns the translation for the key.
+  \param context message context
+  \param sourceText message source name
+  \param disambiguation message comment (optional)
+  \param n optional numeral to choose the appropriate form of translation
+  \return Translated text if found or \a sourceText otherwise
+*/
+QString QtxTranslator::translate( const char* context, const char* sourceText, const char* disambiguation, int n ) const
+{
+  QString res = QTranslator::translate( context, sourceText, disambiguation, n );
+  if ( res.isNull() )
+    res = QTranslator::translate( GLOBAL_CONTEXT, sourceText, disambiguation, n );
+  return res;
+}
+
+#endif // QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
index b8bfd0e92d02b07e4838c1b200212b5b40f29998..42d834e97a65db9e766c3227fe721535d39b26f0 100644 (file)
@@ -32,7 +32,11 @@ class QTX_EXPORT QtxTranslator : public QTranslator
 public:
   QtxTranslator( QObject* parent = 0 );
   ~QtxTranslator();
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   virtual QString translate( const char*, const char*, const char* = 0 ) const;
+#else
+  virtual QString translate( const char*, const char*, const char* = 0, int = -1 ) const;
+#endif
 };
 
 #endif
index 8a7537a2cd698a2af8af506d2a2c92083b322575..4da1f00adff15d29e71346bf315682e3c7d97fd2 100644 (file)
@@ -107,10 +107,17 @@ void QtxTreeView::Header::contextMenuEvent( QContextMenuEvent* e )
     QVariant appropriate = model()->headerData( i, orientation(), Qtx::AppropriateRole );
     QIcon icon;
     if ( iconData.isValid() ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
       if ( iconData.canConvert( QVariant::Icon ) )
         icon = iconData.value<QIcon>();
       else if ( iconData.canConvert( QVariant::Pixmap ) )
         icon = iconData.value<QPixmap>();
+#else
+      if ( iconData.canConvert( QMetaType::QIcon ) )
+        icon = iconData.value<QIcon>();
+      else if ( iconData.canConvert( QMetaType::QPixmap ) )
+        icon = iconData.value<QPixmap>();
+#endif
     }
     if( ( !lab.isEmpty() || !icon.isNull() ) && 
             appropriate.isValid() ? appropriate.toInt()==Qtx::Toggled : true )
@@ -136,7 +143,11 @@ void QtxTreeView::Header::contextMenuEvent( QContextMenuEvent* e )
     }
     else if ( a && a == sortAction ) {
       setSortIndicatorShown( a->isChecked() );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
       setClickable( a->isChecked() );
+#else
+      setSectionsClickable( a->isChecked() );
+#endif
       QtxTreeView* view = qobject_cast<QtxTreeView*>( parent() );
       if ( view ) {
         view->emitSortingEnabled( a->isChecked() );
@@ -181,7 +192,11 @@ QtxTreeView::QtxTreeView( QWidget* parent )
 : QTreeView( parent )
 {
   setHeader( new Header( false, this ) );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   header()->setMovable( true );
+#else
+  header()->setSectionsMovable( true );
+#endif
 }
 
 /*!
@@ -193,7 +208,11 @@ QtxTreeView::QtxTreeView( const bool enableSortMenu, QWidget* parent )
 : QTreeView( parent )
 {
   setHeader( new Header( enableSortMenu, this ) );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   header()->setMovable( true );
+#else
+  header()->setSectionsMovable( true );
+#endif
 }
 
 /*!
index 388841f905cd400bff7b26675b710959ba0612e3..18a99b5d462c41ed8caa7a326631ee0bc70cfcd6 100644 (file)
@@ -118,7 +118,7 @@ int QtxWorkspaceAction::accel( const int id ) const
 {
   int a = 0;
   if ( action( id ) )
-    a = action( id )->shortcut();
+    a = action( id )->shortcut()[0];
   return a;
 }
 
index 2127bd9458c577e30d1adef881f92b47eee8178c..9de0de4c71648c325151c48f0b81eabb0a731fa8 100644 (file)
@@ -2203,7 +2203,7 @@ int QtxWorkstack::accel( const int id ) const
 {
   int res = 0;
   if ( myActionsMap.contains( id ) )
-    res = myActionsMap[id]->shortcut();
+    res = myActionsMap[id]->shortcut()[0];
   return res;
 }
 
index 4716b230928d7abf721a493b68c35420e49f0903..668bd4f58734a852ca103194f0f7c54f0f8403ae 100644 (file)
@@ -203,7 +203,7 @@ int QtxWorkstackAction::accel( const int id ) const
 {
   int a = 0;
   if ( action( id ) )
-    a = action( id )->shortcut();
+    a = action( id )->shortcut()[0];
   return a;
 }
 
index df89a4ce82982d6a3ffed546567210c40d675fbc..bd70b29d33cb774c9e1e69d75b962977da82ebba 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -75,7 +75,7 @@ SET(_other_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
@@ -94,6 +94,6 @@ TARGET_LINK_LIBRARIES(QxScene ${_link_LIBRARIES})
 INSTALL(TARGETS QxScene EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${QxScene_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
 
 INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
index cd7115ec75c645b7240ead714396f4640ec5dc77..a9d20317bce020747a3b4089dbaa726ce2f71916 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 IF(SALOME_USE_VTKVIEWER)
   INCLUDE(${VTK_USE_FILE})
 ENDIF()
@@ -76,7 +76,7 @@ SET(SalomePyQtGUI_HEADERS ${_moc_HEADERS} ${_other_HEADERS})
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES SALOME_PYQT_Module.cxx)
index 3063fcfc0052ec6f87e174c1cdfdd661f433a6d0..ec02263954a7a38bba97fd31e004204dc987d0c8 100755 (executable)
@@ -17,8 +17,9 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
-INCLUDE(UsePyQt4)
+INCLUDE(UseQtExt)
+INCLUDE(UsePyQt)
+
 IF(SALOME_USE_VTKVIEWER)
   INCLUDE(${VTK_USE_FILE})
 ENDIF()
@@ -92,10 +93,10 @@ SET(_sip_files SALOME_PYQT_GUILight.sip)
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / sip wrappings
-PYQT4_WRAP_SIP(_sip_SOURCES ${_sip_files})
+PYQT_WRAP_SIP(_sip_SOURCES ${_sip_files})
 
 # sources / static
 SET(_other_SOURCES
index 5c85fa3bcdf2c629538237fa918b470019bd9a68..b1992e3a461e399caad48b00eeb8e61d3f3ab393 100644 (file)
@@ -24,4 +24,7 @@
 
 %Import QtCore/QtCoremod.sip
 %Import QtGui/QtGuimod.sip
+%If (Qt_5_0_0 -)
+%Import QtWidgets/QtWidgetsmod.sip
+%End
 %Import QtXml/QtXmlmod.sip
index c8c88d5b5c2efa4ab7f249810a6a444226a92976..3b2114600aa0004a20750fe6198f7275e43817e3 100755 (executable)
@@ -17,8 +17,8 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
-INCLUDE(UsePyQt4)
+INCLUDE(UseQtExt)
+INCLUDE(UsePyQt)
 IF(SALOME_USE_VTKVIEWER)
   INCLUDE(${VTK_USE_FILE})
 ENDIF()
@@ -105,10 +105,10 @@ ENDIF(SALOME_USE_PLOT2DVIEWER)
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / sip wrappings
-PYQT4_WRAP_SIP(_sip_SOURCES ${_sip_files})
+PYQT_WRAP_SIP(_sip_SOURCES ${_sip_files})
 
 # sources / static
 SET(_other_SOURCES SalomePyQt.cxx)
index cf0c0a14bd029e227f34cef0dbfaab468f9633bc..d7fba91181588a084ef4c2b8d725b47d28e83ce7 100644 (file)
@@ -30,6 +30,9 @@
 
 %Import QtCore/QtCoremod.sip
 %Import QtGui/QtGuimod.sip
+%If (Qt_5_0_0 -)
+%Import QtWidgets/QtWidgetsmod.sip
+%End
 %Import QtXml/QtXmlmod.sip
 
 %If (ENABLE_PLOT2D)
index cb12574b1bb3b1ec95ce9f05508bd5fd841915e3..8de68d550a7a342874c709cd5cc2cdd63580773f 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -62,7 +62,7 @@ SET(SOCC_HEADERS ${_moc_HEADERS} ${_other_HEADERS})
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
index f5618d7fe3462f5383d9c2bc4199163b171f598c..04818d747637605e32005e40cd0130ab6bcf5d0e 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -61,7 +61,7 @@ SET(SPlot2d_HEADERS ${_moc_HEADERS} ${_other_HEADERS})
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
index c0cb007fc908de3c5ad7e3e46ae28eb24a132a45..cdc6b67fe308c4e8ef87524fbff3afbb64ae19be 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -84,7 +84,7 @@ SET(_other_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
@@ -104,6 +104,6 @@ TARGET_LINK_LIBRARIES(std ${_link_LIBRARIES})
 INSTALL(TARGETS std EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${std_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
 
 INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
index 6b42a3512ca2ff029c2562a0b4c0658535d061f2..82190d1c98d5740543c4b9515fce11ce5b7507a9 100644 (file)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -107,7 +107,7 @@ SET(_other_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
@@ -154,7 +154,7 @@ TARGET_LINK_LIBRARIES(suit ${_link_LIBRARIES})
 INSTALL(TARGETS suit EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${suit_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
 
 INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
 
index 6cb089fa5d05b94104e20189f2106d05d3299ab3..44904748c27438448320d45f492112a5f7712621 100644 (file)
@@ -54,7 +54,7 @@ QtxAction* SUIT_ActionOperation::action() const
  * Create new instance of QtxAction and set.
  */
 void SUIT_ActionOperation::setAction( const QString& text, const QIcon& icon,
-                                                              const QString& menuText, QKeySequence accel,
+                                      const QString& menuText, QKeySequence accel,
                                       QObject* parent, bool toggle )
 {
   setAction( new QtxAction( text, icon, menuText, accel, parent, toggle ) );
@@ -64,7 +64,7 @@ void SUIT_ActionOperation::setAction( const QString& text, const QIcon& icon,
  * Create new instance of QtxAction and set.
  */
 void SUIT_ActionOperation::setAction( const QString& text, const QString& menuText,
-                                                              QKeySequence accel, QObject* parent, bool toggle )
+                                      QKeySequence accel, QObject* parent, bool toggle )
 {
   setAction( new QtxAction( text, menuText, accel, parent, toggle ) );
 }
index 0cc0b21b934ec5d9ef94c8742d04aa52d95a79b3..95a42da89a584a20d00b7e136ecee0569e194cf0 100755 (executable)
@@ -630,6 +630,28 @@ QAction* SUIT_Application::createAction( const int id, const QString& text, cons
                                          const QString& menu, const QString& tip, const int key,
                                          QObject* parent, const bool toggle, QObject* reciever, 
                                         const char* member, const QString& shortcutAction )
+{
+  return createAction( id, text, icon, menu, tip, QKeySequence(key), parent, toggle, reciever, member, shortcutAction );
+}
+
+/*!
+  Creates action and registers it both in menu manager and tool manager
+  \return new instance of action
+  \param id - proposed SUIT identificator
+  \param text - description
+  \param icon - icon for toolbar
+  \param menu - menu text
+  \param tip - tool tip
+  \param key - shortcut
+  \param parent - parent object
+  \param toggle - if it is TRUE the action will be a toggle action, otherwise it will be a command action
+  \param reciever - object that contains slot
+  \param member - slot to be called when action is activated
+*/
+QAction* SUIT_Application::createAction( const int id, const QString& text, const QIcon& icon,
+                                         const QString& menu, const QString& tip, const QKeySequence& key,
+                                         QObject* parent, const bool toggle, QObject* reciever, 
+                                        const char* member, const QString& shortcutAction )
 {
   QtxAction* a = new QtxAction( text, icon, menu, key, parent, toggle, shortcutAction );
   a->setStatusTip( tip );
index db9cf0d08b5cf11110d3d0116552afd961f73de2..a9225c3f96952ea7f07e945f2094639fa0c75230 100755 (executable)
@@ -33,6 +33,7 @@ class QLabel;
 class QString;
 class QAction;
 class QWidget;
+class QKeySequence;
 
 class SUIT_Desktop;
 class SUIT_ViewManager;
@@ -174,6 +175,10 @@ protected:
                                       const QString&, const int, QObject* = 0,
                                       const bool = false, QObject* = 0, const char* = 0,
                                      const QString& = QString() );
+  QAction*              createAction( const int, const QString&, const QIcon&, const QString&,
+                                      const QString&, const QKeySequence&, QObject* = 0,
+                                      const bool = false, QObject* = 0, const char* = 0,
+                                     const QString& = QString() );
 
 protected slots:
   virtual void          onDesktopActivated();
index 1c2f67ef3a4f4a61732a45c55f8545c815b9f363..c52494f117367eb0b607120998481d5a15f35bc8 100644 (file)
@@ -165,7 +165,7 @@ void SUIT_DataBrowser::updateTree( SUIT_DataObject* obj, const bool autoOpen )
 */
 int SUIT_DataBrowser::shortcutKey(const int id) const
 {
-  return myShortcutMap.value(id)->key();
+  return myShortcutMap.value(id)->key()[0];
 }
 
 /*!
index 680df4210c73e861db493a0d0fa367db3b2e750c..09c5ad6963ea9d255a5a734d7e8e9962c1509966 100755 (executable)
@@ -131,8 +131,13 @@ SUIT_FileDlg::SUIT_FileDlg( QWidget* parent, bool open, bool showQuickDir, bool
     setWindowIcon( parent->windowIcon() );
 
   // GDD
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   myUrls.insert(0,QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::ApplicationsLocation)));
   myUrls.insert(0,QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::HomeLocation)));
+#else
+  myUrls.insert(0,QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation)));
+  myUrls.insert(0,QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)));
+#endif
   setSidebarUrls(myUrls);
 
   // add quick directories widgets
index 1a03ec51b1f98345081db0f950d70b4678f2b2be..dd02eb49725c1ade025831f152d7e44088c4acb3 100755 (executable)
@@ -500,6 +500,9 @@ SUIT_TreeModel::~SUIT_TreeModel()
 void SUIT_TreeModel::registerColumn( const int group_id, const QString& name, const int custom_id )
 {
   bool found = false;
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+  beginResetModel();
+#endif
   for ( int i=0, n=myColumns.size(); i<n && !found; i++ ) {
     if ( name == myColumns[i].myName ) {
       myColumns[i].myIds.insert( group_id, custom_id );
@@ -515,7 +518,11 @@ void SUIT_TreeModel::registerColumn( const int group_id, const QString& name, co
     int n = myColumns.size();
     myColumns.resize( n+1 );
     myColumns[n] = inf;
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+    endResetModel();
+#else
     reset();
+#endif
   }
 }
 
@@ -533,11 +540,18 @@ void SUIT_TreeModel::registerColumn( const int group_id, const QString& name, co
 void SUIT_TreeModel::unregisterColumn( const int group_id, const QString& name )
 {
   for ( int i = 0, n = myColumns.size(); i < n; i++ ) {
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+    beginResetModel();
+#endif
     if ( myColumns[i].myName == name ) {
       myColumns[i].myIds.remove( group_id );
       if ( myColumns[i].myIds.isEmpty() ) {
-       myColumns.remove( i );
-       reset();
+        myColumns.remove( i );
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+        endResetModel();
+#else
+        reset();
+#endif
       }
       break;
     }
@@ -747,6 +761,10 @@ void SUIT_TreeModel::setRoot( SUIT_DataObject* r )
   if ( root() == r )
     return;
 
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+  beginResetModel();
+#endif
+
   if ( autoDeleteTree() ) {
     SUIT_DataObject::disconnect( SIGNAL( inserted( SUIT_DataObject*, SUIT_DataObject* ) ),
                                  this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
@@ -766,7 +784,11 @@ void SUIT_TreeModel::setRoot( SUIT_DataObject* r )
   myRoot = r;
 
   //initialize();
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+  endResetModel();
+#else
   reset();
+#endif
   emit modelUpdated();
 }
 
index ee4df9e13575be75b9a2210ef9a5c8d007d53279..404da384d7deac5e9d2f10e7f38456fed52bd1df 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -80,7 +80,7 @@ SET(_ts_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
@@ -105,4 +105,4 @@ TARGET_LINK_LIBRARIES(TestSUITApp ${_link_LIBRARIES} SUITApp)
 INSTALL(TARGETS TestSUITApp EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS})
 
 INSTALL(FILES ${SUITApp_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
index 8d0ff7521170faaef45b60e98d0d556a5f05854a..979783334852ad305733f82479eb07a5278fa09e 100644 (file)
@@ -46,7 +46,9 @@
 #include "SUIT_LicenseDlg.h"
 #include "SUIT_ResourceMgr.h"
 #include "SUIT_Session.h"
+#ifdef USE_SALOME_STYLE
 #include "Style_Salome.h"
+#endif // USE_SALOME_STYLE
 #include "QtxSplash.h"
 
 #include <QDir>
@@ -182,12 +184,15 @@ int main( int argc, char* argv[] )
   if ( !qtdir.isEmpty() )
     QApplication::addLibraryPath( qtdir );
 
+// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   //Set a "native" graphic system in case if application runs on the remote host
   QString remote(::getenv("REMOTEHOST"));
   QString client(::getenv("SSH_CLIENT"));
   if(remote.length() > 0 || client.length() > 0 ) {
     QApplication::setGraphicsSystem(QLatin1String("native"));
   }
+#endif
   
   SUITApp_Application app( argc, argv );
   QString cfgAppName = getAppName( argList.isEmpty() ? QString() : argList.first() );
@@ -272,9 +277,11 @@ int main( int argc, char* argv[] )
     SUIT_Application* theApp = aSession.startApplication( argList.first() );
     if ( theApp )
     {
+#ifdef USE_SALOME_STYLE
       Style_Salome::initialize( theApp->resourceMgr() );
       if ( theApp->resourceMgr()->booleanValue( "Style", "use_salome_style", true ) )
         Style_Salome::apply();
+#endif // USE_SALOME_STYLE
 
       if ( !noExceptHandling )
         app.setHandler( aSession.handler() );
index e2b68f74165a8087ad7d1c305f851719f0cca09d..f3404c915881d88894f9d61461a0a4a0bb4049ac 100644 (file)
@@ -43,7 +43,8 @@ SUITApp_Application::SUITApp_Application( int& argc, char** argv, SUIT_Exception
 #ifdef ENABLE_TESTRECORDER
   : TestApplication( argc, argv ),
 #else
-#ifndef WIN32
+// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5
+#if !defined(WIN32) && (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
   // san: Opening an X display and choosing a visual most suitable for 3D visualization
   // in order to make SALOME viewers work with non-native X servers
   : QApplication( (Display*)Qtx::getDisplay(), argc, argv, Qtx::getVisual() ),
@@ -58,6 +59,8 @@ myExceptHandler( hand )
 /*!
   Constructor
 */
+// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 SUITApp_Application::SUITApp_Application( int& argc, char** argv, Type type, SUIT_ExceptionHandler* hand )
 #ifdef ENABLE_TESTRECORDER
   : TestApplication( argc, argv ),
@@ -67,7 +70,7 @@ SUITApp_Application::SUITApp_Application( int& argc, char** argv, Type type, SUI
 myExceptHandler( hand )
 {
 }
-
+#endif
 /*!
   Sends event to receiver
   \return the value that is returned from the receiver's event handler
index fb3cbb386b28bedae86d415fc350792fcb31a061..f9507e8f94a87f0efe5d6b16aab34e14859d6dcd 100644 (file)
@@ -51,8 +51,10 @@ class SUIT_ExceptionHandler;
 
 public:
   SUITApp_Application( int& argc, char** argv, SUIT_ExceptionHandler* = 0 );
+// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   SUITApp_Application( int& argc, char** argv, Type type, SUIT_ExceptionHandler* = 0 );
-
+#endif
   virtual bool notify( QObject* receiver, QEvent* e );
 
         SUIT_ExceptionHandler* handler() const;
index dd03219cd74e5721d89768820627abe3c10b7e70..53dcf7e84da194a739c4b45f04dd7a46ba2618d3 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 INCLUDE(${VTK_USE_FILE})
 
 # --- options ---
@@ -42,9 +42,9 @@ ADD_DEFINITIONS(${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS})
 
 # libraries to link to
 SET(_link_LIBRARIES 
-  ${QT_LIBRARIES} 
+  ${QT_LIBRARIES}
   ${OPENGL_LIBRARIES}
-  ${VTK_LIBRARIES} 
+  ${VTK_LIBRARIES}
   ${CAS_KERNEL} ${CAS_VIEWER}
   ${KERNEL_OpUtil}
   qtx suit ViewerTools SalomeObject SalomePrs VTKViewer OpenGLUtils
@@ -148,7 +148,7 @@ SET(_other_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS} ${_moc_internal_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS} ${_moc_internal_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
@@ -196,7 +196,6 @@ TARGET_LINK_LIBRARIES(SVTK ${_link_LIBRARIES})
 INSTALL(TARGETS SVTK EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${SVTK_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
 
 INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
-
index 2cba3970aa31de3cc0bafe5f2baacf974119bea4..c82c2515667ea93ea6e842fc92c1599f17802add 100644 (file)
 // Put Qt includes before the X11 includes which #define the symbol None
 // (see SVTK_SpaceMouse.h) to avoid the compilation error.
 #ifndef WIN32
-# include <QX11Info>
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#include <xcb/xcb.h>
+#endif
+#include <QX11Info>
 #endif
 #include <QMouseEvent>
 
@@ -110,9 +113,15 @@ QVTK_RenderWindowInteractor
 ::~QVTK_RenderWindowInteractor() 
 {
 #ifndef WIN32
-  SVTK_SpaceMouse* aSpaceMouse = SVTK_SpaceMouse::getInstance();
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+  SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance();
   if ( aSpaceMouse && aSpaceMouse->isSpaceMouseOn() )
     aSpaceMouse->close( QX11Info::display() );
+#else
+  SVTK_SpaceMouseXCB* aSpaceMouse = SVTK_SpaceMouseXCB::getInstance();
+  if ( aSpaceMouse && aSpaceMouse->isSpaceMouseOn() )
+    aSpaceMouse->close( QX11Info::connection() );
+#endif
 #endif
 }
 
@@ -408,8 +417,8 @@ QVTK_RenderWindowInteractor
 
 #ifndef WIN32
   // register set space mouse events receiver
-  SVTK_SpaceMouse* aSpaceMouse = SVTK_SpaceMouse::getInstance();
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+  SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance();
   if ( aSpaceMouse )
   {
     if ( !aSpaceMouse->isSpaceMouseOn() )
@@ -418,6 +427,17 @@ QVTK_RenderWindowInteractor
     else
       aSpaceMouse->setWindow( QX11Info::display(), winId() );
   }
+#else
+  SVTK_SpaceMouseXCB* aSpaceMouse = SVTK_SpaceMouseXCB::getInstance();
+  if ( aSpaceMouse )
+  {
+    if ( !aSpaceMouse->isSpaceMouseOn() )
+      // initialize 3D space mouse driver
+      aSpaceMouse->initialize( QX11Info::connection(), winId() );
+    else
+      aSpaceMouse->setWindow( QX11Info::connection(), winId() );
+  }
+#endif
 #endif
 }
 
@@ -432,14 +452,21 @@ QVTK_RenderWindowInteractor
   QWidget::focusOutEvent( event );
 
 #ifndef WIN32
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   // unregister set space mouse events receiver
-  SVTK_SpaceMouse* aSpaceMouse = SVTK_SpaceMouse::getInstance();
+  SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance();
   if ( aSpaceMouse && aSpaceMouse->isSpaceMouseOn() )
     aSpaceMouse->setWindow( QX11Info::display(), 0 );
+#else
+  SVTK_SpaceMouseXCB* aSpaceMouse = SVTK_SpaceMouseXCB::getInstance();
+  if ( aSpaceMouse && aSpaceMouse->isSpaceMouseOn() )
+    aSpaceMouse->setWindow( QX11Info::connection(), 0 );
+#endif
 #endif
 }
 
-
+// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 #ifdef WIN32
 
 /*!
@@ -456,12 +483,12 @@ bool QVTK_RenderWindowInteractor::winEvent( MSG* msg, long* result )
 /*!
   To handle native X11 events (from such devices as SpaceMouse)
 */
-bool 
+bool
 QVTK_RenderWindowInteractor
 ::x11Event( XEvent *xEvent )
 {
   // handle 3d space mouse events
-  if ( SVTK_SpaceMouse* aSpaceMouse = SVTK_SpaceMouse::getInstance() )
+  if ( SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance() )
   {
     if ( aSpaceMouse->isSpaceMouseOn() && xEvent->type == ClientMessage )
     {
@@ -487,6 +514,52 @@ QVTK_RenderWindowInteractor
 
 #endif
 
+#else // QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+
+bool QVTK_RenderWindowInteractor
+::nativeEvent(const QByteArray& eventType, void* message, long* result)
+{
+#ifdef WIN32
+  // TODO: WIN32-related implementation
+#else
+  if ( eventType == "xcb_generic_event_t" )
+  {
+    xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message);
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+    // TODO: this code is never called
+    if ( SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance() )
+#else
+    if ( SVTK_SpaceMouseXCB* aSpaceMouse = SVTK_SpaceMouseXCB::getInstance() )
+#endif
+    {
+      if ( aSpaceMouse->isSpaceMouseOn() && ev->response_type == XCB_CLIENT_MESSAGE )
+      {
+        SVTK_SpaceMouse::MoveEvent anEvent;
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+        // TODO: this code is never called
+        int type = aSpaceMouse->translateEvent( QX11Info::display(), xEvent, &anEvent, 1.0, 1.0 );
+#else
+        int type = aSpaceMouse->translateEvent( QX11Info::connection(), (xcb_client_message_event_t*)ev, &anEvent, 1.0, 1.0 );
+#endif
+        switch ( type )
+        {
+        case SVTK_SpaceMouse::SpaceMouseMove:
+                GetDevice()->InvokeEvent( SVTK::SpaceMouseMoveEvent, anEvent.data );
+                break;
+        case SVTK_SpaceMouse::SpaceButtonPress:
+                GetDevice()->InvokeEvent( SVTK::SpaceMouseButtonEvent, &anEvent.button );
+                break;
+        case SVTK_SpaceMouse::SpaceButtonRelease:
+                break;
+        }
+        return true; // stop handling the event
+      }
+    }
+  }
+#endif
+ return QWidget::nativeEvent( eventType, message, result );
+}
+#endif
 /*!
   Constructor
 */
index 1c34af0ace6ebf00c44df77fac0489794fcb1021..521794f67f0a40a2fc4bd820269057240f509d8b 100644 (file)
@@ -122,12 +122,16 @@ class SVTK_EXPORT QVTK_RenderWindowInteractor: public QWidget
   virtual void focusOutEvent( QFocusEvent* );
 
   //! To handle native events (from such devices as SpaceMouse)
+// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 #ifdef WIN32
   virtual bool winEvent( MSG*, long* );
 #else
   virtual bool x11Event( XEvent *e );
 #endif
-
+#else
+  virtual bool nativeEvent( const QByteArray&, void*, long* );
+#endif
   vtkSmartPointer<vtkRenderWindow> myRenderWindow;
   vtkSmartPointer<vtkGenericRenderWindowInteractor> myDevice;
 };
index 10ba11ee51ec5380fd420d6ec6967f62568e49d3..5db6b427da0c2f3e92882e2e5e0505c372e1111b 100644 (file)
 #include <math.h>
 #include <stdio.h>
 
+#include <QtGlobal>
+
 #ifndef WIN32
 #include <X11/X.h>
-#include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/Xatom.h>
 #include <X11/keysym.h>
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#include <X11/Xlib.h>
+#else
+#include <xcb/xcb.h>
+#endif
 #endif
 
 #include "SVTK_SpaceMouse.h"
 
-SVTK_SpaceMouse* SVTK_SpaceMouse::myInstance = 0;
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+SVTK_SpaceMouseX* SVTK_SpaceMouseX::myInstance = 0;
+#else
+SVTK_SpaceMouseXCB* SVTK_SpaceMouseXCB::myInstance = 0;
+#endif
 
 /*!
-  \return shared instance of object (creates if there is no one)
+  Constructor
 */
-SVTK_SpaceMouse* SVTK_SpaceMouse::getInstance()
+SVTK_SpaceMouse::SVTK_SpaceMouse()
 {
-  if ( !myInstance )
-    myInstance = new SVTK_SpaceMouse();
-  return myInstance;
+  spaceMouseOn = 0;
 }
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 /*!
   Constructor
 */
-SVTK_SpaceMouse::SVTK_SpaceMouse()
+SVTK_SpaceMouseX::SVTK_SpaceMouseX()
+: SVTK_SpaceMouse()
 {
 #ifndef WIN32
   win = InputFocus;
 #endif
-  spaceMouseOn = 0;
 }
 
-#ifndef WIN32
-
 /*!
-  Initialization
+  \return shared instance of object (creates if there is no one)
 */
-int SVTK_SpaceMouse::initialize( Display *display, Window window )
+SVTK_SpaceMouseX* SVTK_SpaceMouseX::getInstance()
 {
- XMotionEvent        = XInternAtom( display, "MotionEvent",        1 );
- XButtonPressEvent   = XInternAtom( display, "ButtonPressEvent",   1 );
- XButtonReleaseEvent = XInternAtom( display, "ButtonReleaseEvent", 1 );
- XCommandEvent       = XInternAtom( display, "CommandEvent",       1 );
-
- spaceMouseOn = (XMotionEvent        != 0) && 
-                (XButtonPressEvent   != 0) && 
-                (XButtonReleaseEvent != 0) && 
-                (XCommandEvent       != 0);
- if ( !spaceMouseOn )
-  return 0;
-
- spaceMouseOn = setWindow( display, window );
- if ( !spaceMouseOn )
-  return 0;
- return spaceMouseOn; 
+  if ( !myInstance )
+    myInstance = new SVTK_SpaceMouseX();
+  return myInstance;
 }
 
+#ifndef WIN32
+
 static int errorCallback( Display *display, XErrorEvent *Error )
 {
   char msg[ 128 ];
@@ -97,10 +91,34 @@ static int errorCallback( Display *display, XErrorEvent *Error )
   return 0;
 }
 
+/*!
+  Initialization
+*/
+int SVTK_SpaceMouseX::initialize( Display *display, Window window )
+{
+  XMotionEvent        = XInternAtom( display, "MotionEvent",        1 );
+  XButtonPressEvent   = XInternAtom( display, "ButtonPressEvent",   1 );
+  XButtonReleaseEvent = XInternAtom( display, "ButtonReleaseEvent", 1 );
+  XCommandEvent       = XInternAtom( display, "CommandEvent",       1 );
+
+  spaceMouseOn = (XMotionEvent        != 0) &&
+                 (XButtonPressEvent   != 0) &&
+                 (XButtonReleaseEvent != 0) &&
+                 (XCommandEvent       != 0);
+  if ( !spaceMouseOn )
+    return 0;
+
+  spaceMouseOn = setWindow( display, window );
+  if ( !spaceMouseOn )
+    return 0;
+  return spaceMouseOn;
+}
+
 /*!
   Initialize by window
 */
-int SVTK_SpaceMouse::setWindow( Display *display, Window window )
+int SVTK_SpaceMouseX::setWindow( Display *display, Window window )
 {
   XTextProperty winName;
   XEvent xEvent;
@@ -109,10 +127,8 @@ int SVTK_SpaceMouse::setWindow( Display *display, Window window )
   unsigned long NItems, BytesReturn;
   unsigned char *PropReturn;
   Window root;
-  int result;
   int (*errorHandler)(Display *,XErrorEvent *);
 
-  result = 1;
   errorHandler = XSetErrorHandler( errorCallback );
  
   root = RootWindow( display, DefaultScreen(display) );
@@ -128,13 +144,13 @@ int SVTK_SpaceMouse::setWindow( Display *display, Window window )
     XFree( PropReturn );
   }
   else
-    return result = 0;
+    return 0;
 
   if ( XGetWMName( display, win, &winName ) == 0 )
-    return result = 0;
+    return 0;
 
   if ( strcmp( (char *) "Magellan Window", (char *) winName.value) != 0 )
-    return result = 0;
+    return 0;
 
   xEvent.type = ClientMessage;
   xEvent.xclient.format = 16;
@@ -148,18 +164,18 @@ int SVTK_SpaceMouse::setWindow( Display *display, Window window )
   xEvent.xclient.data.s[2] = 27695;
 
   if ( XSendEvent( display, win, 0, 0x0000, &xEvent ) == 0 )
-    return result = 0;
+    return 0;
 
   XFlush( display );
 
   XSetErrorHandler( errorHandler );
-  return result;
+  return 1;
 }
 
 /*!
   Close
 */
-int SVTK_SpaceMouse::close(Display *display)
+int SVTK_SpaceMouseX::close(Display *display)
 {
   initialize( display, (Window)InputFocus );
   spaceMouseOn = 0;
@@ -170,7 +186,7 @@ int SVTK_SpaceMouse::close(Display *display)
 /*!
   Custom event handler
 */
-int SVTK_SpaceMouse::translateEvent( Display* display, XEvent* xEvent, MoveEvent* spaceMouseEvent,
+int SVTK_SpaceMouseX::translateEvent( Display* display, XEvent* xEvent, MoveEvent* spaceMouseEvent,
                     double scale, double rScale )
 {
   if ( !spaceMouseOn )
@@ -207,5 +223,180 @@ int SVTK_SpaceMouse::translateEvent( Display* display, XEvent* xEvent, MoveEvent
   }
   return (!display);
 }
+#endif
+#else
+
+/*!
+  Constructor
+*/
+SVTK_SpaceMouseXCB::SVTK_SpaceMouseXCB()
+: SVTK_SpaceMouse()
+{
+#ifndef WIN32
+  win = InputFocus;
+#endif
+}
+
+/*!
+  \return shared instance of object (creates if there is no one)
+*/
+SVTK_SpaceMouseXCB* SVTK_SpaceMouseXCB::getInstance()
+{
+  if ( !myInstance )
+    myInstance = new SVTK_SpaceMouseXCB();
+  return myInstance;
+}
+/*!
+  Initialization
+*/
+#ifndef WIN32
+int SVTK_SpaceMouseXCB::initialize( xcb_connection_t *connection, xcb_window_t window )
+{
+  // make request
+  xcb_intern_atom_cookie_t cookie = xcb_intern_atom (connection, 0, strlen("XCB_MOTION_NOTIFY"), "XCB_MOTION_NOTIFY" );
+  // get response
+  xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply ( connection, cookie, NULL );
+  XCBMotionEvent = reply->atom;
+  cookie = xcb_intern_atom (connection, 0, strlen("XCB_BUTTON_PRESS"), "XCB_BUTTON_PRESS" );
+  reply = xcb_intern_atom_reply ( connection, cookie, NULL );
+  XCBButtonPressEvent = reply->atom;
+  cookie = xcb_intern_atom (connection, 0, strlen("XCB_BUTTON_RELEASE"), "XCB_BUTTON_RELEASE" );
+  reply = xcb_intern_atom_reply ( connection, cookie, NULL );
+  XCBButtonReleaseEvent = reply->atom;
+
+  free (reply);
+
+  spaceMouseOn = (XCBMotionEvent        != 0) &&
+                 (XCBButtonPressEvent   != 0) &&
+                 (XCBButtonReleaseEvent != 0);
+  if ( !spaceMouseOn )
+    return 0;
+
+  spaceMouseOn = setWindow( connection, window );
+  if ( !spaceMouseOn )
+    return 0;
+
+  return spaceMouseOn;
+}
+
+/*!
+  Initialize by window
+*/
+int SVTK_SpaceMouseXCB::setWindow( xcb_connection_t *connection, xcb_window_t window )
+{
+  xcb_client_message_event_t xcbEvent;
+  xcb_window_t root_window;
+  xcb_screen_t* screen;
+  xcb_generic_error_t* error;
+  xcb_void_cookie_t cookie;
+
+  screen = xcb_setup_roots_iterator ( xcb_get_setup ( connection ) ).data;
+
+  /* root window */
+  if ( screen )
+    root_window = screen->root;
+
+  xcb_get_property_cookie_t prop_cookie;
+  xcb_get_property_reply_t* prop_reply;
+  prop_cookie = xcb_get_property (connection, 0, root_window, XCB_ATOM_WM_NAME,
+                                  XCB_ATOM_STRING, 0, 0);
+
+  win = InputFocus;
+
+  if (( prop_reply = xcb_get_property_reply ( connection, prop_cookie, NULL ) ))
+  {
+    int len = xcb_get_property_value_length( prop_reply );
+
+    if ( len == 0 )
+    {
+      free(prop_reply);
+      return 0;
+    }
+
+    if ( strcmp( (char *) "Magellan Window", (char *) xcb_get_property_value( prop_reply ) ) != 0 )
+      return 0;
+
+    win = * ( xcb_window_t * ) xcb_get_property_value( prop_reply );
+  }
+
+  free(prop_reply);
+
+  xcbEvent.response_type = XCB_CLIENT_MESSAGE;
+  xcbEvent.format = 16;
+  xcbEvent.sequence = 0;
+  xcbEvent.window = win;
+
+  xcbEvent.data.data16[0] = (short) ((window>>16)&0x0000FFFF);
+  xcbEvent.data.data16[1] = (short)  (window&0x0000FFFF);
+  xcbEvent.data.data16[2] = 27695;
+
+  cookie = xcb_send_event( connection, 0, win, 0x0000, (const char *)&xcbEvent );
+
+
+  if (( error = xcb_request_check( connection, cookie )))
+  {
+    if ( error->error_code != BadWindow )
+    {
+      fprintf ( stderr, "SpaceMouse reported error = %d. Exit ... \n", error->error_code);
+    }
+    return 0;
+  }
+
+  xcb_flush(connection);
+
+  return 1;
+}
 
+/*!
+  Close
+*/
+int SVTK_SpaceMouseXCB::close(xcb_connection_t *connection)
+{
+  initialize( connection, (xcb_window_t)InputFocus );
+  spaceMouseOn = 0;
+
+  return 1;
+}
+
+/*!
+  Custom event handler
+*/
+int SVTK_SpaceMouseXCB::translateEvent( xcb_connection_t* connection, xcb_client_message_event_t* xcbEvent, MoveEvent* spaceMouseEvent,
+                    double scale, double rScale )
+{
+  if ( !spaceMouseOn )
+    return 0;
+
+  if ( xcbEvent->response_type == XCB_CLIENT_MESSAGE ) {
+    if ( xcbEvent->type == XCBMotionEvent ) {
+      spaceMouseEvent->type = SpaceMouseMove;
+      spaceMouseEvent->data[ x ] =
+        xcbEvent->data.data16[2] * scale;
+      spaceMouseEvent->data[ y ] =
+        xcbEvent->data.data16[3] * scale;
+      spaceMouseEvent->data[ z ] =
+        xcbEvent->data.data16[4] * scale;
+      spaceMouseEvent->data[ a ] =
+        xcbEvent->data.data16[5] * rScale;
+      spaceMouseEvent->data[ b ] =
+        xcbEvent->data.data16[6] * rScale;
+      spaceMouseEvent->data[ c ] =
+        xcbEvent->data.data16[7] * rScale;
+      spaceMouseEvent->period = xcbEvent->data.data16[8];
+      return 1;
+    }
+    else if ( xcbEvent->type == XCBButtonPressEvent ) {
+      spaceMouseEvent->type = SpaceButtonPress;
+      spaceMouseEvent->button = xcbEvent->data.data16[2];
+      return 2;
+    }
+    else if ( xcbEvent->type == XCBButtonReleaseEvent ) {
+      spaceMouseEvent->type = SpaceButtonRelease;
+      spaceMouseEvent->button = xcbEvent->data.data16[2];
+      return 3;
+    }
+  }
+  return (!connection);
+}
+#endif
 #endif
index 9dd0b4fee7ee8c37643fa4b4fb4d37d5de1076be..ab140cd0d9810d1c48199d77a21026ceccc7ba6b 100644 (file)
 #ifndef SVTK_SpaceMouse_h
 #define SVTK_SpaceMouse_h
 
+#include <QtGlobal>
+
 #ifndef WIN32
 extern "C"
 {
 #include <X11/X.h>
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 #include <X11/Xlib.h>
+#else
+#include <xcb/xcb.h>
+#endif
 }
+
 #endif
 
 class SVTK_SpaceMouse 
 {
  public:
 
-  // access to SpaceMouse utility class
-  static SVTK_SpaceMouse* getInstance();
-
   enum MoveData { x, y, z, a, b, c };
   enum EventType { SpaceMouseMove = 1, SpaceButtonPress, SpaceButtonRelease };
 
@@ -54,26 +58,66 @@ class SVTK_SpaceMouse
 
   bool isSpaceMouseOn() const { return spaceMouseOn != 0; }
 
+  SVTK_SpaceMouse();
+
+ protected:
+
+  int spaceMouseOn;
+};
+
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+
+class SVTK_SpaceMouseX: public SVTK_SpaceMouse
+{
+
+public:
+  SVTK_SpaceMouseX();
+
+  // access to SpaceMouse utility class
+  static SVTK_SpaceMouseX* getInstance();
+
 #ifndef WIN32
   int initialize     ( Display*, Window );
   int setWindow      ( Display*, Window );
   int translateEvent ( Display*, XEvent*, MoveEvent*, double, double );
   int close          ( Display* );
-#endif
 
- private:
-  SVTK_SpaceMouse();
-  static SVTK_SpaceMouse* myInstance;
-
-#ifndef WIN32
+private:
   Atom XMotionEvent;
   Atom XButtonPressEvent;
   Atom XButtonReleaseEvent;
   Atom XCommandEvent;
-
   Window win;
 #endif
-  int spaceMouseOn;
+
+  static SVTK_SpaceMouseX* myInstance;
+
 };
+#else
+class SVTK_SpaceMouseXCB: public SVTK_SpaceMouse
+{
+
+public:
+  SVTK_SpaceMouseXCB();
 
+  // access to SpaceMouse utility class
+  static SVTK_SpaceMouseXCB* getInstance();
+
+#ifndef WIN32
+  int initialize     ( xcb_connection_t*, xcb_window_t );
+  int setWindow      ( xcb_connection_t*, xcb_window_t );
+  int translateEvent ( xcb_connection_t*, xcb_client_message_event_t*, MoveEvent*, double, double );
+  int close          ( xcb_connection_t* );
+
+private:
+  xcb_atom_t XCBMotionEvent;
+  xcb_atom_t XCBButtonPressEvent;
+  xcb_atom_t XCBButtonReleaseEvent;
+  xcb_window_t win;
+#endif
+
+  static SVTK_SpaceMouseXCB* myInstance;
+
+};
+#endif
 #endif
index 8296bfccac5f8d98203e800465b45f8eaea323d2..bf2fd39116c8ef2d5547608c09af1e1cae89e0f9 100755 (executable)
@@ -22,7 +22,7 @@ IF(SALOME_BUILD_TESTS)
    ADD_SUBDIRECTORY(Test)
 ENDIF()
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 IF(SALOME_USE_VTKVIEWER)
   INCLUDE(${VTK_USE_FILE})
 ENDIF()
@@ -184,7 +184,7 @@ SET(_other_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
@@ -235,7 +235,7 @@ TARGET_LINK_LIBRARIES(SalomeApp ${_link_LIBRARIES})
 INSTALL(TARGETS SalomeApp EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${SalomeApp_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
 
 INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
 
index 67cf5ad5bf9e2393a6877ac5b28f6eadcf6f363d..e686273c83f911c1b4d6d784d2693ce0a7cd575c 100644 (file)
@@ -84,7 +84,11 @@ SalomeApp_ListView::SalomeApp_ListView( QWidget* parent )
   setRootIsDecorated(false);
   setAllColumnsShowFocus(false);
 //  header()->setClickEnabled(false);
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   header()->setMovable(false);
+#else
+  header()->setSectionsMovable(false);
+#endif
 
   myEditedItem = 0;
   myEdit = 0;
index d18ced70927bfdb373db078b2cf2e3c3c8ab51ce..68319ee8a38a6aa8809a2c05781279ef7390cd75 100755 (executable)
@@ -25,7 +25,8 @@
 # variable *_ROOT_DIR).  
 #
 
-INCLUDE(UsePyQt4)
+INCLUDE(UseQtExt)
+INCLUDE(UsePyQt)
 
 # --- resources ---
 
@@ -35,12 +36,12 @@ SET(_pyuic_files
 )
 
 # scripts / pyuic wrappings
-PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files})
+PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files})
 
 # --- scripts ---
 
 # scripts / static
-# TODO: process UIC files via PyQt4 pyuic tool, see UsePyQt4.cmake
+# TODO: process UIC files via PyQt pyuic tool, see UsePyQt.cmake
 SET(_plugins_SCRIPTS
   ${_pyuic_SCRIPTS}
   minmax_plugin.py
index bd39ede204574e589790dc3e18063b5ec583bfdd..59d143b417e245363ce4cf379780529208884038 100644 (file)
 #
 # Author : Guillaume Boulant (EDF)
 
+from qtsalome import *
+
 def minmax(context):
   # get context study, studyId, salomeGui
   study = context.study
   studyId = context.studyId
   sg = context.sg
 
-  from PyQt4.QtGui import QDialog
-  from PyQt4.QtGui import QMessageBox
-  from PyQt4.QtCore import Qt
-  from PyQt4.QtCore import SIGNAL
-
   from minmax_ui import Ui_Dialog
 
   import salome
@@ -86,7 +83,7 @@ def minmax(context):
       self.clearLineEdit()
 
       # Connect up the selectionChanged() event of the object browser.
-      self.connect(sg.getObjectBrowser(), SIGNAL("selectionChanged()"), self.select)
+      sg.getObjectBrowser().selectionChanged.connect(self.select)
 
       self.mm = None
       self.ui.control.setFocus()
@@ -95,7 +92,7 @@ def minmax(context):
       pass
 
     def OnCancel(self):
-      self.disconnect(sg.getObjectBrowser(), SIGNAL("selectionChanged()"), self.select)
+      sg.getObjectBrowser().selectionChanged.disconnect(self.select)
       self.reject()
       pass
 
@@ -106,7 +103,7 @@ def minmax(context):
       self.ui.maxvalue.setText("")
 
     def select(self):
-      self.disconnect(sg.getObjectBrowser(), SIGNAL("selectionChanged()"), self.select)
+      sg.getObjectBrowser().selectionChanged.disconnect(self.select)
       self.ui.control.clear()
       self.ui.minvalue.setText("")
       self.ui.maxvalue.setText("")
@@ -141,7 +138,7 @@ def minmax(context):
             pass
           self.ui.control.addItems(controls)
           self.compute_minmax()
-      self.connect(sg.getObjectBrowser(), SIGNAL("selectionChanged()"), self.select)
+      sg.getObjectBrowser().selectionChanged.connect(self.select)
       pass
 
     def helpMessage(self):
index 8530fc55c7e18d6beb0bcbd6cecb75f2c8bdb4f6..84f5a418be261d05d97ab48487b82726c8787218 100644 (file)
@@ -19,8 +19,7 @@
 # Author : Guillaume Boulant (EDF)
 
 import sys
-from PyQt4 import QtGui
-from PyQt4 import QtCore
+from qtsalome import *
 
 from tubedialog_ui import TubeDialog_UI
 
@@ -33,27 +32,27 @@ class TubeDialog(TubeDialog_UI):
 
     def handleAcceptWith(self,callbackFunction):
         """This defines the function to be connected to the signal 'accepted()' (click on Ok)"""
-        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), callbackFunction)
+        self.buttonBox.accepted.connect(callbackFunction)
 
     def handleRejectWith(self,callbackFunction):
         """This defines the function to be connected to the signal 'rejected()' (click on Cancel)"""
-        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), callbackFunction)
+        self.buttonBox.rejected.connect(callbackFunction)
 
     def handleApplyWith(self,callbackFunction):
         """This defines the function to be connected to the signal 'apply()' (click on Apply)"""
-        button = self.buttonBox.button(QtGui.QDialogButtonBox.Apply)        
-        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), callbackFunction);
+        button = self.buttonBox.button(QDialogButtonBox.Apply)
+        button.clicked.connect(callbackFunction);
 
     def accept(self):
         '''Callback function when dialog is accepted (click Ok)'''
         self._wasOk = True
         # We should test here the validity of values
-        QtGui.QDialog.accept(self)
+        QDialog.accept(self)
 
     def reject(self):
         '''Callback function when dialog is rejected (click Cancel)'''
         self._wasOk = False
-        QtGui.QDialog.reject(self)
+        QDialog.reject(self)
 
     def wasOk(self):
         return self._wasOk
@@ -83,13 +82,13 @@ class TubeDialogOnTopWithApply(TubeDialog):
         """
         TubeDialog.setupUi(self)
         # Add a button "Apply"
-        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|
-                                          QtGui.QDialogButtonBox.Apply|
-                                          QtGui.QDialogButtonBox.Ok)
+        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|
+                                          QDialogButtonBox.Apply|
+                                          QDialogButtonBox.Ok)
 
         # Keep the dialog on top of the windows
         self.setWindowFlags(self.windowFlags() |
-                            QtCore.Qt.WindowStaysOnTopHint)
+                            Qt.WindowStaysOnTopHint)
 
 
 #
@@ -108,10 +107,9 @@ def TEST_getData_synchrone():
 
 
 def main( args ):
-    a = QtGui.QApplication(sys.argv)
+    a = QApplication(sys.argv)
     TEST_getData_synchrone()
     sys.exit(0)
 
 if __name__=="__main__":
     main(sys.argv)
-
index 4db3e9a2f61ee81623948bc58c04c2da6ff1f200..324ad394d93378fdbe6c824ce5c9f7228a1cdaf1 100644 (file)
 # Author : Guillaume Boulant (EDF)
 
 import sys
-from PyQt4 import QtGui
-from PyQt4 import QtCore
+from qtsalome import *
 
 
-class TubeDialog_UI(QtGui.QDialog):
+class TubeDialog_UI(QDialog):
     """
     This class defines the design of a Qt dialog box dedicated to the
     salome plugin examples. It presents a UI form that contains
     parameters for the spatial dimensions of geometrical object.  
     """
     def __init__(self, parent=None):
-        QtGui.QDialog.__init__(self, parent)
+        QDialog.__init__(self, parent)
         self.setupUi()
 
     def setupUi(self):
         self.setObjectName("Dialog")
         self.resize(400, 300)
-        self.hboxlayout = QtGui.QHBoxLayout(self)
-        self.hboxlayout.setMargin(9)
+        self.hboxlayout = QHBoxLayout(self)
+        self.hboxlayout.setContentsMargins(9,9,9,9)
         self.hboxlayout.setSpacing(6)
         self.hboxlayout.setObjectName("hboxlayout")
-        self.vboxlayout = QtGui.QVBoxLayout()
-        self.vboxlayout.setMargin(0)
+        self.vboxlayout = QVBoxLayout()
+        self.vboxlayout.setContentsMargins(0,0,0,0)
         self.vboxlayout.setSpacing(6)
         self.vboxlayout.setObjectName("vboxlayout")
-        self.hboxlayout1 = QtGui.QHBoxLayout()
-        self.hboxlayout1.setMargin(0)
+        self.hboxlayout1 = QHBoxLayout()
+        self.hboxlayout1.setContentsMargins(0,0,0,0)
         self.hboxlayout1.setSpacing(6)
         self.hboxlayout1.setObjectName("hboxlayout1")
-        self.vboxlayout1 = QtGui.QVBoxLayout()
-        self.vboxlayout1.setMargin(0)
+        self.vboxlayout1 = QVBoxLayout()
+        self.vboxlayout1.setContentsMargins(0,0,0,0)
         self.vboxlayout1.setSpacing(6)
         self.vboxlayout1.setObjectName("vboxlayout1")
-        self.lblRadius = QtGui.QLabel(self)
+        self.lblRadius = QLabel(self)
         self.lblRadius.setObjectName("lblRadius")
         self.vboxlayout1.addWidget(self.lblRadius)
-        self.lblLength = QtGui.QLabel(self)
+        self.lblLength = QLabel(self)
         self.lblLength.setObjectName("lblLength")
         self.vboxlayout1.addWidget(self.lblLength)
-        self.lblWidth = QtGui.QLabel(self)
+        self.lblWidth = QLabel(self)
         self.lblWidth.setObjectName("lblWidth")
         self.vboxlayout1.addWidget(self.lblWidth)
         self.hboxlayout1.addLayout(self.vboxlayout1)
-        self.vboxlayout2 = QtGui.QVBoxLayout()
-        self.vboxlayout2.setMargin(0)
+        self.vboxlayout2 = QVBoxLayout()
+        self.vboxlayout2.setContentsMargins(0,0,0,0)
         self.vboxlayout2.setSpacing(6)
         self.vboxlayout2.setObjectName("vboxlayout2")
-        self.txtRadius = QtGui.QLineEdit(self)
+        self.txtRadius = QLineEdit(self)
         self.txtRadius.setObjectName("txtRadius")
         self.vboxlayout2.addWidget(self.txtRadius)
-        self.txtLength = QtGui.QLineEdit(self)
+        self.txtLength = QLineEdit(self)
         self.txtLength.setObjectName("txtLength")
         self.vboxlayout2.addWidget(self.txtLength)
-        self.txtWidth = QtGui.QLineEdit(self)
+        self.txtWidth = QLineEdit(self)
         self.txtWidth.setObjectName("txtWidth")
         self.vboxlayout2.addWidget(self.txtWidth)
         self.hboxlayout1.addLayout(self.vboxlayout2)
         self.vboxlayout.addLayout(self.hboxlayout1)
-        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+        spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
         self.vboxlayout.addItem(spacerItem)
-        self.buttonBox = QtGui.QDialogButtonBox(self)
-        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
-        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Ok)
+        self.buttonBox = QDialogButtonBox(self)
+        self.buttonBox.setOrientation(Qt.Horizontal)
+        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.NoButton|QDialogButtonBox.Ok)
         self.buttonBox.setObjectName("buttonBox")
         self.vboxlayout.addWidget(self.buttonBox)
         self.hboxlayout.addLayout(self.vboxlayout)
@@ -98,10 +97,9 @@ class TubeDialog_UI(QtGui.QDialog):
 # ======================================================================
 #
 def main( args ):
-    a = QtGui.QApplication(sys.argv)
+    a = QApplication(sys.argv)
     tubedialog = TubeDialog_UI()
     sys.exit(tubedialog.exec_())
 
 if __name__=="__main__":
     main(sys.argv)
-
index f13d42ef2cdec525fec3e69d2692ac24d10d8d03..2eb1ef319844cdebd0c6ce6d0b7f8bdba2cb3d2e 100644 (file)
@@ -44,7 +44,7 @@ name salome_plugins.py (example follows)::
   import salome_pluginsmanager
 
   def about(context):
-    from PyQt4.QtGui import QMessageBox
+    from qtsalome import QMessageBox
     QMessageBox.about(None, "About SALOME pluginmanager", "SALOME plugins manager in SALOME virtual application ")
 
   salome_pluginsmanager.AddFunction('About plugins','About SALOME pluginmanager',about)
@@ -83,8 +83,7 @@ context attributes:
 """
 
 import os,sys,traceback
-from PyQt4 import QtGui
-from PyQt4 import QtCore
+from qtsalome import *
 
 import salome
 
@@ -124,13 +123,15 @@ class Context:
 
 def find_menu(smenu):
   lmenus=smenu.split("|")
-  main=lmenus.takeFirst().trimmed()
+  # Take first element from the list
+  main=lmenus.pop(0).strip()
   menu=sgPyQt.getPopupMenu(main)
   return findMenu(lmenus,menu)
 
 def findMenu(lmenu,menu):
   if not lmenu:return menu
-  m=lmenu.takeFirst().trimmed()
+  # Take first element from the list
+  m=lmenu.pop(0).strip()
   for a in menu.actions():
     if a.menu():
       if a.text() == m:
@@ -148,8 +149,8 @@ logger=Logger("PluginsManager") #,color=GREEN)
 class PluginsManager:
     def __init__(self,module,name,basemenuname,menuname):
         self.name=name
-        self.basemenuname=QtCore.QString.fromUtf8(basemenuname)
-        self.menuname=QtCore.QString.fromUtf8(menuname)
+        self.basemenuname=unicode(basemenuname, "utf-8")
+        self.menuname=unicode(menuname, "utf-8")
         self.module=module
         self.registry={}
         self.handlers={}
@@ -198,15 +199,15 @@ class PluginsManager:
         self.basemenu = find_menu(self.basemenuname)
 
         if self.module:
-          self.menu=QtGui.QMenu(self.menuname)
+          self.menu=QMenu(self.menuname)
           mid=sgPyQt.createMenu(self.menu.menuAction(),self.basemenuname)
         else:
-          self.menu=QtGui.QMenu(self.menuname,self.basemenu)
+          self.menu=QMenu(self.menuname,self.basemenu)
           self.basemenu.addMenu(self.menu)
 
         self.menu.menuAction().setVisible(False)
 
-        self.basemenu.connect(self.basemenu, QtCore.SIGNAL("aboutToShow()"), self.importPlugins)
+        self.basemenu.aboutToShow.connect(self.importPlugins)
 
     def analyseFile(self,filename):
       """
@@ -232,7 +233,7 @@ class PluginsManager:
             script(Context(sgPyQt))
           except:
             s=traceback.format_exc()
-            QtGui.QMessageBox.warning(None,"Exception occured",s)
+            QMessageBox.warning(None,"Exception occured",s)
 
         self.handlers[name]=handler
 
@@ -307,7 +308,7 @@ class PluginsManager:
               if submenus.has_key(name):
                 amenu=submenus[name]
               else:
-                amenu=QtGui.QMenu(name,parentMenu)
+                amenu=QMenu(name,parentMenu)
                 parentMenu.addMenu(amenu)
                 submenus[name]=amenu
               parentMenu=amenu
index 1eae0a0e46bbd6130e0fc27a79ae9a978d552c66..0b10352e26c4082e90241f15c7a93b86dc1e78d9 100755 (executable)
@@ -52,7 +52,9 @@
 #include <Qtx.h>
 #include <QtxSplash.h>
 
+#ifdef USE_SALOME_STYLE
 #include <Style_Salome.h>
+#endif // USE_SALOME_STYLE
 
 #include "GUI_version.h"
 #include <SUIT_Tools.h>
  * - stop Session ( must be idle )
  * - get session state
  */
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 void MessageOutput( QtMsgType type, const char* msg )
+#else
+void MessageOutput( QtMsgType type, const QMessageLogContext &context, const QString &msg )
+#endif
 {
   switch ( type )
   {
@@ -253,7 +258,8 @@ public:
   SALOME_QApplication( int& argc, char** argv ) : TestApplication( argc, argv ), myHandler ( 0 ) {}
 #else
   SALOME_QApplication( int& argc, char** argv )
-#ifndef WIN32
+// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5
+#if !defined WIN32 && QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   // san: Opening an X display and choosing a visual most suitable for 3D visualization
   // in order to make SALOME viewers work with non-native X servers
   : QApplication( (Display*)Qtx::getDisplay(), argc, argv, Qtx::getVisual() ),
@@ -343,20 +349,27 @@ void shutdownServers( SALOME_NamingService* theNS )
 int main( int argc, char **argv )
 {
   // Install Qt debug messages handler
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   qInstallMsgHandler( MessageOutput );
+#else
+  qInstallMessageHandler( MessageOutput );
+#endif
 
+// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   //Set a "native" graphic system in case if application runs on the remote host
   QString remote(getenv("REMOTEHOST"));
   QString client(getenv("SSH_CLIENT"));
   if(remote.length() > 0 || client.length() > 0 ) {
     QApplication::setGraphicsSystem(QLatin1String("native"));
   }
-  
+#endif
+
   // add <qtdir>/plugins dir to the pluins search path for image plugins
   QString qtdir = Qtx::qtDir( "plugins" );
   if ( !qtdir.isEmpty() )
     QApplication::addLibraryPath( qtdir );
-
+  
   // set "C" locale if requested via preferences
   {
     SALOME_Session stmp( argc, argv );
@@ -566,9 +579,11 @@ int main( int argc, char **argv )
       SUIT_Application* aGUIApp = aGUISession->startApplication( "SalomeApp", 0, 0 );
       if ( aGUIApp )
       {
+#ifdef USE_SALOME_STYLE
         Style_Salome::initialize( aGUIApp->resourceMgr() );
         if ( aGUIApp->resourceMgr()->booleanValue( "Style", "use_salome_style", true ) )
           Style_Salome::apply();
+#endif // USE_SALOME_STYLE
 
         if ( !isFound( "noexcepthandler", argc, argv ) )
           _qappl.setHandler( aGUISession->handler() ); // after loading SalomeApp application
index 85775760900ba2dcf7db6f5e850528be0b549d0e..7f3abf6c9018ace89c9a657232355ae274f60cf7 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -72,10 +72,10 @@ SET(_other_RESOURCES resources/SalomeStyle.xml)
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / rcc wrappings
-QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
+QT_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
 
 # sources / static
 SET(_other_SOURCES
@@ -96,6 +96,6 @@ TARGET_LINK_LIBRARIES(SalomeStyle ${_link_LIBRARIES})
 INSTALL(TARGETS SalomeStyle EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${SalomeStyle_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
 
 INSTALL(FILES "${_other_RESOURCES}" DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
index 992fe4135f2e68821cee88e1278c2b9f08fcd184..de57552cfe4768e9b61015db81702fa1b925003d 100644 (file)
@@ -202,7 +202,11 @@ Style_Model* Style_Salome::myModel = 0;
   Use Style_Salome::apply() static function to set SALOME style to the application.
 */
 Style_Salome::Style_Salome()
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   : QWindowsStyle()
+#else
+  : QCommonStyle()
+#endif
 {
   // initialize SALOME style resources
   Q_INIT_RESOURCE( Style );
@@ -322,7 +326,11 @@ Style_Model* Style_Salome::model()
 */
 void Style_Salome::polish ( QApplication* app )
 {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   QWindowsStyle::polish( app );
+#else
+  QCommonStyle::polish( app );
+#endif
 
   if ( checkDebugLevel(1) ) {
     return;
@@ -344,7 +352,11 @@ void Style_Salome::polish ( QApplication* app )
 void Style_Salome::polish ( QWidget* w )
 {
   if ( checkDebugLevel(2) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     QWindowsStyle::polish( w );
+#else
+    QCommonStyle::polish( w );
+#endif
     return;
   }
 
@@ -358,7 +370,11 @@ void Style_Salome::polish ( QWidget* w )
       w->setAttribute( Qt::WA_Hover );
   }
 
-  QWindowsStyle::polish( w );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+    QWindowsStyle::polish( w );
+#else
+    QCommonStyle::polish( w );
+#endif
 }
 
 /*!
@@ -374,7 +390,11 @@ void Style_Salome::polish ( QWidget* w )
 void Style_Salome::unpolish( QWidget* w )
 {
   if ( checkDebugLevel(3) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     QWindowsStyle::unpolish( w );
+#else
+    QCommonStyle::unpolish( w );
+#endif
     return;
   }
 
@@ -388,7 +408,11 @@ void Style_Salome::unpolish( QWidget* w )
       w->setAttribute( Qt::WA_Hover, false );
   }
 
-  QWindowsStyle::unpolish( w );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+    QWindowsStyle::unpolish( w );
+#else
+    QCommonStyle::unpolish( w );
+#endif
 }
 
 /*!
@@ -402,7 +426,11 @@ void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComp
                                        QPainter* p, const QWidget* w ) const
 {
   if ( checkDebugLevel(4) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     QWindowsStyle::drawComplexControl( cc, opt, p, w );
+#else
+    QCommonStyle::drawComplexControl( cc, opt, p, w );
+#endif
     return;
   }
 
@@ -554,7 +582,11 @@ void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComp
             if ((slider->subControls & SC_SliderGroove) && groove.isValid()) {
               QStyleOptionSlider tmpSlider = *slider;
               tmpSlider.subControls = SC_SliderGroove;
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
               QWindowsStyle::drawComplexControl(cc, &tmpSlider, p, w);
+#else
+              QCommonStyle::drawComplexControl(cc, &tmpSlider, p, w);
+#endif
             }
             if (slider->subControls & SC_SliderTickmarks) {
               QStyleOptionSlider tmpSlider = *slider;
@@ -625,7 +657,11 @@ void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComp
         if (w && ( qobject_cast<QToolBar *>(w->parentWidget() ) || 
                    ( toolbutton->state & State_AutoRaise && !( toolbutton->state & State_MouseOver ) ) )
             ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
           QWindowsStyle::drawComplexControl( cc, opt, p, w );
+#else
+          QCommonStyle::drawComplexControl( cc, opt, p, w );
+#endif
           return;
         }
         int aMinDelta = (int)model()->widgetRounding( Style_Model::ButtonRadius );
@@ -707,7 +743,11 @@ void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComp
       }
     }
     case CC_TitleBar: {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
       QWindowsStyle::drawComplexControl( cc, opt, p, w );
+#else
+      QCommonStyle::drawComplexControl( cc, opt, p, w );
+#endif
       break;
     }
     case CC_GroupBox:
@@ -757,11 +797,19 @@ void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComp
         break;
       }
     case CC_Dial: {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
       QWindowsStyle::drawComplexControl( cc, opt, p, w );
+#else
+      QCommonStyle::drawComplexControl( cc, opt, p, w );
+#endif
       break;
     }
     default:
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
       QWindowsStyle::drawComplexControl( cc, opt, p, w );
+#else
+      QCommonStyle::drawComplexControl( cc, opt, p, w );
+#endif
   }
 }
 
@@ -776,7 +824,11 @@ void Style_Salome::drawControl( ControlElement ce, const QStyleOption* opt,
                                QPainter* p, const QWidget* w ) const
 {
   if ( checkDebugLevel(5) ) {
-    QWindowsStyle::drawControl( ce, opt, p, w );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+       QWindowsStyle::drawControl( ce, opt, p, w );
+#else
+    QCommonStyle::drawControl( ce, opt, p, w );
+#endif
     return;
   }
 
@@ -905,7 +957,11 @@ void Style_Salome::drawControl( ControlElement ce, const QStyleOption* opt,
           break;
         }
     case CE_Splitter: {
-      QWindowsStyle::drawControl( ce, opt, p, w );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+         QWindowsStyle::drawControl( ce, opt, p, w );
+#else
+      QCommonStyle::drawControl( ce, opt, p, w );
+#endif
       QRect r = opt->rect;
       bool horiz = r.width() > r.height();
       int aLen = model()->splitHandleLength();
@@ -943,7 +999,7 @@ void Style_Salome::drawControl( ControlElement ce, const QStyleOption* opt,
                                 aBrdTopCol, aBrdBotCol, isSelected, isLast, isHover );
           p->restore();
         } else
-           QCommonStyle::drawControl(ce, opt, p, w);
+           QCommonStyle::drawControl( ce, opt, p, w );
         break;
       }
     case CE_TabBarTabLabel:
@@ -962,10 +1018,18 @@ void Style_Salome::drawControl( ControlElement ce, const QStyleOption* opt,
           }
           QStyleOptionTab* copyTab = (QStyleOptionTab*)tab;
           copyTab->rect = oldRect;
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
           QWindowsStyle::drawControl( ce, copyTab, p, w );
+#else
+          QCommonStyle::drawControl( ce, copyTab, p, w );
+#endif
         }
         else
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
           QWindowsStyle::drawControl( ce, opt, p, w );
+#else
+          QCommonStyle::drawControl( ce, opt, p, w );
+#endif
         break;
       }
     case CE_MenuBarItem:
@@ -1494,7 +1558,11 @@ void Style_Salome::drawControl( ControlElement ce, const QStyleOption* opt,
     break;
   }
   default:
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     QWindowsStyle::drawControl( ce, opt, p, w );
+#else
+    QCommonStyle::drawControl( ce, opt, p, w );
+#endif
     break;
   }
 }
@@ -1510,7 +1578,11 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt,
                                   QPainter* p, const QWidget* w ) const
 {
   if ( checkDebugLevel(6) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     QWindowsStyle::drawPrimitive( pe, opt, p, w );
+#else
+    QCommonStyle::drawPrimitive( pe, opt, p, w );
+#endif
     return;
   }
 
@@ -1550,7 +1622,11 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt,
         break;
       }
       else
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
         QWindowsStyle::drawPrimitive( pe, opt, p, w );
+#else
+        QCommonStyle::drawPrimitive( pe, opt, p, w );
+#endif
     }
     break;
     case PE_FrameFocusRect: {
@@ -1566,7 +1642,11 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt,
                               aBrdTopCol, aBrdBotCol, false, false, isHover, true );
       }
       else {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
         QWindowsStyle::drawPrimitive( pe, opt, p, w );
+#else
+        QCommonStyle::drawPrimitive( pe, opt, p, w );
+#endif
       }
       break;
     }
@@ -1641,7 +1721,10 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt,
         p->setPen(opt->palette.text().color());
      } // Fall through!
     case PE_IndicatorViewItemCheck:
-    case PE_Q3CheckListIndicator: {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+    case PE_Q3CheckListIndicator:
+#endif
+    {
       if (!doRestore) {
         p->save();
         doRestore = true;
@@ -1830,7 +1913,11 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt,
       break;
     }
     case PE_Widget: {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
       QWindowsStyle::drawPrimitive( pe, opt, p, w );
+#else
+      QCommonStyle::drawPrimitive( pe, opt, p, w );
+#endif
       if ( !w )
         break;
       if( w->parent() && !qobject_cast<QMenuBar*>((QWidget*)w) )
@@ -1844,7 +1931,11 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt,
           = qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) {
         if (tbb->shape != QTabBar::RoundedNorth && tbb->shape != QTabBar::RoundedEast &&
             tbb->shape != QTabBar::RoundedSouth && tbb->shape != QTabBar::RoundedWest) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
           QWindowsStyle::drawPrimitive( pe, opt, p, w );
+#else
+          QCommonStyle::drawPrimitive( pe, opt, p, w );
+#endif
           break;
         }
         QRect aSelRect = tbb->selectedTabRect;
@@ -1960,11 +2051,19 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt,
         aPal.setBrush( QPalette::AlternateBase, QBrush( gr_alt ) );
         aWdg->setPalette( aPal );
       }
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
       QWindowsStyle::drawPrimitive( pe, opt, p, w );
+#else
+      QCommonStyle::drawPrimitive( pe, opt, p, w );
+#endif
       break;
     }
     default:
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
       QWindowsStyle::drawPrimitive( pe, opt, p, w );
+#else
+      QCommonStyle::drawPrimitive( pe, opt, p, w );
+#endif
   }
 }
 
@@ -1979,10 +2078,17 @@ int Style_Salome::pixelMetric( PixelMetric metric, const QStyleOption* opt,
                                const QWidget* w ) const
 {
   if ( checkDebugLevel(7) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     return QWindowsStyle::pixelMetric( metric, opt, w );
+#else
+    return QCommonStyle::pixelMetric( metric, opt, w );
+#endif
   }
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   int aRes = QWindowsStyle::pixelMetric( metric, opt, w );
+#else
+  int aRes = QCommonStyle::pixelMetric( metric, opt, w );
+#endif
   switch( metric ) {
     case PM_SliderLength: {
       aRes += (int)((double)model()->sliderSize()/2);
@@ -2019,10 +2125,17 @@ QSize Style_Salome::sizeFromContents( ContentsType ct, const QStyleOption* opt,
                                       const QSize& contentsSize, const QWidget* w ) const
 {
   if ( checkDebugLevel(8) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     return QWindowsStyle::sizeFromContents( ct, opt,contentsSize, w );
+#else
+    return QCommonStyle::sizeFromContents( ct, opt,contentsSize, w );
+#endif
   }
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   QSize sz = QWindowsStyle::sizeFromContents( ct, opt, contentsSize, w );
+#else
+  QSize sz = QCommonStyle::sizeFromContents( ct, opt, contentsSize, w );
+#endif
   switch (ct) {
     case CT_TabBarTab:
       if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
@@ -2051,8 +2164,13 @@ QSize Style_Salome::sizeFromContents( ContentsType ct, const QStyleOption* opt,
           QRect res = QRect( 0, 0, sz.width(), sz.height() );
           int aHalfRect = (int)Style_Tools::getMaxRect( res, 
                              (int)model()->widgetRounding( Style_Model::EditRadius )/2 ); // left value
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
           QRect old_arrow = QWindowsStyle::subControlRect( CC_ComboBox, cmb,
                                                            SC_ComboBoxArrow, w );
+#else
+          QRect old_arrow = QCommonStyle::subControlRect( CC_ComboBox, cmb,
+                                                          SC_ComboBoxArrow, w );
+#endif
           int aDelta = res.height() - old_arrow.width(); // right value
           if ( cmb->editable )
             aDelta += aHalfRect; // for right of line edit internal
@@ -2076,7 +2194,11 @@ QPixmap Style_Salome::standardPixmap(StandardPixmap stPixmap, const QStyleOption
                                      const QWidget *w) const
 {
   if ( checkDebugLevel(9) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     return QWindowsStyle::standardPixmap( stPixmap, opt, w );
+#else
+    return QCommonStyle::standardPixmap( stPixmap, opt, w );
+#endif
   }
 
   switch ( stPixmap )
@@ -2091,7 +2213,11 @@ QPixmap Style_Salome::standardPixmap(StandardPixmap stPixmap, const QStyleOption
   case SP_TitleBarMinButton:
     return QPixmap( minimize_xpm );
   default:
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     return QWindowsStyle::standardPixmap( stPixmap, opt, w );
+#else
+    return QCommonStyle::standardPixmap( stPixmap, opt, w );
+#endif
   }
 }
 
@@ -2107,7 +2233,11 @@ QIcon Style_Salome::standardIconImplementation( StandardPixmap standardIcon,
                                                 const QWidget* w ) const
 {
   if ( checkDebugLevel(10) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     return QWindowsStyle::standardIconImplementation( standardIcon, opt, w );
+#else
+    return QCommonStyle::standardIcon( standardIcon, opt, w );
+#endif
   }
 
   switch ( standardIcon )
@@ -2123,7 +2253,11 @@ QIcon Style_Salome::standardIconImplementation( StandardPixmap standardIcon,
   default:
     break;
   }
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   return QWindowsStyle::standardIconImplementation( standardIcon, opt, w );
+#else
+  return QCommonStyle::standardIcon( standardIcon, opt, w );
+#endif
 }
 
 /*!
@@ -2139,10 +2273,17 @@ int Style_Salome::styleHint( StyleHint hint, const QStyleOption* opt, const QWid
                             QStyleHintReturn* returnData ) const
 {
   if ( checkDebugLevel(11) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     return QWindowsStyle::styleHint( hint, opt, w, returnData );
+#else
+    return QCommonStyle::styleHint( hint, opt, w, returnData );
+#endif
   }
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   int aRes = QWindowsStyle::styleHint( hint, opt, w, returnData );
+#else
+  int aRes = QCommonStyle::styleHint( hint, opt, w, returnData );
+#endif
   switch( hint ) {
     case SH_Table_GridLineColor: {
       if ( opt )
@@ -2171,15 +2312,26 @@ QRect Style_Salome::subControlRect( ComplexControl cc, const QStyleOptionComplex
                                     SubControl sc, const QWidget* wid ) const
 {
   if ( checkDebugLevel(12) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     return QWindowsStyle::subControlRect( cc, opt, sc, wid );
+#else
+    return QCommonStyle::subControlRect( cc, opt, sc, wid );
+#endif
   }
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   QRect res = QWindowsStyle::subControlRect( cc, opt, sc, wid );
+#else
+  QRect res = QCommonStyle::subControlRect( cc, opt, sc, wid );
+#endif
   switch ( cc ) {
     case CC_SpinBox: {
       int x = res.x(), w = res.width(), h = res.height();
       if ( sc==SC_SpinBoxUp || sc==SC_SpinBoxDown ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
         QRect frame_r = QWindowsStyle::subControlRect( cc, opt, SC_SpinBoxFrame, wid );
+#else
+        QRect frame_r = QCommonStyle::subControlRect( cc, opt, SC_SpinBoxFrame, wid );
+#endif
         h = frame_r.height();
         res.setX( x+w-h );
         res.setWidth( h );
@@ -2215,7 +2367,11 @@ QRect Style_Salome::subControlRect( ComplexControl cc, const QStyleOptionComplex
     }
     case CC_ScrollBar:
       if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
         QRect slider_r = QWindowsStyle::subControlRect( cc, opt, SC_ScrollBarSlider, wid );
+#else
+        QRect slider_r = QCommonStyle::subControlRect( cc, opt, SC_ScrollBarSlider, wid );
+#endif
         int aRect = Style_Tools::getMaxRect( slider_r, (int)model()->widgetRounding( Style_Model::ButtonRadius ) );
         switch( sc ) {
           case SC_ScrollBarSubPage:            // between top/left button and slider
@@ -2269,17 +2425,30 @@ QRect Style_Salome::subElementRect( SubElement se, const QStyleOption* opt,
                                    const QWidget* wid ) const
 {
   if ( checkDebugLevel(13) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     return QWindowsStyle::subElementRect( se, opt, wid );
+#else
+    return QCommonStyle::subElementRect( se, opt, wid );
+#endif
   }
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   QRect res = QWindowsStyle::subElementRect( se, opt, wid );
+#else
+  QRect res = QCommonStyle::subElementRect( se, opt, wid );
+#endif
   int aHalfRect = (int)Style_Tools::getMaxRect( res, (int)model()->widgetRounding( Style_Model::EditRadius )/2 );
   int w = res.width(), h = res.height();
   switch ( se ) {
     case SE_ComboBoxFocusRect: {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
       QRect old_r = QWindowsStyle::subControlRect( CC_ComboBox,
                      qstyleoption_cast<const QStyleOptionComplex*>( opt ),
                      SC_ComboBoxArrow, wid );
+#else
+      QRect old_r = QCommonStyle::subControlRect( CC_ComboBox,
+                     qstyleoption_cast<const QStyleOptionComplex*>( opt ),
+                     SC_ComboBoxArrow, wid );
+#endif
       int old_w = old_r.width();
       res.setWidth( w-h+old_w-2 );
       break;
index 36b7216f97a552c36d5f960f77e9a3804139ad30..846022e9d041c4efd584de42fe8b91c904a7be2e 100644 (file)
 #define STYLE_SALOME_H
 
 #include "Style.h"
-
+#include <QtGlobal>
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 #include <QWindowsStyle>
-
+#else
+#include <QCommonStyle>
+#endif
 class Style_Model;
 
 class QApplication;
@@ -34,7 +37,12 @@ class QWidget;
 class QPainter;
 class QtxResourceMgr;
 
-class STYLE_SALOME_EXPORT Style_Salome : public QWindowsStyle
+class STYLE_SALOME_EXPORT Style_Salome
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+: public QWindowsStyle
+#else
+: public QCommonStyle
+#endif
 {
   Q_OBJECT
 
index 94ed39d56660cb6f3ee126d39be1e0cd1ad6a0fd..d391fc67668282a1c94fc58738feaa673894eae2 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 INCLUDE_DIRECTORIES(
@@ -78,7 +78,7 @@ SET(_ts_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
@@ -97,5 +97,4 @@ TARGET_LINK_LIBRARIES(ToolsGUI ${_link_LIBRARIES})
 INSTALL(TARGETS ToolsGUI EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${ToolsGUI_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
-
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
index 4414f2badba163d07052295226134c57a67d12a6..9a91e55fe2cbf96161c41b12f76d53f9c6d4cc1b 100755 (executable)
@@ -17,9 +17,9 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-ADD_SUBDIRECTORY(Test)
+INCLUDE(UseQtExt)
 
-INCLUDE(UseQt4Ext)
+ADD_SUBDIRECTORY(Test)
 
 # --- options ---
 
@@ -82,7 +82,7 @@ SET(SalomeTreeData_HEADERS ${_moc_HEADERS} ${_other_HEADERS})
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
index cda647b15424a18cf93b4c01310592ed0b410721..68853f2551e7bbbafdcdfb0b452d68479b3f0a3a 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -52,12 +52,12 @@ SET(_uic_files mainwindow.ui)
 SET(_moc_HEADERS mainwindow.hxx)
 
 # header files / uic wrappings
-QT4_WRAP_UI(_uic_HEADERS ${_uic_files})
-
-# --- sources ---
+QT_WRAP_UIC(_uic_HEADERS ${_uic_files})
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
+
+# --- sources ---
 
 # sources / to compile
 SET(TreeData_guitester_SOURCES MyDataModel.cxx guitester.cxx mainwindow.cxx testhelper.cxx ${_moc_SOURCES} ${_uic_HEADERS})
index 7192e88cfa9277335e58869db78fb67cb9bebb6d..6bb54339b6db954316344375c5bc3c2bb61bdcef 100755 (executable)
@@ -17,8 +17,8 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
 INCLUDE(${VTK_USE_FILE})
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -128,11 +128,11 @@ SET(_other_RESOURCES
 
 # --- sources ---
 
-# sources / rcc wrappings
-QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
-
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
+
+# sources / rcc wrappings
+QT_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
 
 # sources / static
 SET(_other_SOURCES
@@ -177,7 +177,7 @@ TARGET_LINK_LIBRARIES(VTKViewer ${_link_LIBRARIES})
 INSTALL(TARGETS VTKViewer EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${VTKViewer_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
 
 INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
 FILE(GLOB GUIPNG_DATA "${CMAKE_CURRENT_SOURCE_DIR}/resources/*.png")
@@ -188,6 +188,3 @@ INSTALL(FILES ${GUIVTI_DATA} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
 
 FILE(GLOB GUITXT_DATA "${CMAKE_CURRENT_SOURCE_DIR}/resources/*.txt")
 INSTALL(FILES ${GUITXT_DATA} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
-
-
-
index a42f1653516ad3fdaa7d58129f8cd25bb72997d2..2395f8c965d0adbd0076d334312222973ec77041 100755 (executable)
@@ -34,9 +34,6 @@
 #ifndef WIN32
 #include <QX11Info>
 #include <vtkXOpenGLRenderWindow.h>
-//#include <GL/gl.h>
-//#include <GL/glu.h>
-//#include <qgl.h>
 #endif
 
 /*!Constructor. Create render window with parant \a parent and name \a name.
index a38825f24040f79ceb75179dbccafadd1bba048f..8cc34a3c5f1c82f60e08f2c8ee77a452ff20ded8 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -60,7 +60,7 @@ SET(_ts_RESOURCES
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
@@ -79,4 +79,4 @@ TARGET_LINK_LIBRARIES(ViewerTools ${_link_LIBRARIES})
 INSTALL(TARGETS ViewerTools EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 INSTALL(FILES ${ViewerTools_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
index dd63d6b6a30dac0396527dd9e244f953a6026534..6490c2edc32388060dabcc8c0573caa9322571ac 100755 (executable)
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 INCLUDE_DIRECTORIES(
   ${CMAKE_CURRENT_BINARY_DIR}
   ${CMAKE_CURRENT_SOURCE_DIR}
   )
 
-
 SET(qtester_SOURCES
   qtester.cxx
   )
@@ -57,7 +55,7 @@ SET(GenericDialog_HEADERS
 SET(GenericDialog_FORMS
    GenericDialog.ui
    )
-  
+
 ADD_DEFINITIONS(${QT_DEFINITIONS})
 
 ADD_CUSTOM_COMMAND( OUTPUT QDialogTest.cxx  QDialogTest.h  QDialogTest.ui
@@ -68,21 +66,21 @@ ADD_CUSTOM_COMMAND( OUTPUT GDialogTest.cxx  GDialogTest.h  GDialogTest.ui
   COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dlgfactory.py -s -n GDialogTest -t gdialog
   )
 
-QT4_WRAP_UI(qtester_FORMS_HEADERS ${qtester_FORMS} )
-QT4_WRAP_CPP(qtester_HEADERS_MOC ${qtester_HEADERS})
-
+  QT_WRAP_UIC(qtester_FORMS_HEADERS ${qtester_FORMS} )
+  QT_WRAP_MOC(qtester_HEADERS_MOC ${qtester_HEADERS})
 
-QT4_WRAP_UI(gtester_FORMS_HEADERS ${gtester_FORMS} )
-QT4_WRAP_CPP(gtester_HEADERS_MOC ${gtester_HEADERS})
+  QT_WRAP_UIC(gtester_FORMS_HEADERS ${gtester_FORMS} )
+  QT_WRAP_MOC(gtester_HEADERS_MOC ${gtester_HEADERS})
 
-QT4_WRAP_UI(GenericDialog_FORMS_HEADERS ${GenericDialog_FORMS} )
-QT4_WRAP_CPP(GenericDialog_HEADERS_MOC ${GenericDialog_HEADERS})
+  QT_WRAP_UIC(GenericDialog_FORMS_HEADERS ${GenericDialog_FORMS} )
+  QT_WRAP_MOC(GenericDialog_HEADERS_MOC ${GenericDialog_HEADERS})
 
 ADD_EXECUTABLE(qtester ${qtester_SOURCES} 
     ${qtester_HEADERS_MOC} 
     ${qtester_FORMS_HEADERS}
     QDialogTest.cxx
     )
+    
 TARGET_LINK_LIBRARIES(qtester ${QT_LIBRARIES})
 
 ADD_EXECUTABLE(gtester ${gtester_SOURCES}