Salome HOME
Merge Qt5 porting. V8_0_0a1
authorimn <imn@opencascade.com>
Thu, 12 Nov 2015 14:13:55 +0000 (17:13 +0300)
committerrnv <rnv@opencascade.com>
Fri, 25 Dec 2015 09:17:37 +0000 (12:17 +0300)
157 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/FindSalomeQt4.cmake
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/CAF_Study.cxx
src/CAF/CMakeLists.txt
src/CAM/CAM_Module.cxx
src/CAM/CAM_Module.h
src/CAM/CMakeLists.txt
src/DDS/CMakeLists.txt
src/Event/CMakeLists.txt
src/GLViewer/CMakeLists.txt
src/GLViewer/GLViewer_BaseObjects.cxx
src/GLViewer/GLViewer_Context.cxx
src/GLViewer/GLViewer_Context.h
src/GLViewer/GLViewer_Drawer.cxx
src/GLViewer/GLViewer_Grid.cxx
src/GLViewer/GLViewer_ViewPort.cxx
src/GLViewer/GLViewer_ViewPort2d.cxx
src/GLViewer/GLViewer_Viewer.cxx
src/GLViewer/GLViewer_Viewer2d.cxx
src/GLViewer/GLViewer_Widget.cxx
src/GUI_PY/CMakeLists.txt
src/GraphicsView/CMakeLists.txt
src/GraphicsView/GraphicsView_Object.cxx
src/GuiHelpers/CMakeLists.txt
src/HelpBrowser/CMakeLists.txt
src/HelpBrowser/qtlocalpeer.cpp
src/ImageComposer/CMakeLists.txt
src/LightApp/CMakeLists.txt
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Dialog.cxx
src/LightApp/LightApp_Driver.cxx
src/LightApp/LightApp_ModuleAction.cxx
src/LightApp/LightApp_NameDlg.cxx
src/LogWindow/CMakeLists.txt
src/OBJECT/CMakeLists.txt
src/OCCViewer/CMakeLists.txt
src/OCCViewer/OCCViewer_ClippingDlg.cxx
src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx
src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx
src/OCCViewer/OCCViewer_SetRotationPointDlg.h
src/OCCViewer/OCCViewer_Utilities.cxx
src/OCCViewer/OCCViewer_ViewModel.cxx
src/OCCViewer/OCCViewer_ViewPort.cxx
src/OCCViewer/OCCViewer_ViewPort3d.cxx
src/OCCViewer/OCCViewer_ViewSketcher.cxx
src/ObjBrowser/CMakeLists.txt
src/PVViewer/CMakeLists.txt
src/Plot2d/CMakeLists.txt
src/Plot2d/Plot2d_FitDataDlg.cxx
src/Plot2d/Plot2d_PlotItems.cxx
src/Plot2d/Plot2d_SetupViewDlg.cxx
src/Plot2d/Plot2d_ViewFrame.cxx
src/PyConsole/CMakeLists.txt
src/PyConsole/PyConsole_EnhEditor.cxx
src/PyConsole/PyConsole_EnhEditor.h
src/PyEditor/CMakeLists.txt
src/PyEditor/PyEditor_SettingsDlg.cxx
src/PyInterp/CMakeLists.txt
src/PyViewer/CMakeLists.txt
src/PyViewer/PyViewer_ViewWindow.cxx
src/QDS/CMakeLists.txt
src/QDS/QDS_Datum.cxx
src/Qtx/CMakeLists.txt
src/Qtx/Qtx.cxx
src/Qtx/QtxAction.cxx
src/Qtx/QtxAction.h
src/Qtx/QtxActionToolMgr.cxx
src/Qtx/QtxColorButton.cxx
src/Qtx/QtxDialog.cxx
src/Qtx/QtxDockAction.cxx
src/Qtx/QtxFontEdit.cxx
src/Qtx/QtxLogoMgr.cxx
src/Qtx/QtxMainWindow.cxx
src/Qtx/QtxPathDialog.cxx
src/Qtx/QtxPathEdit.cxx
src/Qtx/QtxPopupMgr.cxx
src/Qtx/QtxPreferenceMgr.cxx
src/Qtx/QtxResourceMgr.cxx
src/Qtx/QtxSearchTool.cxx
src/Qtx/QtxTranslator.cxx
src/Qtx/QtxTranslator.h
src/Qtx/QtxTreeView.cxx
src/Qtx/QtxWorkspace.cxx
src/Qtx/QtxWorkspace.h
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.cxx
src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip
src/SOCC/CMakeLists.txt
src/SPlot2d/CMakeLists.txt
src/STD/CMakeLists.txt
src/STD/STD_MDIDesktop.cxx
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_Desktop.cxx
src/SUIT/SUIT_FileDlg.cxx
src/SUIT/SUIT_ResourceMgr.cxx
src/SUIT/SUIT_TreeModel.cxx
src/SUIT/SUIT_ViewManager.cxx
src/SUIT/SUIT_ViewWindow.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_ComboAction.cxx
src/SVTK/SVTK_GenericRenderWindowInteractor.cxx
src/SVTK/SVTK_NonIsometricDlg.cxx
src/SVTK/SVTK_RenderWindowInteractor.cxx
src/SVTK/SVTK_RenderWindowInteractor.h
src/SVTK/SVTK_SetRotationPointDlg.cxx
src/SVTK/SVTK_SpaceMouse.cxx
src/SVTK/SVTK_SpaceMouse.h
src/SVTK/SVTK_UpdateRateDlg.cxx
src/SVTK/SVTK_ViewModel.cxx
src/SVTK/SVTK_ViewParameterDlg.cxx
src/SalomeApp/CMakeLists.txt
src/SalomeApp/SalomeApp_Application.cxx
src/SalomeApp/SalomeApp_Engine_i.cxx
src/SalomeApp/SalomeApp_ListView.cxx
src/SalomeApp/SalomeApp_StudyPropertiesDlg.cxx
src/SalomeApp/pluginsdemo/CMakeLists.txt
src/Session/SALOME_Session_Server.cxx
src/Session/Session_ServerCheck.cxx
src/Session/Session_Session_i.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/TreeData/Test/mainwindow.cxx
src/VTKViewer/CMakeLists.txt
src/VTKViewer/VTKViewer_RenderWindow.cxx
src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx
src/ViewerTools/CMakeLists.txt
src/ViewerTools/ViewerTools_DialogBase.h
tools/dlgfactory/CMakeLists.txt

index df762efd0dfc0cf66eb7069b0e947f29f971e62b..816db6fed0cb4b4470139c115e8a712209f5b0bb 100755 (executable)
@@ -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" OFF)
 
 # 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)
@@ -126,7 +128,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)
@@ -146,12 +148,20 @@ 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)
-INCLUDE(${QT_USE_FILE})
+# Qt
+IF(NOT SALOME_BUILD_WITH_QT5)
+  FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtWebKit QtOpenGL QtNetwork)
+  ADD_DEFINITIONS("-DUSE_SALOME_STYLE")
+ELSE()
+  FIND_PACKAGE(SalomeQt5 REQUIRED)
+ENDIF()
 
-# PyQt4
-FIND_PACKAGE(SalomePyQt4 REQUIRED)
+# PyQt
+IF (NOT SALOME_BUILD_WITH_QT5)
+  FIND_PACKAGE(SalomePyQt4 REQUIRED)
+ELSE()
+  FIND_PACKAGE(SalomePyQt5 REQUIRED)
+ENDIF()
 
 # Optional prerequisites for GUI
 IF(NOT SALOME_USE_GLVIEWER)
@@ -168,7 +178,7 @@ ELSE()
   ADD_DEFINITIONS("-DDISABLE_VTKVIEWER")
 ENDIF()
 IF(SALOME_USE_PLOT2DVIEWER)
-  FIND_PACKAGE(SalomeQwt)  
+  FIND_PACKAGE(SalomeQwt)
   SALOME_LOG_OPTIONAL_PACKAGE(Qwt SALOME_USE_PLOT2DVIEWER)
 ELSE()
   ADD_DEFINITIONS("-DDISABLE_PLOT2DVIEWER")
@@ -176,6 +186,13 @@ ENDIF()
 IF (SALOME_USE_PVVIEWER)
   FIND_PACKAGE(SalomeParaView)
   SALOME_LOG_OPTIONAL_PACKAGE(ParaView SALOME_USE_PVVIEWER)
+  IF(SALOME_BUILD_WITH_QT5)
+    # RNV: Temporary solution: because ParaView CMake procedure 
+    #      defines Qt5_DIR variable, which is used in the SALOME_CONFIGURE_PREPARE
+    #      macro, and as a result leads to the broken SALOME<module>Config.cmake file. 
+    #      TODO: investigate this  !!!
+    UNSET(Qt5_DIR CACHE)
+  ENDIF()
 ELSE()
   ADD_DEFINITIONS("-DDISABLE_PVVIEWER")
 ENDIF()
@@ -204,6 +221,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")
@@ -353,7 +371,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 
@@ -385,8 +402,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}")
@@ -395,13 +417,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?):
@@ -412,7 +438,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 5010a661f8dabaf157ca49a0c27cbd82d1be5dad..641eacac8dc8b010510e286ffe5cd4e594d5d3b1 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 8fabf8484fd90bb0c19fff367c6f073faf058c71..e52bb57b6c8c0a079d73ece1a34885b503127c07 100755 (executable)
@@ -29,14 +29,17 @@ 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
-  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..b255db0
--- /dev/null
@@ -0,0 +1,116 @@
+# 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_INCLUDE_DIRS      - list of paths to include when compiling (all rooted on PYQT_SIP_DIRS)
+#    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_INCLUDE_DIRS
+  "${PYQT_SIPS_DIR}"
+  "${PYQT_SIPS_DIR}/QtCore"
+  "${PYQT_SIPS_DIR}/QtGui"
+  "${PYQT_SIPS_DIR}/QtXml"
+  "${PYQT_SIPS_DIR}/QtOpenGL"
+  "${PYQT_SIPS_DIR}/QtAssistant"
+  "${PYQT_SIPS_DIR}/QtDesigner"
+  "${PYQT_SIPS_DIR}/QtNetwork"
+  "${PYQT_SIPS_DIR}/QtSql"
+  "${PYQT_SIPS_DIR}/QtSvg"
+  "${PYQT_SIPS_DIR}/QtTest"
+)
+
+SET(PYQT_CXX_EXT ".cc")
+SET(PYQT_SIPFLAGS ${PYQT_SIPFLAGS} -s ${PYQT_CXX_EXT} -c .)
+FOREACH(_dir ${PYQT_INCLUDE_DIRS})
+  LIST(APPEND PYQT_SIPFLAGS -I ${_dir})
+ENDFOREACH()
+
+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 4363516baadca4e751d2f483b8e86c93bd6517c4..08c01ebc7cdd2b59dd99a57a6f92b09957b2bcd1 100644 (file)
 # Author: Adrien Bruneton
 #
 
-# Graphviz detection for salome
+# ParaView detection for salome
 #
 #  !! Please read the generic detection procedure in SalomeMacros.cmake !!
 #
 
+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)
-#MARK_AS_ADVANCED()
 
 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()
index a89fc81a80216f985bd78f093bdca1fac13c3507..86faa8232d1e9aa42601cb74cc1168f298b30b8b 100644 (file)
 #
 #  !! Please read the generic detection procedure in SalomeMacros.cmake !!
 #
+
 SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt4 QT_INCLUDES 2)
 MARK_AS_ADVANCED(QT_QMAKE_EXECUTABLE)
 
+# 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(QT4_FOUND) 
   SALOME_ACCUMULATE_HEADERS(QT_INCLUDES)
   SALOME_ACCUMULATE_ENVIRONMENT(PATH ${QT_QMAKE_EXECUTABLE})
   SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${QT_QTCORE_LIBRARY})
+  SET(QT_VERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}")
+  MESSAGE(STATUS "Qt version is ${QT_VERSION}")
 ENDIF()
diff --git a/adm_local/cmake_files/FindSalomeQt5.cmake b/adm_local/cmake_files/FindSalomeQt5.cmake
new file mode 100644 (file)
index 0000000..e3d7694
--- /dev/null
@@ -0,0 +1,69 @@
+# 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_EXECUTABLE} 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}")
+  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..1c60d16
--- /dev/null
@@ -0,0 +1,214 @@
+# Copyright (C) 2012-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: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+####################################################################
+#
+# _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_files)
+#
+# ARGUMENTS:
+#   output_files [out] variable where output file names are listed to
+#   sip_files    [in]  list of *.sip files
+# 
+# NOTES:
+#   - Input files are considered relative to the current source directory.
+#   - Output files are generated in the current build directory.
+#   - This version of macro requires class(es) definition in the 
+#     *.sip file to be started on a new line without any preceeding characters.
+# 
+# WARNING:
+#   - The macro does not properly processes sip features which are wrapped
+#     with sip conditionals.
+#   - The macro works only if one single sip module is processed
+#     (there's only one %Module directive within all input sip files).
+#
+# TODO:
+#   - Check if dependency of static sources on generated headers works properly:
+#     if header is changed, dependant sources should be recompiled.
+#   - Think how to properly process sip conditionals.
+#   - Process several sip modules.
+# 
+####################################################################
+MACRO(PYQT_WRAP_SIP outfiles)
+  SET(_output)
+  SET(_module_input)
+  FOREACH(_input ${ARGN})
+    FILE(STRINGS ${_input} _sip_modules REGEX "%Module")
+    FILE(STRINGS ${_input} _sip_classes REGEX "^class ")
+    FOREACH(_sip_module ${_sip_modules})
+      STRING(REGEX MATCH ".*%Module *\\( *name=.*\\).*" _mod_name "${_sip_module}")
+      IF (_mod_name)
+       STRING(REGEX REPLACE ".*%Module *\\( *name=(.*).*\\).*" "\\1" _mod_name ${_sip_module})
+      ELSE()
+       STRING(REGEX REPLACE ".*%Module *(.*)" "\\1" _mod_name ${_sip_module})
+      ENDIF()
+      SET(_mod_header "sipAPI${_mod_name}.h")
+      SET(_mod_source "sip${_mod_name}cmodule${PYQT_CXX_EXT}")
+      LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/${_mod_source})
+      SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/${_mod_source})
+      SET(_module_input ${_input})
+    ENDFOREACH()
+    FOREACH(_sip_class ${_sip_classes})
+      STRING(REGEX MATCH ".*class +.* *:" _class_name "${_sip_class}")
+      IF (_class_name)
+       STRING(REGEX REPLACE ".*class +(.*) *:.*" "\\1" _class_name ${_sip_class})
+      ELSE()
+       STRING(REGEX REPLACE ".*class *(.*)" "\\1" _class_name ${_sip_class})
+      ENDIF()
+      STRING(STRIP ${_class_name} _class_name)
+      SET(_class_source "sip${_mod_name}${_class_name}${PYQT_CXX_EXT}")
+      LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/${_class_source})
+      SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/${_class_source})
+    ENDFOREACH()
+  ENDFOREACH()
+  ADD_CUSTOM_COMMAND(
+    OUTPUT ${_output}
+    COMMAND ${SIP_EXECUTABLE} ${PYQT_SIPFLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${_module_input}
+    MAIN_DEPENDENCY ${_module_input}
+    )
+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 ee3ec45..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-# Copyright (C) 2012-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: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
-
-####################################################################
-#
-# _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_files)
-#
-# ARGUMENTS:
-#   output_files [out] variable where output file names are listed to
-#   sip_files    [in]  list of *.sip files
-# 
-# NOTES:
-#   - Input files are considered relative to the current source directory.
-#   - Output files are generated in the current build directory.
-#   - This version of macro requires class(es) definition in the 
-#     *.sip file to be started on a new line without any preceeding characters.
-# 
-# WARNING:
-#   - The macro does not properly processes sip features which are wrapped
-#     with sip conditionals.
-#   - The macro works only if one single sip module is processed
-#     (there's only one %Module directive within all input sip files).
-#
-# TODO:
-#   - Check if dependency of static sources on generated headers works properly:
-#     if header is changed, dependant sources should be recompiled.
-#   - Think how to properly process sip conditionals.
-#   - Process several sip modules.
-# 
-####################################################################
-MACRO(PYQT4_WRAP_SIP outfiles)
-  SET(_output)
-  SET(_module_input)
-  FOREACH(_input ${ARGN})
-    FILE(STRINGS ${_input} _sip_modules REGEX "%Module")
-    FILE(STRINGS ${_input} _sip_classes REGEX "^class ")
-    FOREACH(_sip_module ${_sip_modules})
-      STRING(REGEX MATCH ".*%Module *\\( *name=.*\\).*" _mod_name "${_sip_module}")
-      IF (_mod_name)
-       STRING(REGEX REPLACE ".*%Module *\\( *name=(.*).*\\).*" "\\1" _mod_name ${_sip_module})
-      ELSE()
-       STRING(REGEX REPLACE ".*%Module *(.*)" "\\1" _mod_name ${_sip_module})
-      ENDIF()
-      SET(_mod_header "sipAPI${_mod_name}.h")
-      SET(_mod_source "sip${_mod_name}cmodule${PYQT_CXX_EXT}")
-      LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/${_mod_source})
-      SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/${_mod_source})
-      SET(_module_input ${_input})
-    ENDFOREACH()
-    FOREACH(_sip_class ${_sip_classes})
-      STRING(REGEX MATCH ".*class +.* *:" _class_name "${_sip_class}")
-      IF (_class_name)
-       STRING(REGEX REPLACE ".*class +(.*) *:.*" "\\1" _class_name ${_sip_class})
-      ELSE()
-       STRING(REGEX REPLACE ".*class *(.*)" "\\1" _class_name ${_sip_class})
-      ENDIF()
-      STRING(STRIP ${_class_name} _class_name)
-      SET(_class_source "sip${_mod_name}${_class_name}${PYQT_CXX_EXT}")
-      LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/${_class_source})
-      SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/${_class_source})
-    ENDFOREACH()
-  ENDFOREACH()
-  ADD_CUSTOM_COMMAND(
-    OUTPUT ${_output}
-    COMMAND ${SIP_EXECUTABLE} ${PYQT_SIPFLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${_module_input}
-    MAIN_DEPENDENCY ${_module_input}
-    )
-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 32e776c..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# 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
-#
-
-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..03e40f2
--- /dev/null
@@ -0,0 +1,68 @@
+# 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
+#
+
+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 054e71d58bdd7670ea03a12ead80c37b4064577c..d60fd3516d8f3162425481c47d80b5457b98b013 100755 (executable)
@@ -168,8 +168,8 @@ bool CAF_Study::saveDocumentAs( const QString& fname )
   bool save = false;
   if ( !stdDoc().IsNull() && stdDoc()->IsSaved() )
   {
-    QString path = QDir::convertSeparators( CAF_Tools::toQString( stdDoc()->GetPath() ) );
-    save = path == QDir::convertSeparators( fname );
+    QString path = QDir::toNativeSeparators( CAF_Tools::toQString( stdDoc()->GetPath() ) );
+    save = path == QDir::toNativeSeparators( fname );
   }
 
   bool status = false;
index dc2abccefadd1bb97af53766a27957dbc1122a71..a344486046a0598d2d590f12157dfdfd7cd2c514 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}")
\ No newline at end of file
index 5ad1dad489a8b0a86ec04dc0733b838e192dcbdb..a2cd873f0b8a6af3b6dc5c993c15359b2e1e3fd9 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 69c5415054ca1515c21d2994c61a1b3e2a5c0ce3..a744f5186e43996faba9c8900303a43bafb520ad 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 f80a03defb4c55b99a73b77c49e136bcb493c64e..012c32b5e95b8086e682012292f9c7a7f10479c8 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}")
\ No newline at end of file
index 58279d66b93b1847ba3d36791e3448b550528c0c..2ece4237ccae87c550548dccf2eee455b377f8b0 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 9da4673397a269cc4004ec2119d370c99fa9474b..8f753936ed56ec7ea072b16d65a0f0add7af7703 100755 (executable)
@@ -19,6 +19,9 @@
 
 # --- options ---
 
+# additional include directories
+INCLUDE_DIRECTORIES(${QT_INCLUDES})
+
 # additional preprocessor / compiler flags
 ADD_DEFINITIONS(${QT_DEFINITIONS})
 
index 2a67388abf2932bfb048f519a9beca1c41b9f75b..7cdc7825cc1326e309b8f515c782c0663c0effb6 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 3773bb8734959d56c9581042f5c1e6f1563bfd55..bec5bf103c12b334a65aee293de90c7adba4a6ca 100644 (file)
@@ -212,7 +212,7 @@ bool GLViewer_MarkerSet::translateToPS( QFile& hFile, GLViewer_CoordSystem* aVie
     }
     aBuffer+="closepath\nstroke\n";
 
-    hFile.write( aBuffer.toAscii() );
+    hFile.write( aBuffer.toLatin1() );
 
     return true;
 }
@@ -250,7 +250,7 @@ bool GLViewer_MarkerSet::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aV
         }
         aBuffer+="PU;\n";
 
-        hFile.write( aBuffer.toAscii() );
+        hFile.write( aBuffer.toLatin1() );
     }
 
     return true;
@@ -370,12 +370,12 @@ GLboolean GLViewer_MarkerSet::highlight( GLfloat x, GLfloat y, GLfloat tol, GLbo
     if ( ( isCircle && ( xdist * xdist + ydist * ydist <= myMarkerSize * myMarkerSize ) ) ||
          ( !isCircle && ( fabs( xdist ) <= radius && fabs( ydist ) <= radius ) ) )
     {
-      isFound = FALSE;
+      isFound = false;
       count++;
       for ( it = myCurSelNumbers.begin(); it != myCurSelNumbers.end(); ++it )
         if( i == *it )
         {
-          isFound = TRUE;
+          isFound = true;
           curHNumbers.append( i );
         }
       
@@ -462,13 +462,13 @@ GLboolean GLViewer_MarkerSet::select( GLfloat x, GLfloat y, GLfloat tol, GLViewe
       count++;
       if ( isShift )
       {
-        bool isFound = FALSE;
+        bool isFound = false;
           for( it = mySelNumbers.begin(); it != mySelNumbers.end(); ++it )
             if ( *it == i )
             {
               myUSelNumbers.append( *it );
             remIt = it;
-              isFound = TRUE;
+              isFound = true;
               break;
             }
 
@@ -651,7 +651,7 @@ void GLViewer_MarkerSet::exportNumbers( QList<int>& highlight,
 bool GLViewer_MarkerSet::addOrRemoveSelected( int index )
 {
   if( index < 0 || index > myNumber )
-    return FALSE;
+    return false;
 
   int n = mySelNumbers.indexOf( index );
   if( n == -1 )
@@ -661,7 +661,7 @@ bool GLViewer_MarkerSet::addOrRemoveSelected( int index )
     mySelNumbers.removeAt(n);
     myUSelNumbers.append( index );
   }
-  return TRUE;
+  return true;
 }
 
 /*!
@@ -869,7 +869,7 @@ bool GLViewer_Polyline::translateToPS( QFile& hFile, GLViewer_CoordSystem* aView
 
     aBuffer+="closepath\nstroke\n";
     
-    hFile.write( aBuffer.toAscii() );
+    hFile.write( aBuffer.toLatin1() );
 
     return true;
 }
@@ -895,7 +895,7 @@ bool GLViewer_Polyline::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aVi
 
     aBuffer+="PU;\n";
     
-    hFile.write( aBuffer.toAscii() );
+    hFile.write( aBuffer.toLatin1() );
 
     return true;
 }
@@ -1394,7 +1394,7 @@ bool GLViewer_TextObject::translateToPS( QFile& hFile, GLViewer_CoordSystem* aVi
     AddCoordsToPS( aBuffer, "moveto", aViewerCS, aPSCS, double(xPos), double(yPos) );
     aBuffer += "(" + aText + ") show\n";
 
-    hFile.write( aBuffer.toAscii() );
+    hFile.write( aBuffer.toLatin1() );
 
     return true;
 }
@@ -1416,7 +1416,7 @@ bool GLViewer_TextObject::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* a
     
     aBuffer = "LB" + aText + "#;";
     
-    hFile.write( aBuffer.toAscii() );
+    hFile.write( aBuffer.toLatin1() );
 
     return true;
 }
@@ -1573,9 +1573,9 @@ GLboolean GLViewer_TextObject::highlight( GLfloat theX, GLfloat theY, GLfloat th
     QRegion circle( (int)(theX - theTol), (int)(theY - theTol),
                       (int)(2 * theTol), (int)(2 * theTol), QRegion::Ellipse );
     if( isCircle )
-        intersection = obj.intersect( circle );
+        intersection = obj.intersected( circle );
     else
-        intersection = obj.intersect( region );
+        intersection = obj.intersected( region );
     
     if( intersection.isEmpty() )
         myIsHigh = false;
@@ -1631,9 +1631,9 @@ GLboolean GLViewer_TextObject::select( GLfloat theX, GLfloat theY, GLfloat theTo
     QRegion circle( (int)(theX - theTol), (int)(theY - theTol),
                       (int)(2 * theTol), (int)(2 * theTol), QRegion::Ellipse );
     if( isCircle )
-        intersection = obj.intersect( circle );
+        intersection = obj.intersected( circle );
     else
-        intersection = obj.intersect( region );
+        intersection = obj.intersected( region );
     
     if( intersection.isEmpty() )
         myIsSel = false;
index 3196622396dc500a40a8a97b625dec4ac42b804e..60df04be0195b60d039d62e2f7a94942e2f7d7d0 100644 (file)
@@ -182,7 +182,7 @@ int GLViewer_Context::MoveTo( int xi, int yi, bool byCircle )
     if( myLastPickedChanged || myUpdateAll )
         myGLViewer2d->updateAll();
     else
-        myGLViewer2d->activateDrawers( anUpdatedObjects, TRUE, TRUE );
+        myGLViewer2d->activateDrawers( anUpdatedObjects, true, true );
 
     return 0;
 }
@@ -220,7 +220,7 @@ int GLViewer_Context::Select( bool Append, bool byCircle )
             if( updateAll || myUpdateAll )
                 myGLViewer2d->updateAll();
             else
-                myGLViewer2d->activateDrawers( aList, TRUE, TRUE );
+                myGLViewer2d->activateDrawers( aList, true, true );
 
             if( mySelectedObjects.count() != 0 && status == SS_Invalid )
                 status = SS_GlobalChanged;
@@ -242,7 +242,7 @@ int GLViewer_Context::Select( bool Append, bool byCircle )
              && mySelectedObjects.indexOf( myLastPicked ) == -1 )
         {
             mySelectedObjects.append( myLastPicked );
-            myGLViewer2d->activateDrawer( myLastPicked, TRUE, TRUE );
+            myGLViewer2d->activateDrawer( myLastPicked, true, true );
 
             if( status == SS_Invalid )
                 status = SS_GlobalChanged;
@@ -267,7 +267,7 @@ int GLViewer_Context::Select( bool Append, bool byCircle )
             if( updateAll || myUpdateAll )
                 myGLViewer2d->updateAll();
             else
-                myGLViewer2d->activateDrawers( aList, TRUE, TRUE );
+                myGLViewer2d->activateDrawers( aList, true, true );
 
             if( mySelectedObjects.count() != 0 )
                 status = SS_GlobalChanged;
@@ -297,7 +297,7 @@ int GLViewer_Context::Select( bool Append, bool byCircle )
             if( updateAll || myUpdateAll )
                 myGLViewer2d->updateAll();
             else
-                myGLViewer2d->activateDrawers( aList, TRUE, TRUE );
+                myGLViewer2d->activateDrawers( aList, true, true );
 
             if( mySelectedObjects.count() != 0 )
                 status = SS_GlobalChanged;
@@ -319,7 +319,7 @@ int GLViewer_Context::Select( bool Append, bool byCircle )
             {
                 myLastPicked = *oit;
                 mySelectedObjects.append( myLastPicked );
-                myGLViewer2d->activateDrawer( myLastPicked, TRUE, TRUE );
+                myGLViewer2d->activateDrawer( myLastPicked, true, true );
                 status = SS_GlobalChanged;
                 return status;
             }
@@ -387,7 +387,7 @@ int GLViewer_Context::SelectByRect( const QRect& theRect, bool Append )
     if( updateAll || myUpdateAll )
         myGLViewer2d->updateAll();
     else
-        myGLViewer2d->activateDrawers( aList, TRUE, TRUE );
+        myGLViewer2d->activateDrawers( aList, true, true );
 
     return status;
 }
@@ -470,10 +470,10 @@ bool GLViewer_Context::NextSelected()
   if ( mySelCurIndex >= 0 && mySelCurIndex < NbSelected() )
   {
     mySelCurIndex++;
-    return TRUE;
+    return true;
   }
 
-  return FALSE;
+  return false;
 }
 
 /*!
@@ -512,7 +512,7 @@ int GLViewer_Context::insertObject( GLViewer_Object* object, bool display, bool
         {
             //QRect* rect = object->getRect()->toQRect();
             //myGLViewer2d->updateBorders( *rect );
-            myGLViewer2d->activateDrawer( object, FALSE );
+            myGLViewer2d->activateDrawer( object, false );
         }
     }
     else
@@ -600,7 +600,7 @@ void GLViewer_Context::clearSelected( bool updateViewer )
   }          
         
   if( updateViewer )
-    myGLViewer2d->activateDrawers( aList, TRUE );
+    myGLViewer2d->activateDrawers( aList, true );
   mySelectedObjects.clear();    
 }
 
@@ -615,12 +615,12 @@ void GLViewer_Context::setSelected( GLViewer_Object* object, bool updateViewer )
 
   if( myActiveObjects.contains( object ) && !mySelectedObjects.contains( object ) )
   {
-    object->setSelected( TRUE );
+    object->setSelected( true );
     mySelectedObjects.append( object );
   }
      
   if( updateViewer )
-    myGLViewer2d->activateDrawer( object, TRUE, TRUE );
+    myGLViewer2d->activateDrawer( object, true, true );
 }
 
 /*!
@@ -636,7 +636,7 @@ void GLViewer_Context::remSelected( GLViewer_Object* object, bool updateViewer )
   object->unselect();
   
   if( updateViewer )
-    myGLViewer2d->activateDrawer( object, TRUE, TRUE );
+    myGLViewer2d->activateDrawer( object, true, true );
 }
 
 /*!
index e3af9817eb83173a327ee971c853486d14ab3861..df27941f4ddb7c53e05c88dd5756ba2c3754dec2 100644 (file)
@@ -70,18 +70,18 @@ public:
   *\paran byCircle - true if needs round sensitive area around mouse cursor, else rectangle
   *function search object rectangle which intersect with sensitive area and call object highlight method
   */
-  int                   MoveTo( int x, int y, bool byCircle = FALSE );
+  int                   MoveTo( int x, int y, bool byCircle = false );
   /*! A function selecting already highlighting object by calling object method select
   *\param Append - true if new selection will be append to existing selection, false - another
   *\param byCircle - true if needs round selection area in complex object
   */
-  int                   Select( bool Append = FALSE, bool byCircle = FALSE );
+  int                   Select( bool Append = false, bool byCircle = false );
   /*! A function selecting objects on scene by rectangle
   *\param theRect - rectangle of selection
   *\param Append - true if new selection will be append to existing selection, false - another
   *function search object rectangle which intersect with theRect and call object select method
   */
-  int                   SelectByRect( const QRect& theRect, bool Append = FALSE );
+  int                   SelectByRect( const QRect& theRect, bool Append = false );
 
   //! A function installing highlight color for all presentation (does not work)
   void                  SetHighlightColor( Quantity_NameOfColor aCol );
index 7f5a6a0e1b8c12e2c769b7330a010847dbc483a4..d8bd48cd3459cf5a2835a4f413bd10bf6412af00 100644 (file)
@@ -442,8 +442,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 +458,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 a0745880b48b3a4beae945426bf635132475762f..49eb22ec19ad674e5073971fce4e3a1486af63c1 100644 (file)
@@ -297,7 +297,7 @@ label:
     { 
       glDeleteLists( myGridList, 1 ); 
       if ( glGetError() != GL_NO_ERROR ) 
-    return FALSE;
+    return false;
     } 
          
     float xLoc = (int)(myXPan / myXSize) * myXSize; 
@@ -348,5 +348,5 @@ label:
 
     glEndList();
   }
-  return TRUE;
+  return true;
 }
index 9d9c8cbd88df4b5dba705f368e4ba5559b474961..7a528a5767d01a1f48659eacda634fe0f5470813 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 d9df43cc1a21d16e8da8519260d2ff671fa69745..641760fa7b196accb24665ffbec91844ea0adb66 100644 (file)
@@ -95,7 +95,7 @@ GLViewer_ViewPort2d::GLViewer_ViewPort2d( QWidget* parent, GLViewer_ViewFrame* t
   myGLWidget = new GLViewer_Widget( this, 0 ) ;
   qbl->addWidget( myGLWidget );
   myGLWidget->setFocusProxy( this );
-  setMouseTracking( TRUE );
+  setMouseTracking( true );
 
   myIsDragProcess = noDrag;
   //myCurDragMousePos = QPoint();
@@ -530,7 +530,7 @@ void GLViewer_ViewPort2d::initResize( int x, int y )
     GLfloat zoom, xzoom, yzoom;
     GLfloat w = x;
     GLfloat h = y;
-    bool max = FALSE;
+    bool max = false;
 
     xzoom = (GLfloat)x / myWidth;
     yzoom = (GLfloat)y / myHeight;
@@ -541,7 +541,7 @@ void GLViewer_ViewPort2d::initResize( int x, int y )
         zoom = yzoom;
     else
     {
-        max = TRUE;
+        max = true;
         zoom = xzoom > yzoom ? xzoom : yzoom;
     }
 
index 483b086d378d668c25c7459b9103204319d46a6e..a4667ba45d44024d096c9f36f80dbd63a69a39d7 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 2c995852099d53861967034b0be16d0c04c50798..8fadd22e0d640d6ed33d2235efdff94ff2ff45ac 100644 (file)
@@ -137,7 +137,7 @@ void GLViewer_Viewer2d::updateColors( QColor colorH, QColor colorS )
     */
 
 
-  activateAllDrawers( TRUE );
+  activateAllDrawers( true );
 }
 
 /*!
@@ -668,7 +668,7 @@ void GLViewer_Viewer2d::insertHeader( VectorFileType aType, QFile& hFile )
         header += "%%Pages: 1\n";
         header += "%%Page: 1\n\n";
         
-        hFile.write( header.toAscii() );
+        hFile.write( header.toLatin1() );
     }
     else if( aType == HPGL )
     {
@@ -682,7 +682,7 @@ void GLViewer_Viewer2d::insertHeader( VectorFileType aType, QFile& hFile )
         header += "LT;\n";
         header += "VS36;\n";
         
-        hFile.write( header.toAscii() );
+        hFile.write( header.toLatin1() );
     }
 }
 
@@ -696,12 +696,12 @@ void GLViewer_Viewer2d::insertEnding( VectorFileType aType, QFile& hFile )
     if( aType == POST_SCRIPT )
     {
         QString ending = "showpage\n\n%%EOF";
-        hFile.write( ending.toAscii() );
+        hFile.write( ending.toLatin1() );
     }
     else if( aType == HPGL )
     {
         QString ending = "PU;PA0,0;SP;EC;PG1;EC1;OE\n"; 
-        hFile.write( ending.toAscii() );
+        hFile.write( ending.toLatin1() );
     }
 }
 
@@ -731,7 +731,7 @@ bool GLViewer_Viewer2d::translateTo( VectorFileType aType, QString FileName, Pap
     if ( !getActiveView() )
       return false;
 
-        QFile hFile( FileName.toAscii() );
+        QFile hFile( FileName.toLatin1() );
 
 #ifdef WIN32
     HDC hMetaFileDC;
@@ -819,7 +819,7 @@ bool GLViewer_Viewer2d::translateTo( VectorFileType aType, QString FileName, Pap
                                arg( AW-mmLeft-mmRight ).arg( AH-mmBottom-mmTop );
         //It is set clipping path
 
-        hFile.write( aBuffer.toAscii() );
+        hFile.write( aBuffer.toLatin1() );
 
         aCurVP->getGLWidget()->translateBackgroundToPS( hFile, &aViewerCS, &aPaperCS );
     }
index ac60a1f8d2f05ba161db20b654da06ffa8b502de..cec19f953d7df275a938ad7d44fe884b347f5836 100644 (file)
@@ -495,7 +495,7 @@ void AddImagePart( QFile& hFile, QImage& image, int w1, int w2, int h1, int h2,
     
     aBuffer += "> false 3 colorimage\n\n";
 
-    hFile.write( aBuffer.toAscii() );
+    hFile.write( aBuffer.toLatin1() );
   }
 }
 
index e0d3e5e4dd76237f75dbb49f6196f60de6a69843..ff4ebe3bf155b2389e3f6fc6e91405540c06ea2e 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 
index 60d068ba33492d4a5e5930d26f50bde5d258490c..feae6f3b49570bb22191323fc55a4c0779065372 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 5bdaa0a12d36c3c4261758dfc0983dc6a2be9501..a3d1b87a3f7feeb708a6753df529cc3d452d9699 100644 (file)
@@ -43,7 +43,7 @@ GraphicsView_Object::GraphicsView_Object( QGraphicsItem* theParent )
 //=======================================================================
 GraphicsView_Object::~GraphicsView_Object()
 {
-  QListIterator<QGraphicsItem*> aChildIter( children() );
+  QListIterator<QGraphicsItem*> aChildIter( childItems() );
   while( aChildIter.hasNext() )
   {
     if( QGraphicsItem* aChild = aChildIter.next() )
index 65db77ba3fa99a29bb9305d0d797d838fae66dd7..d3c57b0429044bcf60dc0b911015d2a34549c502 100755 (executable)
@@ -17,6 +17,8 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
+INCLUDE(UseQtExt)
+
 # additional include directories
 INCLUDE_DIRECTORIES(
   ${CAS_INCLUDE_DIRS}
@@ -69,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 6de2ec6c3ab5830455fdddc17319e1e5a5318b7f..f67b5814e1819f1d9ba2b4b82aa16d96cdab8de9 100644 (file)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
+INCLUDE(UseQtExt)
+
 # --- options ---
 
 # additional include directories
 INCLUDE_DIRECTORIES(
-  ${QT_INCLUDES}
+  ${QT_INCLUDES} 
   ${PROJECT_SOURCE_DIR}/src/Qtx
 )
 
@@ -51,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
@@ -76,4 +78,4 @@ SET(HelpBrowser_SOURCES
 
 ADD_EXECUTABLE(HelpBrowser ${HelpBrowser_SOURCES})
 TARGET_LINK_LIBRARIES(HelpBrowser ${_link_LIBRARIES})
-INSTALL(TARGETS HelpBrowser EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS})
+INSTALL(TARGETS HelpBrowser EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS})
\ No newline at end of file
index 332b0643f14f762595a5937298ff5b2e0ca5b317..19914f458936237dbc27b12d2a4dc8a42a2e78f4 100644 (file)
@@ -42,6 +42,7 @@
 #include "qtlocalpeer.h"
 #include <QCoreApplication>
 #include <QTime>
+#include <QDataStream>
 
 #if defined(Q_OS_WIN)
 #include <QLibrary>
index 587eef55fe7ef9d968f26264ed67dc7aff924caf..534f6c2501c9a13807007e9ca430910e50005456 100755 (executable)
@@ -17,8 +17,6 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
-
 # additional include directories
 INCLUDE_DIRECTORIES(
   ${QT_INCLUDES}
index 9b39c65e80202d549ee302f54f26c2b910ff2a2c..04e309b4aa64b34fb62ee70bde2d6b1e9e1190a4 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -232,11 +232,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
@@ -298,6 +298,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 dd1d585e02ea2bf4b80660065ad8cc5a03ddb8a2..c800af179314a353d9d6bd1ab280828bac13529e 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>
@@ -779,8 +781,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() ) );
@@ -788,7 +792,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)
@@ -2015,8 +2021,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" ) );
@@ -4066,14 +4075,14 @@ void LightApp_Application::saveDockWindowsState()
   QMap<QString, bool> tbMap, dwMap;
   dockWindowsState( visArr, tbMap, dwMap );
 
-  QList<QToolBar*> tbList = qFindChildren<QToolBar*>( desktop() );
+  QList<QToolBar*> tbList = desktop()->findChildren<QToolBar*>();
   for ( QList<QToolBar*>::iterator it = tbList.begin(); it != tbList.end(); ++it )
   {
     QToolBar* tb = *it;
     tbMap.insert( tb->objectName(), tb->toggleViewAction()->isChecked() );
   }
 
-  QList<QDockWidget*> dwList = qFindChildren<QDockWidget*>( desktop() );
+  QList<QDockWidget*> dwList = desktop()->findChildren<QDockWidget*>();
   for ( QList<QDockWidget*>::iterator it = dwList.begin(); it != dwList.end(); ++it )
   {
     QDockWidget* wid = *it;
@@ -4303,10 +4312,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(){
@@ -4860,7 +4871,7 @@ void LightApp_Application::onDesktopMessage( const QString& message )
 QList<QToolBar*> LightApp_Application::findToolBars( const QStringList& names )
 {
   QList<QToolBar*> aResult;
-  QList<QToolBar*> tbList = qFindChildren<QToolBar*>( desktop() );
+  QList<QToolBar*> tbList = desktop()->findChildren<QToolBar*>();
   for ( QList<QToolBar*>::iterator tit = tbList.begin(); tit != tbList.end(); ++tit ) {
     QToolBar* tb = *tit;    
     QObject* po = Qtx::findParent( tb, "QMainWindow" );
index 6e7e6f99048af76fe9e20ea5fe01e6e1a3847909..1cb736412e31e770924fced387549152ab63d529 100644 (file)
@@ -133,9 +133,9 @@ void LightApp_Dialog::setObjectShown( const int id, const bool shown )
   if( myObjects.contains( id ) && isObjectShown( id )!=shown )
   {
     Object& obj = myObjects[ id ];
-    obj.myEdit->setShown( shown );
-    obj.myBtn->setShown( shown );
-    obj.myLabel->setShown( shown );
+    obj.myEdit->setVisible( shown );
+    obj.myBtn->setVisible( shown );
+    obj.myLabel->setVisible( shown );
     if( !shown )
       ( ( QToolButton* )obj.myBtn )->setChecked( false );
   }
index 87e2bf4290691c1ffd1a9203f390cd2cbfe1ead8..59b1af283df2aab55742108da838bdefcd66dfde 100644 (file)
@@ -83,7 +83,7 @@ bool LightApp_Driver::SaveDatasInFile( const char* theFileName, bool isMultiFile
   if(aFileBuffer == NULL)
     return false;
 
-  myTmpDir = QDir::convertSeparators( QFileInfo( theFileName ).absolutePath() + "/" ).toLatin1().constData() ;
+  myTmpDir = QDir::toNativeSeparators( QFileInfo( theFileName ).absolutePath() + "/" ).toLatin1().constData() ;
 
   int aCurrentPos = 0;
 
@@ -142,7 +142,7 @@ bool LightApp_Driver::ReadDatasFromFile( const char* theFileName, bool isMultiFi
   ifstream aFile(theFileName);
 #endif  
 
-  myTmpDir = QDir::convertSeparators( QFileInfo( theFileName ).absolutePath() + "/" ).toLatin1().constData() ;
+  myTmpDir = QDir::toNativeSeparators( QFileInfo( theFileName ).absolutePath() + "/" ).toLatin1().constData() ;
 
   aFile.seekg(0, ios::end);
   int aFileBufferSize = aFile.tellg();
index d0df209ece5d1dc1790e87f7840e91b26f5aca27..74513caf97b4e0944e31c21da6c985749abb5adc 100755 (executable)
@@ -146,7 +146,7 @@ QList<QtxComboBox*> LightApp_ModuleAction::ComboAction::widgets() const
 
   QList<QWidget*> wlist = createdWidgets();
   for ( QList<QWidget*>::const_iterator wit = wlist.begin(); wit != wlist.end(); ++wit )
-    lst += qFindChildren<QtxComboBox *>(*wit);
+    lst += (*wit)->findChildren<QtxComboBox *>();
 
   return lst;
 }
index ca50011cb4f6cb654797bbf95e828be51fad7a70..baec0535361c6f5e2a8a366ad6141e02b0856a65 100644 (file)
@@ -44,7 +44,7 @@ Qt::WindowTitleHint | Qt::WindowSystemMenuHint )
   setModal( true );
 
   setWindowTitle( tr("TLT_RENAME") );
-  setSizeGripEnabled( TRUE );
+  setSizeGripEnabled( true );
 
   QVBoxLayout* topLayout = new QVBoxLayout( this );
   topLayout->setMargin( 11 ); topLayout->setSpacing( 6 );
@@ -76,7 +76,7 @@ Qt::WindowTitleHint | Qt::WindowSystemMenuHint )
   myButtonOk = new QPushButton( GroupButtons );
   myButtonOk->setObjectName( "buttonOk" );
   myButtonOk->setText( tr( "BUT_OK"  ) );
-  myButtonOk->setAutoDefault( TRUE ); myButtonOk->setDefault( TRUE );
+  myButtonOk->setAutoDefault( true ); myButtonOk->setDefault( true );
   GroupButtonsLayout->addWidget( myButtonOk );
 
   GroupButtonsLayout->addStretch();
@@ -84,7 +84,7 @@ Qt::WindowTitleHint | Qt::WindowSystemMenuHint )
   myButtonCancel = new QPushButton( GroupButtons );
   myButtonCancel->setObjectName( "buttonCancel" );
   myButtonCancel->setText( tr( "BUT_CANCEL"  ) );
-  myButtonCancel->setAutoDefault( TRUE );
+  myButtonCancel->setAutoDefault( true );
   GroupButtonsLayout->addWidget( myButtonCancel );
   /***************************************************************/
   
index 44e2599fb113c2d51b0930292458c7ad276bd7df..44bae202d309b521702728d5c63ae7856910e190 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 e594ba3e1e6690b1815bd07e3080d062daef70d2..b9ec2c5afb9eedb26b075594db23c9588d202688 100755 (executable)
@@ -26,10 +26,10 @@ INCLUDE_DIRECTORIES(
 )
 
 # additional preprocessor / compiler flags
-ADD_DEFINITIONS(${QT_DEFINITIONS} ${CAS_DEFINITIONS})
+ADD_DEFINITIONS(${CAS_DEFINITIONS})
 
 # libraries to link to
-SET(_link_LIBRARIES ${QT_LIBRARIES} ${CAS_LDPATH} ${CAS_KERNEL} ${CAS_TKV3d} ViewerData)
+SET(_link_LIBRARIES ${CAS_LDPATH} ${CAS_KERNEL} ${CAS_TKV3d} ViewerData)
 
 # --- headers ---
 
index 8c4159c850274bf3be17f139f13de2d3b5fbb073..43f31d92fc7757ed563a9b7162a07da365d9f6a6 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 37fc6c6d0e613be8d21e96390d1c6efe88444387..983b360c90fc94b4d6d303932d2c319a9d5d3a30 100644 (file)
@@ -570,15 +570,15 @@ OCCViewer_ClippingDlg::OCCViewer_ClippingDlg(OCCViewer_ViewWindow* parent , OCCV
   buttonOk = new QPushButton( GroupButtons );
   buttonOk->setObjectName( "buttonOk" );
   buttonOk->setText( tr( "BUT_APPLY_AND_CLOSE"  ) );
-  buttonOk->setAutoDefault( TRUE );
-  buttonOk->setDefault( TRUE );
+  buttonOk->setAutoDefault( true );
+  buttonOk->setDefault( true );
   GroupButtonsLayout->addWidget( buttonOk );
 
   buttonApply = new QPushButton( GroupButtons );
   buttonApply->setObjectName( "buttonApply" );
   buttonApply->setText( tr( "BUT_APPLY"  ) );
-  buttonApply->setAutoDefault( TRUE );
-  buttonApply->setDefault( TRUE );
+  buttonApply->setAutoDefault( true );
+  buttonApply->setDefault( true );
   GroupButtonsLayout->addWidget( buttonApply );
 
   GroupButtonsLayout->addStretch();
@@ -586,11 +586,11 @@ OCCViewer_ClippingDlg::OCCViewer_ClippingDlg(OCCViewer_ViewWindow* parent , OCCV
   buttonClose = new QPushButton( GroupButtons );
   buttonClose->setObjectName( "buttonClose" );
   buttonClose->setText( tr( "BUT_CLOSE"  ) );
-  buttonClose->setAutoDefault( TRUE );
+  buttonClose->setAutoDefault( true );
   GroupButtonsLayout->addWidget( buttonClose );
 
   QPushButton* buttonHelp = new QPushButton( tr( "HELP" ), GroupButtons );
-  buttonHelp->setAutoDefault( TRUE );
+  buttonHelp->setAutoDefault( true );
   GroupButtonsLayout->addWidget( buttonHelp );
 
   /***************************************************************/
index fd110bd3843bd722302016266fd5beb8eee09704..4e700069647201a405bf00dc11b320a8056d31d3 100755 (executable)
@@ -144,11 +144,11 @@ void OCCViewer_CreateRestoreViewDlg::changeImage( QListWidgetItem* curItem )
             highLevel = index;
           }
           for( int j = lowLevel; j <= highLevel; j++ )
-            myListBox->item( j )->setSelected( TRUE );
+            myListBox->item( j )->setSelected( true );
           break;
         }
         if( myListBox->item( i )->isSelected() && i == index )
-          myListBox->item( i )->setSelected( TRUE );
+          myListBox->item( i )->setSelected( true );
       }
     }
     
index 591f5de82ffb4934e92621a79e3b090ac858fbe5..f34af8b9e38cd6c91e198d7192ef1b08d59bbc7a 100644 (file)
@@ -52,7 +52,7 @@ OCCViewer_SetRotationPointDlg::OCCViewer_SetRotationPointDlg( OCCViewer_ViewWind
   setModal( modal );
 
   setWindowTitle(tr("CAPTION"));
-  setSizeGripEnabled(TRUE);
+  setSizeGripEnabled(true);
 
   // Create layout for this dialog
   QGridLayout* layoutDlg = new QGridLayout (this);
@@ -145,7 +145,7 @@ OCCViewer_SetRotationPointDlg::OCCViewer_SetRotationPointDlg( OCCViewer_ViewWind
 
   QPushButton* m_bClose = new QPushButton(tr("&Close"), aGroupBox );
   m_bClose->setObjectName("m_bClose");
-  m_bClose->setAutoDefault(TRUE);
+  m_bClose->setAutoDefault(true);
   m_bClose->setFixedSize(m_bClose->sizeHint());
   connect(m_bClose, SIGNAL(clicked()), this, SLOT(onClickClose()));
 
index 242e9c878c87384f6aa3a6ba42fae6e0d636a767..5b1490b48e391b9032cfff26e1205c673f588ef9 100644 (file)
@@ -46,7 +46,7 @@ class OCCVIEWER_EXPORT OCCViewer_SetRotationPointDlg : public QDialog
 
 public:
   OCCViewer_SetRotationPointDlg(OCCViewer_ViewWindow* , 
-                                const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
+                                const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
   ~OCCViewer_SetRotationPointDlg();
 
   void SetAction( QtxAction* theAction ) { myAction = theAction; }
index 18e9096bc70809adffcabdb08f136ca2d6f5e2c7..baa9cbaa6006913b8a8d89908d016154ec91e68a 100755 (executable)
@@ -141,7 +141,7 @@ bool OCCViewer_Utilities::isDialogOpened( OCCViewer_ViewWindow* theView, const Q
 {
   bool isFound = false;
   OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( theView->parent()->parent() );
-  QList<QDialog*> allDialogs = qFindChildren<QDialog*>( aViewFrame );
+  QList<QDialog*> allDialogs = aViewFrame->findChildren<QDialog*>();
   foreach ( QDialog* d, allDialogs )
     if ( d->objectName() == theName )
       isFound = true;
index fe2546853b34f478998ed0d9bc92dc90c2f2e64d..9e16a39238432254c753913d3f81a0a685fb1362 100755 (executable)
@@ -995,7 +995,7 @@ void OCCViewer_Viewer::contextMenuPopup(QMenu* thePopup)
   OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView());
 
   //Support of several toolbars in the popup menu
-  QList<QToolBar*> lst = qFindChildren<QToolBar*>( aView );
+  QList<QToolBar*> lst = aView->findChildren<QToolBar*>();
   QList<QToolBar*>::const_iterator it = lst.begin(), last = lst.end();
   for ( ; it!=last; it++ ) {
     if ( (*it)->parentWidget()->isVisible() )
index ceb5d22ee00ca9545ad90190e5ba7c4573966872..7575a6a66a1953c80898d140e32aaed53bd65b90 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 );
index 5e927fbb3eda784eef72f747ab9e65b2e29dd368..c61d8eb0e4151c7f87f87779a11ae08373d72c05 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 164f24a34054b7d449fd5b605bdb22e0bb7ff430..862399de995dae21dc1a6a6cd27c2253555fb263 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 0ecb41c75566c3fb95723e5e0addc4d532dfaf17..dd40c3b2e082422cc7c8181e81f0d371cdcde7e2 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 1c28c7750de3b7e35aa3e28a7bbbe494e8ab6879..45f3b7439f761a45ce0e1f20b91b721787feddf1 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 e5cbb1f273cdbc6fe1153c0f9281cd0ac5b3c1ed..958e939d3bb549c875e14083686fb87f81d37798 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 7d33637b0a282dc76ad3f1d154f110a996318713..bced039fc87970ecdd9ff6aca1de7f46232cde7c 100755 (executable)
@@ -48,7 +48,7 @@ Plot2d_FitDataDlg::Plot2d_FitDataDlg( QWidget* parent, bool secondAxisY )
   setObjectName( "Plot2d_FitDataDlg" );
   setModal( true );
   setWindowTitle( tr( "FIT_DATA_TLT" ) );
-  setSizeGripEnabled( TRUE );
+  setSizeGripEnabled( true );
   QGridLayout* topLayout = new QGridLayout( this ); 
   topLayout->setSpacing( SPACING_SIZE );
   topLayout->setMargin( MARGIN_SIZE );
@@ -154,11 +154,11 @@ Plot2d_FitDataDlg::Plot2d_FitDataDlg( QWidget* parent, bool secondAxisY )
   // OK/Cancel buttons
   myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
   myOkBtn->setObjectName( "buttonOk" );
-  myOkBtn->setAutoDefault( TRUE );
-  myOkBtn->setDefault( TRUE );
+  myOkBtn->setAutoDefault( true );
+  myOkBtn->setDefault( true );
   myCancelBtn = new QPushButton(  tr( "BUT_CANCEL" ), this );
   myCancelBtn->setObjectName( "buttonCancel" );
-  myCancelBtn->setAutoDefault( TRUE );
+  myCancelBtn->setAutoDefault( true );
 
   topLayout->addWidget( myRangeGrp, 0, 0, 1, 3 );
   topLayout->addWidget( myOkBtn, 1, 0 );
index 2bd9903640136c2dcae48741eacd035400733531..2d585c08cc34bc7c0654c8f34a3f38d74e584ced 100644 (file)
@@ -33,6 +33,8 @@
 #include <QVariant>
 #include <QStyleOption>
 #include <QPaintEvent>
+#include <QTileRules>
+
 #include <qwt_plot.h>
 #include <qwt_painter.h>
 #include <qwt_scale_map.h>
@@ -88,8 +90,8 @@ Plot2d_QwtLegendLabel::Plot2d_QwtLegendLabel( QWidget* parent ) :
   mySymbolType(0),
   myPen( QPen() )
 {
-  myYAxisLeftIcon = yAxisLeft;
-  myYAxisRightIcon = yAxisRight;
+  myYAxisLeftIcon = QPixmap(yAxisLeft);
+  myYAxisRightIcon = QPixmap(yAxisRight);
   int anIconWidth = qMax( myYAxisLeftIcon.width(), myYAxisRightIcon.width() );
   setSpacing( SPACING );
 
@@ -402,7 +404,7 @@ void Plot2d_QwtPlotCurve::drawSeries( QPainter *painter,
   if(hasDeviationData()) {
     painter->save();
     int lineW = deviationMarkerLineWidth();
-    int tickSz = deviationMarkerTickSize() + qRound(lineW/2);
+    int tickSz = deviationMarkerTickSize() + qRound(double(lineW)/2);
     double min, max, xi, yi;
     int xp, ytop, ybtm, tickl, tickr;
     QColor c = isSelected() ? Plot2d_Object::selectionColor() : deviationMarkerColor();
index a6bfb87083fa6663d0c3a501a0bb91a24d792892..4ef7b9364336ec21280209342b88f249e4d6879d 100755 (executable)
@@ -68,7 +68,7 @@ Plot2d_SetupViewDlg::Plot2d_SetupViewDlg( QWidget* parent,
 {
   setModal( true );
   setWindowTitle( tr("TLT_SETUP_PLOT2D_VIEW") );
-  setSizeGripEnabled( TRUE );
+  setSizeGripEnabled( true );
 
   QGridLayout* topLayout = new QGridLayout( this );
   topLayout->setSpacing( SPACING_SIZE );
@@ -411,12 +411,12 @@ Plot2d_SetupViewDlg::Plot2d_SetupViewDlg( QWidget* parent,
 
   /* OK/Cancel buttons */
   myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
-  myOkBtn->setAutoDefault( TRUE );
-  myOkBtn->setDefault( TRUE );
+  myOkBtn->setAutoDefault( true );
+  myOkBtn->setDefault( true );
   myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
-  myCancelBtn->setAutoDefault( TRUE );
+  myCancelBtn->setAutoDefault( true );
   myHelpBtn = new QPushButton( tr( "BUT_HELP" ), this );
-  myHelpBtn->setAutoDefault( TRUE );
+  myHelpBtn->setAutoDefault( true );
   QHBoxLayout* btnLayout = new QHBoxLayout;
   btnLayout->addWidget( myOkBtn );
   btnLayout->addStretch();
index db3e2acc5836b7967508e09f22a65125044a0dae..efa7311c794bbde3b024a69a06055a3401118872 100755 (executable)
 #include <qwt_plot_zoomer.h>
 #include <qwt_curve_fitter.h>
 #include <qwt_plot_renderer.h>
+#include <qwt_legend.h>
+#include <qwt_scale_widget.h>
 
 #include <stdlib.h>
 #include <limits>
-#include <qprinter.h>
-
-#include <qwt_legend.h>
-#include <qwt_scale_widget.h>
 
 #define DEFAULT_LINE_WIDTH     0     // (default) line width
 #define DEFAULT_MARKER_SIZE    9     // default marker size
@@ -1642,10 +1640,10 @@ void Plot2d_ViewFrame::getFitRangeByMarkers(double& xMin,  double& xMax,
 */
 int Plot2d_ViewFrame::testOperation( const QMouseEvent& me )
 {
-  int btn = me.button() | me.modifiers();
-  const int zoomBtn = Qt::ControlModifier | Qt::LeftButton;
-  const int panBtn  = Qt::ControlModifier | Qt::MidButton;
-  const int fitBtn  = Qt::ControlModifier | Qt::RightButton;
+  int btn = (int)me.button() | (int)me.modifiers();
+  const int zoomBtn = (int)Qt::ControlModifier | (int)Qt::LeftButton;
+  const int panBtn  = (int)Qt::ControlModifier | (int)Qt::MidButton;
+  const int fitBtn  = (int)Qt::ControlModifier | (int)Qt::RightButton;
 
   int op = NoOpId;
   if ( btn == zoomBtn ) {
@@ -2683,7 +2681,7 @@ void Plot2d_ViewFrame::plotMousePressed( const QMouseEvent& me )
     }
   }
   else {
-    int btn = me.button() | me.modifiers();
+    int btn = (int)me.button() | (int)me.modifiers();
     if (btn == Qt::RightButton) {
       QMouseEvent* aEvent = new QMouseEvent(QEvent::MouseButtonPress,
                                             me.pos(), me.button(), me.buttons(), me.modifiers() );
index 36904dd3cd8dc71256a84e6fc37f805dba5cfaf7..6dc393da57272a93437baf2b01340c118b1f224b 100755 (executable)
@@ -17,7 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
 
 # --- options ---
 
@@ -70,7 +70,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
@@ -93,5 +93,5 @@ 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 38cb6936594be342274ab775d4f7be8221e9521a..d4cf274a222026cdc66ea393d2d9c784ab95f88b 100644 (file)
@@ -27,6 +27,7 @@
 #include <QTextCursor>
 #include <QTextCharFormat>
 #include <QRegExp>
+#include <QMimeData>
 
 #include "PyConsole_EnhEditor.h"
 #include "PyConsole_EnhInterp.h"
@@ -417,7 +418,7 @@ QString PyConsole_EnhEditor::formatDocHTML(const QString & doc) const
  * If the pasted text doesn't contain a line return, no special treatment is done.
  * @param source
  */
-void PyConsole_EnhEditor::insertFromMimeData(const QMimeData * source)
+void PyConsole_EnhEditor::insertFromMimeData(const QMimeData* source)
 {
   if (_multi_line_paste)
     return;
index 8f8fc9cb9e878fc541555a946b76e800fff64353..f505066d32aa1f94a792fa773f7f2974868a38b7 100644 (file)
@@ -75,7 +75,7 @@ protected:
   virtual void   keyPressEvent ( QKeyEvent* event);
   virtual void   customEvent( QEvent* event);
   virtual void   mousePressEvent( QMouseEvent* event );
-  virtual void   insertFromMimeData(const QMimeData * source);
+  virtual void   insertFromMimeData(const QMimeData* source);
 
   virtual PyInterp_Request* createTabRequest( const QString& input );
   virtual void handleTab();
index 338c99da0ba547da7f934fff1ec758e27e560e3b..f5e7beb4f3be0861e9151968348fac308f2f6089 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 83f0e381e8c4f5d26ca84657ec2934d8f0194c3b..247c02e7ce40d5c0d77d81bc60b74324664f0021 100644 (file)
@@ -123,12 +123,12 @@ PyEditor_SettingsDlg::PyEditor_SettingsDlg( PyEditor_Editor* theEditor, QWidget*
   aMainLayout->addStretch( 1 );
   
   myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
-  myOkBtn->setAutoDefault( TRUE );
-  myOkBtn->setDefault( TRUE );
+  myOkBtn->setAutoDefault( true );
+  myOkBtn->setDefault( true );
   myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
-  myCancelBtn->setAutoDefault( TRUE );
+  myCancelBtn->setAutoDefault( true );
   myHelpBtn = new QPushButton( tr( "BUT_HELP" ), this );
-  myHelpBtn->setAutoDefault( TRUE );
+  myHelpBtn->setAutoDefault( true );
   QHBoxLayout* aButtonLayout = new QHBoxLayout;
   aButtonLayout->addWidget( myOkBtn );
   aButtonLayout->addStretch();
index b55001ef62e49ccb745a5569d513393cb40cbe65..07cef33dbdfd82ec26bf5926fb1ec1075a7c2c5c 100755 (executable)
@@ -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(PyInterp_HEADERS ${_other_HEADERS})
 # --- sources ---
 
 # sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_internal_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_internal_HEADERS})
 
 # sources / static
 SET(_other_SOURCES
index 2f99617826217a185b8bca7cbf1a50e607f077d4..0c6e5af2de890c83d0aca2785a8f359e6e5467d8 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 3fcdb0f63e476e293e0631155b345f653939f538..47a9a4582c4d26d3d74ba8bd33b60871fa9efdf6 100644 (file)
 
 #include <QtGui>
 #include <QLocale>
+#include <QFileDialog>
+#include <QMessageBox>
+#include <QApplication>
+#include <QStatusBar>
 
 /*!
   \class PyViewer_ViewWindow
index fbe9e270b59f49d300f32f0e204faa631b691258..1fa265cce81f6ec973f69b4c0fd69ca3821e67af 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 d8eadcad7315d67cba636c83175e2300a705319d..0b74d0d4bcdc9e1ccb242ffd59a35cf074b4a1ba 100644 (file)
@@ -902,7 +902,7 @@ void QDS_Datum::setShown( const bool visible, const int flags )
   while ( flag )
   {
     if ( flags & flag && widget( flag ) )
-      widget( flag )->setShown( visible );
+      widget( flag )->setVisible( visible );
     flag = flag >> 1;
   }
 }
index 32df69661a4269ebccbe3ef6dae1df02b9ce36dd..29697558d2a367cd0c075a52ed689196f2d34ec1 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 1a85d98533447cbf24e699be371e26636783f3d8..f43ec8504d21a651c65f86fe7cd7feb71cb34ad6 100755 (executable)
@@ -673,7 +673,7 @@ QString Qtx::findEnvVar( const QString& str, int& start, int& len )
   if ( pos != -1 )
   {
     int i = 1;
-    while ( i <= rx.numCaptures() && varName.isEmpty() )
+    while ( i <= rx.captureCount() && varName.isEmpty() )
     {
       QString capStr = rx.cap( i );
       if ( !capStr.contains( "%" ) && !capStr.contains( "$" ) )
@@ -688,7 +688,7 @@ QString Qtx::findEnvVar( const QString& str, int& start, int& len )
       int end = start + varName.length();
       if ( capIdx > 1 && rx.cap( capIdx - 1 ).contains( QRegExp( "\\$|%" ) ) )
         start = rx.pos( capIdx - 1 ) + rx.cap( capIdx - 1 ).indexOf( QRegExp( "\\$|%" ) );
-      if ( capIdx < rx.numCaptures() && !rx.cap( capIdx - 1 ).isEmpty() )
+      if ( capIdx < rx.captureCount() && !rx.cap( capIdx - 1 ).isEmpty() )
         end++;
       len = end - start;
     }
@@ -863,7 +863,7 @@ QImage Qtx::grayscale( const QImage& img )
 {
   QImage res = img;
 
-  int colNum = res.numColors();
+  int colNum = res.colorCount();
   if ( colNum )
   {
     for ( int i = 0; i < colNum; i++ )
index bca3d0538e95de12966cea4b44c69042277b3517..4b449408e47fc704f8a036431d6349974cd39bee 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 23a3a686e08d83b83d0836438f65e3db02f25b74..9f39d75d86ceb9aa2a6fc4b9a3ae02e6ba5ad75a 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 c47ba73f8671f50cee7958d9f80f6ea996e4f48a..c24a5820ab3821a8a26802824df7c991533ad7e8 100644 (file)
@@ -229,7 +229,7 @@ QToolBar* QtxActionToolMgr::find( const QString& title, QMainWindow* mw ) const
   QString pattern = title.toLower();
 
   QToolBar* res = 0;
-  QList<QToolBar*> toolbars = qFindChildren<QToolBar*>( mw );
+  QList<QToolBar*> toolbars = mw->findChildren<QToolBar*>( );
   for ( QList<QToolBar*>::iterator it = toolbars.begin(); it != toolbars.end() && !res; ++it )
   {
     if ( (*it)->windowTitle().toLower() == pattern )
index 8bb4769ad3f9ef02771a7f873be1b9fd1d758905..de2fe97da063d957f3df621b047d77f0362be044 100644 (file)
@@ -325,7 +325,7 @@ void QtxColorButton::paintEvent( QPaintEvent* e )
 */
 void QtxColorButton::updateState()
 {
-  QList<QToolButton*> bList = qFindChildren<QToolButton*>( menu() );
+  QList<QToolButton*> bList = menu()->findChildren<QToolButton*>();
   for ( QList<QToolButton*>::iterator cit = bList.begin(); cit != bList.end(); ++cit )
     updateButton( *cit );
 }
index 37574e2d7f05de8dd6ab9f155f4e21368169a7cc..47a3a28672f6497616355673f96d5882a8571f32 100755 (executable)
@@ -1327,7 +1327,7 @@ void QtxDialog::keyPressEvent( QKeyEvent* e )
 
   if ( e->key() == Qt::Key_Tab && e->modifiers() & Qt::ControlModifier )
   {
-    QObject* tab = qFindChild<QTabWidget*>( this );
+    QObject* tab = this->findChild<QTabWidget*>( );
     if ( tab && !property( "in_tab_event" ).toBool() ) {
       setProperty( "in_tab_event", true );
       QApplication::sendEvent( tab, e );
@@ -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 c4e827f3b9343d248667421ae7f7eef24f2c89c5..9e741adaf0913de87a778ba13a0db808a6ff4361 100755 (executable)
@@ -152,7 +152,7 @@ void QtxDockAction::toolBars( QList<QToolBar*>& lst ) const
   if ( !mw )
     return;
 
-  QList<QToolBar*> toolbars = qFindChildren<QToolBar*>( mw );
+  QList<QToolBar*> toolbars = mw->findChildren<QToolBar*>( );
   for ( QList<QToolBar*>::iterator it = toolbars.begin(); it != toolbars.end(); ++it )
   {
     QToolBar* tb = *it;
@@ -173,7 +173,7 @@ void QtxDockAction::dockWidgets( QList<QDockWidget*>& lst ) const
   if ( !mw )
     return;
 
-  QList<QDockWidget*> dockwidgets = qFindChildren<QDockWidget*>( mw );
+  QList<QDockWidget*> dockwidgets = mw->findChildren<QDockWidget*>( );
   for ( QList<QDockWidget*>::iterator it = dockwidgets.begin(); it != dockwidgets.end(); ++it )
   {
     QDockWidget* dw = *it;
index 2e23aec543a459057069d96cf1b05f711155100b..bc50f29941bfecbaffeef31634b1537a92879120 100644 (file)
@@ -376,8 +376,8 @@ void QtxFontEdit::setMode( const int mode )
 
   myMode = mode;
 
-  myFamily->setShown( myMode == Native );
-  myCustomFams->setShown( myMode == Custom );
+  myFamily->setVisible( myMode == Native );
+  myCustomFams->setVisible( myMode == Custom );
 
   updateGeometry();
 }
index a8cecea95aa353a51c96e0cd021d532a62daa864..d82d2db236cf8edaec277199995180eaf0d9b3e9 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 f7af18db8eae3f8b3127a5ee9e06b68cce7bf5ce..c71fec8821bbbc1fff9ff32f4f79afc2ea4e7b7c 100644 (file)
@@ -215,7 +215,7 @@ void QtxMainWindow::Resizer::setFilters( bool on )
       myMain->layout()->removeEventFilter( this );
   }
 
-  QTimer* t = qFindChild<QTimer*>( myMain->layout() );
+  QTimer* t = myMain->layout()->findChild<QTimer*>( );
   if ( t ) {
     if ( on )
       t->installEventFilter( this );
index 0fefcd6bbfd6baab5375460c1018049c495867a3..da7d3c29ff2e41ce06956347c2812fc646ecac89 100755 (executable)
@@ -241,7 +241,7 @@ void QtxPathDialog::onBrowse()
   {
     QStringList fList = prepareFilters( entry.filter );
     if ( !fList.isEmpty() )
-      entry.dlg->setFilters( fList );
+      entry.dlg->setNameFilters( fList );
   }
   entry.dlg->selectFile( fileName( id ) );
 
@@ -255,10 +255,10 @@ void QtxPathDialog::onBrowse()
     return;
   
   if ( Qtx::extension( fName ).isEmpty() && !isDir )
-    fName = autoExtension( fName, entry.dlg->selectedFilter() );
+    fName = autoExtension( fName, entry.dlg->selectedNameFilter() );
 
-  fName = QDir::convertSeparators( fName );
-  QString prev = QDir::convertSeparators( fileName( id ) );
+  fName = QDir::toNativeSeparators( fName );
+  QString prev = QDir::toNativeSeparators( fileName( id ) );
   if ( isDir )
   {
     while ( prev.length() && prev.at( prev.length() - 1 ) == QDir::separator() )
@@ -701,7 +701,7 @@ QString QtxPathDialog::autoExtension( const QString& theFileName, const QString&
       ext = ext.mid( ext.indexOf( "." ) + 1 );
     
     if ( !ext.isEmpty() && !ext.contains( "*" ) )
-      fName = QDir::convertSeparators( fName ) + QString( "." ) + ext;
+      fName = QDir::toNativeSeparators( fName ) + QString( "." ) + ext;
   }
   
   return fName;
index 67b5dfa45ddcfdb9c7b6295345d13a9f17c72e68..acc0120b86033e4e4bacec65638a10e7ef54c448 100644 (file)
@@ -211,7 +211,7 @@ void QtxPathEdit::onBrowse( bool /*on*/ )
   }
 
   if ( !path.isEmpty() )
-    myPath->setText( QDir::convertSeparators( path ) ); 
+    myPath->setText( QDir::toNativeSeparators( path ) ); 
 
   myPath->setFocus();
 
index 93371e022508526cfec777d442d5f1b461c36b04..e1f40d40dd2eef71bee1f511b306c481cce05f8f 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 db5c0f9aa3af3f65e110f35694a577d60cb8a064..bfdcc1d66f5756e44224455828fd1d183e69d177 100644 (file)
@@ -391,7 +391,7 @@ void QtxPreferenceItem::resource( QString& sec, QString& param ) const
 */
 void QtxPreferenceItem::setIcon( const QIcon& ico )
 {
-  if ( myIcon.serialNumber() == ico.serialNumber() )
+  if ( myIcon.cacheKey() == ico.cacheKey() )
     return;
 
   myIcon = ico;
index 35f052e03e54bd7c24cf8173e672cb319f3542e1..fbc7e44ab4f1453f02770907f9083c44e34c73d2 100644 (file)
@@ -377,7 +377,7 @@ QString QtxResourceMgr::Resources::fileName( const QString& sect, const QString&
   }
   if( !path.isEmpty() )
   {
-    QString fname = QDir::convertSeparators( path );
+    QString fname = QDir::toNativeSeparators( path );
     QFileInfo inf( fname );
     fname = inf.absoluteFilePath();
     return fname;
@@ -423,7 +423,7 @@ QPixmap QtxResourceMgr::Resources::loadPixmap( const QString& sect, const QStrin
 QTranslator* QtxResourceMgr::Resources::loadTranslator( const QString& sect, const QString& prefix, const QString& name ) const
 {
   QTranslator* trans = new QtxTranslator( 0 );
-  QString fname = QDir::convertSeparators( fileName( sect, prefix, name ) );
+  QString fname = QDir::toNativeSeparators( fileName( sect, prefix, name ) );
   if ( !trans->load( Qtx::file( fname, false ), Qtx::dir( fname ) ) )
   {
     delete trans;
@@ -610,7 +610,7 @@ bool QtxResourceMgr::IniFormat::load( const QString& fname, QMap<QString, Sectio
     }
     else if ( section == "import" )
     {
-      QString impFile = QDir::convertSeparators( Qtx::makeEnvVarSubst( data, Qtx::Always ) );
+      QString impFile = QDir::toNativeSeparators( Qtx::makeEnvVarSubst( data, Qtx::Always ) );
       QFileInfo impFInfo( impFile );
       if ( impFInfo.isRelative() )
              impFInfo.setFile( aFinfo.absoluteDir(), impFile );
@@ -848,7 +848,7 @@ bool QtxResourceMgr::XmlFormat::load( const QString& fname, QMap<QString, Sectio
       }
       else if ( sectElem.tagName() == importTag() && sectElem.hasAttribute( nameAttribute() ) )
       {
-         QString impFile = QDir::convertSeparators( Qtx::makeEnvVarSubst( sectElem.attribute( nameAttribute() ), Qtx::Always ) );
+         QString impFile = QDir::toNativeSeparators( Qtx::makeEnvVarSubst( sectElem.attribute( nameAttribute() ), Qtx::Always ) );
              QFileInfo impFInfo( impFile );
              if ( impFInfo.isRelative() )
                 impFInfo.setFile( aFinfo.absoluteDir(), impFile );
index c2c3f6febaefbb9d9bb4ed300f39ffb3235f7021..da6cfe1fe555697db5fbc74b9cd1650465d4b32f 100644 (file)
@@ -886,7 +886,7 @@ void QtxSearchTool::init( Qt::Orientation orientation )
   myModWidget_layout->setMargin( 0 );
 
   myClose = new QToolButton( myBtnWidget );
-  myClose->setIcon( QIcon( close_xpm ) );
+  myClose->setIcon( QIcon( QPixmap( close_xpm ) ) );
   myClose->setAutoRaise( true );
   myBtnWidget_layout->addWidget( wrapWidget( myBtnWidget, myClose ) );
   connect( myClose, SIGNAL( clicked() ), this, SLOT( hide() ) );
@@ -899,28 +899,28 @@ void QtxSearchTool::init( Qt::Orientation orientation )
   myData->installEventFilter( this );
 
   myToFirst = new QToolButton( myBtnWidget );
-  myToFirst->setIcon( QIcon( first_xpm ) );
+  myToFirst->setIcon( QIcon( QPixmap( first_xpm ) ) );
   myToFirst->setAutoRaise( true );
   myBtnWidget_layout->addWidget( wrapWidget( myBtnWidget, myToFirst ), 0 );
   connect( myToFirst, SIGNAL( clicked() ), this, SLOT( findFirst() ) );
   myToFirst->installEventFilter( this );
 
   myPrev = new QToolButton( myBtnWidget );
-  myPrev->setIcon( QIcon( prev_xpm ) );
+  myPrev->setIcon( QIcon( QPixmap( prev_xpm ) ) );
   myPrev->setAutoRaise( true );
   myBtnWidget_layout->addWidget( wrapWidget( myBtnWidget, myPrev ), 0 );
   connect( myPrev, SIGNAL( clicked() ), this, SLOT( findPrevious() ) );
   myPrev->installEventFilter( this );
 
   myNext = new QToolButton( myBtnWidget );
-  myNext->setIcon( QIcon( next_xpm ) );
+  myNext->setIcon( QIcon( QPixmap( next_xpm ) ) );
   myNext->setAutoRaise( true );
   myBtnWidget_layout->addWidget( wrapWidget( myBtnWidget, myNext ), 0 );
   connect( myNext, SIGNAL( clicked() ), this, SLOT( findNext() ) );
   myNext->installEventFilter( this );
 
   myToLast = new QToolButton( myBtnWidget );
-  myToLast->setIcon( QIcon( last_xpm ) );
+  myToLast->setIcon( QIcon( QPixmap( last_xpm ) ) );
   myToLast->setAutoRaise( true );
   myBtnWidget_layout->addWidget( wrapWidget( myBtnWidget, myToLast ), 0 );
   connect( myToLast, SIGNAL( clicked() ), this, SLOT( findLast() ) );
index f1cf72fbe3a66107ab9337262d59cee631060a1b..bde67e78fde0795eba1c26981025362d66f6eeff 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 cabd6af2053dc3dce7f7eb3fc8cb63bcad254eb4..cbe7e04562cd91ea75832aad2533c0a04bec1503 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 291292357186f3288b7ae73cd06070245bbb85eb..2709c362b2d051d3e61fa6a74ffe8b02fb46213c 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 ( qVariantCanConvert<QIcon>( iconData ) )
-        icon = qVariantValue<QIcon>( iconData );
-      else if ( qVariantCanConvert<QPixmap>( iconData ) )
-        icon = qVariantValue<QPixmap>( iconData );
+#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 c7af11e52fb39e671dd7f4ff24d9a9c0f125feb3..8739e529bf150b074e1f274540fc9482cc5a2aca 100644 (file)
@@ -22,7 +22,7 @@
 //
 #include "QtxWorkspace.h"
 
-#include <QWidgetList>
+#include <QMdiSubWindow>
 
 /*!
   \class QtxWorkspace
@@ -38,7 +38,7 @@
   \param parent parent widget
 */
 QtxWorkspace::QtxWorkspace( QWidget* parent )
-: QWorkspace( parent )
+: QMdiArea( parent )
 {
 }
 
@@ -54,24 +54,24 @@ QtxWorkspace::~QtxWorkspace()
 */
 void QtxWorkspace::tileVertical()
 {
-  QWidgetList winList = windowList();
+  QList<QMdiSubWindow *> winList = subWindowList();
   if ( winList.isEmpty() )
     return;
   
   int count = 0;
-  for ( QWidgetList::const_iterator itr = winList.begin(); itr != winList.end(); ++itr )
+  for ( QList<QMdiSubWindow *>::const_iterator itr = winList.begin(); itr != winList.end(); ++itr )
     if ( !( (*itr)->windowState() & Qt::WindowMinimized ) )
       count++;
 
   if ( !count )
     return;
 
-  if ( activeWindow() && ( activeWindow()->windowState() & Qt::WindowMaximized ) )
-    activeWindow()->showNormal();
+  if ( activeSubWindow() && ( activeSubWindow()->windowState() & Qt::WindowMaximized ) )
+    activeSubWindow()->showNormal();
 
   int y = 0;
   int heightForEach = height() / count;
-  for ( QWidgetList::iterator it = winList.begin(); it != winList.end(); ++it )
+  for ( QList<QMdiSubWindow *>::iterator it = winList.begin(); it != winList.end(); ++it )
   {
     QWidget* win = *it;
     if ( win->windowState() & Qt::WindowMinimized )
@@ -98,24 +98,24 @@ void QtxWorkspace::tileVertical()
 */
 void QtxWorkspace::tileHorizontal()
 {
-  QWidgetList winList = windowList();
+  QList<QMdiSubWindow *> winList = subWindowList();
   if ( winList.isEmpty() )
     return;
 
   int count = 0;
-  for ( QWidgetList::const_iterator itr = winList.begin(); itr != winList.end(); ++itr )
+  for ( QList<QMdiSubWindow *>::const_iterator itr = winList.begin(); itr != winList.end(); ++itr )
     if ( !( (*itr)->windowState() & Qt::WindowMinimized ) )
       count++;
 
   if ( !count )
     return;
 
-  if ( activeWindow() && activeWindow()->windowState() & Qt::WindowMaximized )
-    activeWindow()->showNormal();
+  if ( activeSubWindow() && activeSubWindow()->windowState() & Qt::WindowMaximized )
+    activeSubWindow()->showNormal();
   
   int x = 0;
   int widthForEach = width() / count;
-  for ( QWidgetList::iterator it = winList.begin(); it != winList.end(); ++it )
+  for ( QList<QMdiSubWindow *>::iterator it = winList.begin(); it != winList.end(); ++it )
   {
     QWidget* win = *it;
     if ( win->windowState() & Qt::WindowMinimized )
index 87c3b8ed8341f36b45a8f06020a063895f53d1db..58f72ecdd8e69dd7c1729ab8eb05ca68b4a457d7 100644 (file)
 
 #include "Qtx.h"
 
-#include <QWorkspace>
+#include <QMdiArea>
 
 #ifdef WIN32
 #pragma warning( disable:4251 )
 #endif
 
-class QTX_EXPORT QtxWorkspace : public QWorkspace
+class QTX_EXPORT QtxWorkspace : public QMdiArea
 {
   Q_OBJECT
 
index 5bac837df3e87f8504936e52d15af368f7535ebb..1818a6d689d18fc1723b778962d937f92199f1aa 100644 (file)
@@ -28,7 +28,7 @@
 #include "QtxWorkspace.h"
 
 #include <QMenu>
-#include <QWidgetList>
+#include <QMdiSubWindow>
 
 /*!
   \class QtxWorkspaceAction
@@ -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;
 }
 
@@ -238,7 +238,7 @@ void QtxWorkspaceAction::tile()
 {
   QtxWorkspace* ws = workspace();
   if ( ws )
-    ws->tile();
+    ws->tileSubWindows();
 }
 
 /*!
@@ -250,13 +250,13 @@ void QtxWorkspaceAction::cascade()
   if ( !ws )
     return;
 
-  ws->cascade();
+  ws->cascadeSubWindows();
 
         int w = ws->width();
         int h = ws->height();
 
-        QWidgetList winList = ws->windowList();
-  for ( QWidgetList::iterator it = winList.begin(); it != winList.end(); ++it )
+        QList<QMdiSubWindow *> winList = ws->subWindowList();
+  for ( QList<QMdiSubWindow *>::iterator it = winList.begin(); it != winList.end(); ++it )
                 (*it)->resize( int( w * 0.8 ), int( h * 0.8 ) );
 }
 
@@ -311,11 +311,11 @@ void QtxWorkspaceAction::removedFrom( QWidget* w )
 */
 void QtxWorkspaceAction::updateContent()
 {
-  bool count = workspace() ? workspace()->windowList().count() : 0;
-  action( Cascade )->setEnabled( count );
-  action( Tile )->setEnabled( count );
-  action( HTile )->setEnabled( count );
-  action( VTile )->setEnabled( count );
+  bool hasWindows = workspace() && workspace()->subWindowList().count() > 0;
+  action( Cascade )->setEnabled( hasWindows );
+  action( Tile )->setEnabled( hasWindows );
+  action( HTile )->setEnabled( hasWindows );
+  action( VTile )->setEnabled( hasWindows );
 
   updateWindows();
 }
@@ -345,12 +345,12 @@ void QtxWorkspaceAction::updateWindows()
   if ( menuActions() & Windows )
   {
     int index = 1;
-    QWidgetList wList = ws->windowList();
-    for ( QWidgetList::iterator it = wList.begin(); it != wList.end(); ++it, index++ )
+    QList<QMdiSubWindow *> wList = ws->subWindowList();
+    for ( QList<QMdiSubWindow *>::iterator it = wList.begin(); it != wList.end(); ++it, index++ )
     {
       QWidget* wid = *it;
       QAction* a = new QtxAction( wid->windowTitle(), wid->windowTitle(), 0, this, true );
-      a->setChecked( wid == ws->activeWindow() );
+      a->setChecked( wid == ws->activeSubWindow() );
       items.append( a );
       map.insert( a, Windows + index );
     }
@@ -396,7 +396,7 @@ void QtxWorkspaceAction::activateItem( const int idx )
   if ( !ws )
     return;
 
-  QWidgetList wList = ws->windowList();
+  QList<QMdiSubWindow *> wList = ws->subWindowList();
   if ( idx >= 0 && idx < (int)wList.count() )
     wList.at( idx )->setFocus();
 }
index 6721d6d8a65ac8116cecf7dfa9fcbd684e727623..dd071fe5f6fb3760879521c8b1467a9e6899a57f 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;
 }
 
@@ -2651,7 +2651,7 @@ void QtxWorkstack::insertWidget( QWidget* wid, QWidget* pWid, QWidget* after )
   for ( QWidgetList::iterator itr = moveList.begin(); itr != moveList.end(); ++itr )
   {
     (*itr)->setParent( pWid );
-    (*itr)->setShown( map.contains( *itr ) ? map[*itr] : false );
+    (*itr)->setVisible( map.contains( *itr ) ? map[*itr] : false );
   }
 }
 
index 09bf5eeb16f291b8ac2239a4d59efd50df3149e0..ab2e4a61cee39a7f3bc5590a0d61dfcff4d1bf2b 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;
 }
 
@@ -524,12 +524,12 @@ QtxSplitDlg::QtxSplitDlg( QWidget* parent, QtxWorkstack* workstack, QtxSplitDlgM
 
   // Buttons for possibility of switching the variants of split
   myButtonPrevious = new QPushButton( this );
-  myButtonPrevious->setIcon( QIcon( prev_xpm ) );
+  myButtonPrevious->setIcon( QIcon( QPixmap( prev_xpm ) ) );
   myButtonPrevious->setAutoDefault(true);
   myButtonPrevious->setEnabled( false );
 
   myButtonNext = new QPushButton( this );
-  myButtonNext->setIcon( QIcon( next_xpm ) );
+  myButtonNext->setIcon( QIcon( QPixmap( next_xpm ) ) );
   myButtonNext->setAutoDefault(true);
   myButtonNext->setEnabled( false );
 
index f6ad5530f7bc88042141f29ea81c6b7749066462..a8398a7bc2cf98c920d4edaa5b56e118188fa6b7 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 ca6a5017316b9c2eecba98a5d6cd549802fe5f03..f68c105398431bfe46ba3b60625a6a21d5d350f0 100755 (executable)
@@ -17,6 +17,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
+INCLUDE(UseQtExt)
 IF(SALOME_USE_VTKVIEWER)
   INCLUDE(${VTK_USE_FILE})
 ENDIF()
@@ -75,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 705323f503abc8dc278136d4e742414e486626b6..183a186b3d4dcfb6fdbfa41470c369579bfbe137 100755 (executable)
@@ -17,7 +17,9 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UsePyQt4)
+INCLUDE(UseQtExt)
+INCLUDE(UsePyQt)
+
 IF(SALOME_USE_VTKVIEWER)
   INCLUDE(${VTK_USE_FILE})
 ENDIF()
@@ -91,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 6cd8e5dd5e04cad073e84c641a190e532b58b69e..1601b48f958745b01431f09c7e11927381a09681 100644 (file)
@@ -22,5 +22,9 @@
 
 %Module SalomePyQtGUILight
 
-%Import QtGuimod.sip
+%Import QtGui/QtGuimod.sip
+%Import QtCore/QtCoremod.sip
+%If (Qt_5_0_0 -)
+%Import QtWidgets/QtWidgetsmod.sip
+%End
 %Import QtXmlmod.sip
index e77ddf6ae1bc239530fee1bbd4b728f0e2d92ee5..bba191dd1418fca2eed1f569d233255e407385fd 100755 (executable)
@@ -17,7 +17,8 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE(UsePyQt4)
+INCLUDE(UseQtExt)
+INCLUDE(UsePyQt)
 IF(SALOME_USE_VTKVIEWER)
   INCLUDE(${VTK_USE_FILE})
 ENDIF()
@@ -104,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 42e81242522eee4b6f09cc20aa9e859c5276a212..609aaf77c6f82587e5688f145014dc2b5bc7f83f 100644 (file)
@@ -120,7 +120,7 @@ namespace
   PyModuleHelper* getPythonHelper()
   {
     LightApp_Module* module = getActiveModule();
-    PyModuleHelper* helper = module ? qFindChild<PyModuleHelper*>( module, "python_module_helper" ) : 0;
+    PyModuleHelper* helper = module ? module->findChild<PyModuleHelper*>( "python_module_helper" ) : 0;
     return helper;
   }
   
@@ -1940,7 +1940,7 @@ public:
        myResult = (QAction*)module->createAction( myId, myTipText, icon, myMenuText, myStatusText, myKey, module, myToggle );
       }
       // for Python module, automatically connect action to callback slot
-      PyModuleHelper* helper = qFindChild<PyModuleHelper*>( module, "python_module_helper" );
+      PyModuleHelper* helper = module->findChild<PyModuleHelper*>( "python_module_helper" );
       if ( helper ) helper->connectAction( myResult );
     }
   }
@@ -2561,7 +2561,7 @@ public:
           // specific processing for ParaView viewer:
           // hierarchy of ParaView viewer is much complex than for usual view;
           // we look for sub-widget named "Viewport"
-          QList<QWidget*> lst = qFindChildren<QWidget*>( wnd, "Viewport" );
+          QList<QWidget*> lst = wnd->findChildren<QWidget*>( "Viewport" );
           if ( !lst.isEmpty() ) {
             lst[0]->resize( myWndWidth, myWndHeight );
             myResult = true;
@@ -2714,7 +2714,7 @@ public:
         QWidget* wnd = viewMgr->getActiveView();
         myResult = viewMgr->getActiveView()->getId();
         if ( wnd ) {
-          wnd->setShown(myVisible);
+          wnd->setVisible(myVisible);
           if ( !myVisible && myWidth == 0 && myHeight == 0 ) {
             myWidth = 1024;
             myHeight = 768;
index 0c32162b11dcac145c3d2b95e0da4c226b4f3e37..0ab24632c2e584568f05724b3e421f9fc880066c 100644 (file)
 %Feature ENABLE_CORBA
 %Feature ENABLE_PLOT2D
 
-%Import QtGuimod.sip
+%Import QtGui/QtGuimod.sip
+%Import QtCore/QtCoremod.sip
+%If (Qt_5_0_0 -)
+%Import QtWidgets/QtWidgetsmod.sip
+%End
 %Import QtXmlmod.sip
 
 %If (ENABLE_PLOT2D)
index e68bc32b8c5173589f7ed42f567e092cdb5ee90d..2ca53c7088eb478c190ecb288b6b50f154c86414 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 cc3c6f7535402595894e22ed6851a91ca104c6c5..aa28f0996b010657121e60bca668b3abf76c69eb 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 4531c7792f04af5efcdb69d358fdffcfb2c8b646..ef51dc0383dcd65bcd921eee61b8a1f23e6227cb 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 9ec6f70ca71a1134b2da6ef88e38a5645a52702b..3feae064172d780b86e093e2120c065f9e0fb195 100755 (executable)
@@ -32,6 +32,7 @@
 
 #include <QFrame>
 #include <QVBoxLayout>
+#include <QMdiSubWindow>
 
 #include <stdarg.h>
 
@@ -71,13 +72,7 @@ STD_MDIDesktop::~STD_MDIDesktop()
 */
 SUIT_ViewWindow* STD_MDIDesktop::activeWindow() const
 {
-  SUIT_ViewWindow* wnd = 0;
-
-  QWidget* wid = myWorkspace->activeWindow();
-  if ( wid && wid->inherits( "SUIT_ViewWindow" ) )
-    wnd = (SUIT_ViewWindow*)wid;
-
-  return wnd;
+  return qobject_cast<SUIT_ViewWindow*>( myWorkspace->activeSubWindow()->widget() );
 }
 
 /*!
@@ -87,10 +82,10 @@ QList<SUIT_ViewWindow*> STD_MDIDesktop::windows() const
 {
   QList<SUIT_ViewWindow*> winList;
 
-  QWidgetList children = myWorkspace->windowList();
-  for ( QWidgetList::iterator it = children.begin(); it != children.end(); ++it )
+  QList<QMdiSubWindow *> children = myWorkspace->subWindowList();
+  for ( QList<QMdiSubWindow *>::iterator it = children.begin(); it != children.end(); ++it )
   {
-    SUIT_ViewWindow* vw = ::qobject_cast<SUIT_ViewWindow*>( *it );
+    SUIT_ViewWindow* vw = ::qobject_cast<SUIT_ViewWindow*>( (*it)->widget() );
     if ( vw )
       winList.append( vw );
   }
@@ -106,7 +101,7 @@ void STD_MDIDesktop::addWindow( QWidget* w )
   if ( !w || !workspace() )
     return;
 
-  workspace()->addWindow( w );
+  workspace()->addSubWindow( w );
 }
 
 /*!Call method perform for operation \a type.*/
index 4fb3b4e49ac0bbbdaf64361e89cc0511e6fb3574..210626d92645fb9a001750506cf92976e70c2995 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 62c565315f97c018149522fe7a7bdb52abbe7dae..cf3a9e964d666ece3ea7c3b439a2a1171cb814fc 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 811be3e9a838949bf08e2b9e97d7e4a1baab0b53..e978085bb8e99b89385722b8f0a7eebbe6456237 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 542b160bb3ea05dd37575dd3c43c4fb0f312dc2c..1d80b8d0ad0a23ee831111c85a01ee61ed416172 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 f2b6949bcf0c4caf2eaf3d0b3da270c69b0989ff..af75627caa61e0f4b5dff3525342af28489d5d84 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 96bc10f3dbd6b3ed71324b679710474d20850fc2..f3cf4039dd5d0b22d3aa34b513bc063f0613c210 100755 (executable)
@@ -127,7 +127,7 @@ void SUIT_Desktop::customEvent( QEvent* e )
                  wid->testAttribute( Qt::WA_WState_Hidden );
 
     addWindow( wid );
-    wid->setShown( !invis );
+    wid->setVisible( !invis );
   }
 }
 
index 20a4ac4938870ecd609ffe7d2c08730f92223485..51eaf1b787a6c839b76c9a608aac2de741911276 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
@@ -518,7 +523,7 @@ QString SUIT_FileDlg::addExtension( const QString& fileName ) const
     return fileName;
 
   QRegExp r( QString::fromLatin1("\\(?[a-zA-Z0-9.*? +;#|]*\\)?$") );
-  int index = r.indexIn( selectedFilter().trimmed() );
+  int index = r.indexIn( selectedNameFilter().trimmed() );
 
   if ( QFileInfo( fileName ).exists() )
     return fileName; // if file exists return as is
@@ -529,7 +534,7 @@ QString SUIT_FileDlg::addExtension( const QString& fileName ) const
     // Due to transformations from the filter list (*.txt *.*xx *.c++ SUIT*.* ) we 
     // will have the pattern (\.txt|\..*xx|\.c\+\+|\..*) (as we validate extension only, 
     // we remove everything except extension mask from the pattern
-    QString wildcard = selectedFilter().mid( index, r.matchedLength() ).trimmed();
+    QString wildcard = selectedNameFilter().mid( index, r.matchedLength() ).trimmed();
     // replace '|' and ';' separators by space symbol and also brackets if there are some
     wildcard.replace( QRegExp( "[\\|;|(|)]" )," " ); 
 
@@ -599,12 +604,12 @@ bool SUIT_FileDlg::processPath( const QString& path )
 */
 void SUIT_FileDlg::addFilter( const QString& filter )
 {
-  QStringList flist = filters();
+  QStringList flist = nameFilters();
   if ( !flist.contains( filter ) ) {
     flist << filter;
-    setFilters( flist );
+    setNameFilters( flist );
   }
-  selectFilter( filter );
+  selectNameFilter( filter );
 }
 
 /*!
@@ -768,9 +773,9 @@ QString SUIT_FileDlg::getFileName( QWidget* parent, const QString& initial,
   tmpfilename = tmpfilename.replace(QRegExp("\\*"), "" ).replace(QRegExp("\\?"), "" );
 
   if ( filters.isEmpty() )
-    fd.setFilter( tr( "ALL_FILES_FILTER" ) ); // All files (*)
+    fd.setNameFilter( tr( "ALL_FILES_FILTER" ) ); // All files (*)
   else
-    fd.setFilters( filters );
+    fd.setNameFilters( filters );
 
   if ( !caption.isEmpty() )
     fd.setWindowTitle( caption );
@@ -875,9 +880,9 @@ QStringList SUIT_FileDlg::getOpenFileNames( QWidget* parent, const QString& init
   fd.setFileMode( ExistingFiles );
 
   if ( filters.isEmpty() )
-    fd.setFilter( tr( "ALL_FILES_FILTER" ) ); // All files (*)
+    fd.setNameFilter( tr( "ALL_FILES_FILTER" ) ); // All files (*)
   else
-    fd.setFilters( filters );
+    fd.setNameFilters( filters );
 
   if ( !caption.isEmpty() )
     fd.setWindowTitle( caption );
index 88942671e2487654cb91ad6ea20358fe49e94162..86dbf2959b2d90b10af24801463d440f47cfe553 100755 (executable)
@@ -87,7 +87,7 @@ QString SUIT_ResourceMgr::userFileName( const QString& appName, const bool for_l
   // Try config file, given in arguments
   for (int i = 1; i < arguments.count(); i++) {
     QRegExp rx ("--resources=(.+)");
-    if ( rx.indexIn( arguments[i] ) >= 0 && rx.numCaptures() > 0 ) {
+    if ( rx.indexIn( arguments[i] ) >= 0 && rx.captureCount() > 0 ) {
       QString file = rx.cap(1);
       QFileInfo fi (file);
       pathName = fi.absoluteFilePath();
index d2a8a655b1f9cc02c312404baf7b4581b1348634..491fcdcd6d300ab84da34b4fb27e27af82136c58 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 fc2ebf2d9d4f991c533d48a27f211aeeb17664fc..0aaf645730e0bbfaafc8514a82bb047dbb0d4332 100755 (executable)
@@ -327,7 +327,7 @@ bool SUIT_ViewManager::isVisible() const
 void SUIT_ViewManager::setShown( const bool on )
 {
   for ( int i = 0; i < myViews.count(); i++ )
-    myViews.at( i )->setShown( on );
+    myViews.at( i )->setVisible( on );
 }
 
 /*!Emit on \a theEvent mouse pressed in \a theView.*/
index 9edcf4c232c5090f97ba7dfb6d08712ecc4f38d0..eed1244fd3f6e8c993e1f17478077d626ff95d11 100755 (executable)
@@ -403,7 +403,7 @@ void SUIT_ViewWindow::updateSyncViews()
     SUIT_Application* app = SUIT_Session::session()->activeApplication();
     if ( app ) {
       SUIT_Desktop* d = app->desktop();
-      QList<SUIT_ViewWindow*> allViews = qFindChildren<SUIT_ViewWindow*>( d );
+      QList<SUIT_ViewWindow*> allViews = d->findChildren<SUIT_ViewWindow*>();
       foreach( SUIT_ViewWindow* vw, allViews ) {
        if ( !vw || vw == this ) continue; // skip invalid views and this one
        SUIT_CameraProperties otherProps = vw->cameraProperties();
@@ -473,7 +473,7 @@ void SUIT_ViewWindow::synchronizeView( SUIT_ViewWindow* viewWindow, int id )
   SUIT_Desktop* d = app->desktop();
   if ( !d ) return;
 
-  QList<SUIT_ViewWindow*> allViews = qFindChildren<SUIT_ViewWindow*>( d );
+  QList<SUIT_ViewWindow*> allViews = d->findChildren<SUIT_ViewWindow*>();
   foreach( SUIT_ViewWindow* vw, allViews ) {
     if ( !vw->cameraProperties().isValid() )
       continue;                    // omit views not supporting camera properties
index 677edbfd39ec56196fa7ebda9e5441e635f408be..4da028a4c396947487320f7bcb814f48b914e3e6 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 0feb3e385e432718b80e677728b00ece7a950e2d..45da4a120b7a68b560aad2c785b826aa3a0b1c86 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 9850d927e4b73fe471869c268c4a2fa3bfb9ee45..7864c19d5fb46420db8787430fbd8cc575987533 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 43266c29d33f8620953e40be12ff15c892787da1..ec2f9433018462c4095a90416269beb59218f252 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 53a802ae31b193c1b6582c3884bf46c91b87d7b8..d2a4072e9d88aec1610e6cc95c1e0234e756b6be 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}")
-
-INSTALL(FILES ${_other_RESOURCES} DESTINATION ${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})
\ No newline at end of file
index 1403de1da632592488bc34af4c806ef0f658d73e..865469493edd350dd2cc799c6cdc56dabb365575 100644 (file)
@@ -99,7 +99,7 @@ void SVTK_ComboAction::update()
 {
   QList<QWidget*> aList = createdWidgets();
   for ( QList<QWidget*>::const_iterator it = aList.begin(); it != aList.end(); ++it )
-    updateCombo( qFindChild<QComboBox*>(*it) );
+    updateCombo( (*it)->findChild<QComboBox*>() );
 }
 
 void SVTK_ComboAction::updateCombo( QComboBox* combo )
index 196e55a4cc961e84250b43992de336efa7578426..75e2a6ef464de99122401782e0c9878cb7030143 100644 (file)
@@ -76,7 +76,7 @@ QVTK_GenericRenderWindowInteractor
   // Start a one-shot timer for <DELAY> ms. 
   //
   static int DELAY = 1;
-  myTimer->setSingleShot(TRUE);
+  myTimer->setSingleShot(true);
   myTimer->start(DELAY);
   return 1;
 }
index 009ba0c081aa869c2fb2fbab9b8f8e1fc00b43e2..a07a76bc1121f41b794ed24792a016f90d5e3841 100644 (file)
@@ -49,7 +49,7 @@ SVTK_NonIsometricDlg
   m_MainWindow(theParent)
 {
   setWindowTitle(tr("DLG_TITLE"));
-  setSizeGripEnabled(TRUE);
+  setSizeGripEnabled(true);
 
   // Create layout for this dialog
   QGridLayout* layoutDlg = new QGridLayout (this);
@@ -109,16 +109,16 @@ SVTK_NonIsometricDlg
   // Create <OK> button
   QPushButton* m_bOk = new QPushButton(tr("O&K"), aGroupBox2);
   m_bOk->setObjectName("m_bOk");
-  m_bOk->setDefault(TRUE);
-  m_bOk->setAutoDefault(TRUE);
+  m_bOk->setDefault(true);
+  m_bOk->setAutoDefault(true);
   // Create <Apply> button
   QPushButton* m_bApply = new QPushButton(tr("&Apply"), aGroupBox2);
   m_bApply->setObjectName("m_bApply");
-  m_bApply->setAutoDefault(TRUE);
+  m_bApply->setAutoDefault(true);
   // Create <Cancel> button
   QPushButton* m_bCancel = new QPushButton(tr("&Cancel"), aGroupBox2);
   m_bCancel->setObjectName("m_bCancel");
-  m_bCancel->setAutoDefault(TRUE);
+  m_bCancel->setAutoDefault(true);
 
   // Layout buttons
   aHBoxLayout2->addWidget(m_bOk);
index ac07e118c22a87257ff3833547f9a329635b537c..55e3b3cb9c0f015812b3e07353191f2ef07a53a2 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 )
     {
@@ -486,7 +513,46 @@ QVTK_RenderWindowInteractor
 }
 
 #endif
+#else
+bool QVTK_RenderWindowInteractor
+::nativeEvent(const QByteArray& eventType, void* message, long* result)
+{
+  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)
+    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)
+        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
+      }
+    }
+  }
 
+ return QWidget::nativeEvent( eventType, message, result );
+}
+#endif
 /*!
   Constructor
 */
index b66ca9d4ac50859f6377c270d15a15f1e17cf653..5d3382803fa9d5c1cb55cd8752a5b3774530a2e1 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 d8705969b87d6777bd2b2c2e2f19d91ae0b44368..f88de7fad8f43ce99ee2af4bb44af0589d26eb56 100755 (executable)
@@ -62,7 +62,7 @@ SVTK_SetRotationPointDlg
   myRWInteractor(theParent->GetInteractor())
 {
   setWindowTitle(tr("DLG_TITLE"));
-  setSizeGripEnabled(TRUE);
+  setSizeGripEnabled(true);
 
   // Create layout for this dialog
   QGridLayout* layoutDlg = new QGridLayout (this);
@@ -153,7 +153,7 @@ SVTK_SetRotationPointDlg
 
   QPushButton* m_bClose = new QPushButton(tr("&Close"), aGroupBox );
   m_bClose->setObjectName("m_bClose");
-  m_bClose->setAutoDefault(TRUE);
+  m_bClose->setAutoDefault(true);
   m_bClose->setFixedSize(m_bClose->sizeHint());
   connect(m_bClose, SIGNAL(clicked()), this, SLOT(onClickClose()));
 
index 5943ef6aa53143d2e4835014eb14f54bb8e0f5fa..2990db6d97cdaae0024ae35f647df65dd30a9d61 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 caa559432204b6627bf33b65b133c353b4587bca..733b826a18077dc1c2f3b876d0b9f43a74f33189 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 15a8d0a24099f3a06040f7ecae4bede198cc30bb..80ad0e440e4a4d5b48aee1e2df59b6c98c0f880e 100644 (file)
@@ -232,7 +232,7 @@ SVTK_UpdateRateDlg
       aGridLayout->addWidget(aLabel, 0, 0);
 
       QLineEdit* aLineEdit = new QLineEdit( aGroupBox );
-      aLineEdit->setReadOnly( TRUE );
+      aLineEdit->setReadOnly( true );
       aGridLayout->addWidget(aLineEdit, 0, 1);
 
       myCurrentUpdateRateLineEdit = aLineEdit;
@@ -244,7 +244,7 @@ SVTK_UpdateRateDlg
       aGridLayout->addWidget(aLabel, 1, 0);
 
       QLineEdit* aLineEdit = new QLineEdit( aGroupBox );
-      aLineEdit->setReadOnly( TRUE );
+      aLineEdit->setReadOnly( true );
       aGridLayout->addWidget(aLineEdit, 1, 1);
 
       myNumberOfCellsLineEdit = aLineEdit;
@@ -259,23 +259,23 @@ SVTK_UpdateRateDlg
     aHBoxLayout->setSpacing(6);
     {
       QPushButton* aPushButton = new QPushButton(tr("OK"), aGroupBox);
-      aPushButton->setDefault(TRUE);
-      aPushButton->setAutoDefault(TRUE);
+      aPushButton->setDefault(true);
+      aPushButton->setAutoDefault(true);
       aHBoxLayout->addWidget(aPushButton);
       connect(aPushButton, SIGNAL(clicked()), this, SLOT(onClickOk()));
     }
     {
       QPushButton* aPushButton = new QPushButton(tr("Apply"), aGroupBox);
-      aPushButton->setDefault(TRUE);
-      aPushButton->setAutoDefault(TRUE);
+      aPushButton->setDefault(true);
+      aPushButton->setAutoDefault(true);
       aHBoxLayout->addWidget(aPushButton);
       connect(aPushButton, SIGNAL(clicked()), this, SLOT(onClickApply()));
     }
     aHBoxLayout->addStretch();
     {
       QPushButton* aPushButton = new QPushButton(tr("Close"), aGroupBox);
-      aPushButton->setDefault(TRUE);
-      aPushButton->setAutoDefault(TRUE);
+      aPushButton->setDefault(true);
+      aPushButton->setAutoDefault(true);
       aHBoxLayout->addWidget(aPushButton);
       connect(aPushButton, SIGNAL(clicked()), this, SLOT(onClickClose()));
     }
index eb3a754e939d50f3b9fd0fcb427af1c6265eca1c..7f1be47983f1aa3d8e298134170bf75786698184 100644 (file)
@@ -565,7 +565,7 @@ void SVTK_Viewer::contextMenuPopup( QMenu* thePopup )
 
   if(TViewWindow* aView = dynamic_cast<TViewWindow*>(myViewManager->getActiveView())){
     //Support of several toolbars in the popup menu
-    QList<QToolBar*> lst = qFindChildren<QToolBar*>( aView );
+    QList<QToolBar*> lst = aView->findChildren<QToolBar*>();
     QList<QToolBar*>::const_iterator it = lst.begin(), last = lst.end();
     for( ; it!=last; it++ )
       thePopup->addAction( (*it)->toggleViewAction() );
index 6db03e85446a4cc374b24623009551ebbf7e2bfd..eb1d0d6aac5d94046b29b076d8a7260f02d33f90 100755 (executable)
@@ -59,7 +59,7 @@ SVTK_ViewParameterDlg::SVTK_ViewParameterDlg(QtxAction* theAction,
   myRWInteractor(theParent->GetInteractor())
 {
   setWindowTitle(tr("DLG_TITLE"));
-  setSizeGripEnabled(TRUE);
+  setSizeGripEnabled(true);
 
   // Top layout
   QVBoxLayout* aTopLayout = new QVBoxLayout(this);
@@ -349,7 +349,7 @@ SVTK_ViewParameterDlg::SVTK_ViewParameterDlg(QtxAction* theAction,
 
   QPushButton* m_bClose = new QPushButton(tr("&Close"), aGroupBox );
   m_bClose->setObjectName("m_bClose");
-  m_bClose->setAutoDefault(TRUE);
+  m_bClose->setAutoDefault(true);
   m_bClose->setFixedSize(m_bClose->sizeHint());
   connect(m_bClose, SIGNAL(clicked()), this, SLOT(onClickClose()));
 
index 5335fa4d8b5ac15b08c02bfca290dbe654c65b81..8c29843b48cb7a24af048184d5fa4a941ce87d9b 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 11d041cb7b1d981046b13b446671176f0af93d85..ef1cddd2afdcba993a813b6b58469cc39ebf2270 100644 (file)
@@ -84,6 +84,7 @@
 #include <SALOME_LifeCycleCORBA.hxx>
 
 #include <QApplication>
+#include <QWidget>
 #include <QAction>
 #include <QRegExp>
 #include <QCheckBox>
@@ -206,9 +207,9 @@ void SalomeApp_Application::start()
     QStringList pyfiles;
     QString loadStudy;
 
-    for (int i = 1; i < qApp->argc(); i++) {
+    for (int i = 1; i < qApp->arguments().size(); i++) {
       QRegExp rxs ("--study-hdf=(.+)");
-      if ( rxs.indexIn( QString(qApp->argv()[i]) ) >= 0 && rxs.capturedTexts().count() > 1 ) {
+      if ( rxs.indexIn( QString(qApp->arguments()[i]) ) >= 0 && rxs.capturedTexts().count() > 1 ) {
         QString file = rxs.capturedTexts()[1];
         QFileInfo fi ( file );
         QString extension = fi.suffix().toLower();
@@ -217,7 +218,7 @@ void SalomeApp_Application::start()
       }
       else {
         QRegExp rxp ("--pyscript=\\[(.+)\\]");
-        if ( rxp.indexIn( QString(qApp->argv()[i]) ) >= 0 && rxp.capturedTexts().count() > 1 ) {
+        if ( rxp.indexIn( QString(qApp->arguments()[i]) ) >= 0 && rxp.capturedTexts().count() > 1 ) {
           // pyscript
           QStringList dictList = rxp.capturedTexts()[1].split("},", QString::SkipEmptyParts);
           for (int k = 0; k < dictList.count(); ++k) {
@@ -895,7 +896,7 @@ void SalomeApp_Application::onDumpStudy( )
   DumpStudyFileDlg fd( desktop() );
   fd.setValidator( new DumpStudyFileValidator( &fd ) );
   fd.setWindowTitle( tr( "TOT_DESK_FILE_DUMP_STUDY" ) );
-  fd.setFilters( aFilters );
+  fd.setNameFilters( aFilters );
   fd.myPublishChk->setChecked( anIsPublish );
   fd.myMultiFileChk->setChecked( anIsMultiFile );
   fd.mySaveGUIChk->setChecked( anIsSaveGUI );
@@ -1314,8 +1315,24 @@ void SalomeApp_Application::moduleActionSelected( const int id )
 /*!Gets CORBA::ORB_var*/
 CORBA::ORB_var SalomeApp_Application::orb()
 {
-  ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
-  static CORBA::ORB_var _orb = init( qApp->argc(), qApp->argv() );
+  static CORBA::ORB_var _orb;
+
+  if ( CORBA::is_nil( _orb ) ) {
+    QStringList args = QApplication::arguments();
+    int argc = args.size();
+    std::vector<std::string> args1(argc);
+    char** argv = new char*[argc];
+    for ( int i = 0; i < argc; ++i ) {
+      args1[i] = args[i].toStdString();
+      argv[i]  = const_cast<char*>( args1[i].c_str() );
+    }
+
+    ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
+    _orb = init( argc, argv );
+
+    delete [] argv;
+  }
+
   return _orb;
 }
 
index 9b58f1e36c69086a4d3e1cbfca4215f66b0569e2..b26a8424cb7b8c9a0b736e6684cfd298b0159663 100644 (file)
@@ -302,10 +302,24 @@ char* SalomeApp_Engine_i::getVersion()
 */
 CORBA::ORB_var SalomeApp_Engine_i::orb()
 {
-  ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
-  // TODO: using QApplication here looks ugly, think how to
-  // obtain the ORB reference in a nicer way...
-  static CORBA::ORB_var _orb = init( qApp->argc(), qApp->argv() );
+  static CORBA::ORB_var _orb;
+
+  if ( CORBA::is_nil( _orb ) ) {
+    QStringList args = QApplication::arguments();
+    int argc = args.size();
+    std::vector<std::string> args1(argc);
+    char** argv = new char*[argc];
+    for ( int i = 0; i < argc; ++i ) {
+      args1[i] = args[i].toStdString();
+      argv[i]  = const_cast<char*>( args1[i].c_str() );
+    }
+
+    ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
+    _orb = init( argc, argv );
+
+    delete [] argv;
+  }
+
   return _orb;
 }
 
index 95e970b41425c1c2a53f6d4e3d6a52937a67b276..4ba39a4ef5115d1c9612051976ad841474c62163 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 1e2f8252449a7d6f4676580069ec38686a1864e2..801faa6129e38b382441c082b7312121766d8d44 100644 (file)
@@ -62,7 +62,7 @@ SalomeApp_StudyPropertiesDlg::SalomeApp_StudyPropertiesDlg(QWidget* parent)
   : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
     myIsChanged(false)
 {
-  setModal( TRUE );
+  setModal( true );
 
   setWindowTitle(tr("TLT_STUDY_PROPERTIES"));
   setSizeGripEnabled( true );
index 35f8784a67e6a49185a7ffeff2bbdb5e8c9036e9..f8ec9d6fbb31884778ad30720e3610beef759f83 100755 (executable)
@@ -28,7 +28,7 @@
 # --- 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
   minmax_dialog.py
   minmax_plugin.py
index 7e1fbe5f44136516d910becbff68af9472bdeaf8..aa050e37337b160014ffa7b499c744efc793b3f8 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 )
   {
   case QtDebugMsg:
-    //MESSAGE( "Debug: " << msg );
+    //MESSAGE( "Debug: " << qPrintable(msg) );
     break;
   case QtWarningMsg:
-    MESSAGE( "Warning: " << msg );
+    MESSAGE( "Warning: " << qPrintable(msg) );
     break;
   case QtFatalMsg:
-    MESSAGE( "Fatal: " << msg );
+    MESSAGE( "Fatal: " << qPrintable(msg) );
     break;
   }
 }
@@ -251,7 +256,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() ),
@@ -341,20 +347,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 );
@@ -377,7 +390,7 @@ int main( int argc, char **argv )
   _qappl.setApplicationVersion( salomeVersion() );
 
   // Add application library path (to search style plugin etc...)
-  QString path = QDir::convertSeparators( SUIT_Tools::addSlash( QString( ::getenv( "GUI_ROOT_DIR" ) ) ) + QString( "bin/salome" ) );
+  QString path = QDir::toNativeSeparators( SUIT_Tools::addSlash( QString( ::getenv( "GUI_ROOT_DIR" ) ) ) + QString( "bin/salome" ) );
   _qappl.addLibraryPath( path );
 
   bool isGUI    = isFound( "GUI",    argc, argv );
@@ -564,9 +577,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 2789e23a8a47cba946b936fe163e35dbd0878289..3cb7fa8a55f377a0f7dd19ec48c33e952c365c3d 100644 (file)
@@ -261,17 +261,27 @@ void Session_ServerCheck::run()
   // start check servers
   int current = 0;
   QString error;
-  int    argc = QApplication::instance()->argc();
-  char** argv = QApplication::instance()->argv();
 
+  QStringList args = QApplication::arguments();
+  int argc = args.size();
+  std::vector<std::string> args1(argc);
+  char** argv = new char*[argc];
+  for ( int i = 0; i < argc; ++i ) {
+    args1[i] = args[i].toStdString();
+    argv[i]  = const_cast<char*>( args1[i].c_str() );
+  }
+
+  bool OK = true;
+  
   // 1. Check naming service
-  for ( int i = 0; i < myAttempts; i++ ) {
+  for ( int i = 0; (i < myAttempts) && OK; i++ ) {
     Locker locker( this );
 
     setStep( current * myAttempts + i );
 
     try {
-      CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
+      ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
+      CORBA::ORB_var orb = init( argc, argv );
       CORBA::Object_var obj = orb->resolve_initial_references( "NameService" );
       CosNaming::NamingContext_var _root_context = CosNaming::NamingContext::_narrow( obj );
       if ( !CORBA::is_nil( _root_context ) ) {
@@ -288,12 +298,13 @@ void Session_ServerCheck::run()
 
     if ( i == myAttempts-1 ) {
       setError( tr( "Unable to contact the naming service.\n" ) );
-      return;
+      OK = false;
+      //return;
     }
   }
 
   // 2. Check registry server
-  for ( int i = 0; i < myAttempts ; i++ ) {
+  for ( int i = 0; (i < myAttempts) && OK ; i++ ) {
     Locker locker( this );
 
     setStep( current * myAttempts + i );
@@ -336,12 +347,13 @@ void Session_ServerCheck::run()
 
     if ( i == myAttempts-1 ) {
       setError( tr( "Registry server is not found.\n%1" ).arg ( error ) );
-      return;
+      OK = false;
+      //return;
     }
   }
 
   // 3. Check data server
-  for ( int i = 0; i < myAttempts ; i++ ) {
+  for ( int i = 0; (i < myAttempts) && OK ; i++ ) {
     Locker locker( this );
 
     setStep( current * myAttempts + i );
@@ -384,12 +396,13 @@ void Session_ServerCheck::run()
 
     if ( i == myAttempts-1 ) {
       setError( tr( "Study server is not found.\n%1" ).arg ( error ) );
-      return;
+      OK = false;
+      //return;
     }
   }
   
   // 4. Check module catalogue server
-  for ( int i = 0; i < myAttempts ; i++ ) {
+  for ( int i = 0; (i < myAttempts) && OK ; i++ ) {
     Locker locker( this );
 
     setStep( current * myAttempts + i );
@@ -432,12 +445,13 @@ void Session_ServerCheck::run()
 
     if ( i == myAttempts-1 ) {
       setError( tr( "Module catalogue server is not found.\n%1" ).arg ( error ) );
-      return;
+      OK = false;
+      //return;
     }
   }
 
   // 5. Check data server
-  for ( int i = 0; i < myAttempts ; i++ ) {
+  for ( int i = 0; (i < myAttempts) && OK ; i++ ) {
     Locker locker( this );
 
     setStep( current * myAttempts + i );
@@ -480,13 +494,14 @@ void Session_ServerCheck::run()
 
     if ( i == myAttempts-1 ) {
       setError( tr( "Session server is not found.\n%1" ).arg ( error ) );
-      return;
+      OK = false;
+      //return;
     }
   }
 
   // 6. Check C++ container
   if ( myCheckCppContainer ) {
-    for ( int i = 0; i < myAttempts ; i++ ) {
+    for ( int i = 0; (i < myAttempts) && OK ; i++ ) {
       Locker locker( this );
       
       setStep( current * myAttempts + i );
@@ -530,14 +545,15 @@ void Session_ServerCheck::run()
       
       if ( i == myAttempts-1 ) {
         setError( tr( "C++ container is not found.\n%1" ).arg ( error ) );
-        return;
+        OK = false;
+        //return;
       }
     }
   }
 
   // 7. Check Python container
   if ( myCheckPyContainer ) {
-    for ( int i = 0; i < myAttempts ; i++ ) {
+    for ( int i = 0; (i < myAttempts) && OK ; i++ ) {
       Locker locker( this );
       
       setStep( current * myAttempts + i );
@@ -581,14 +597,15 @@ void Session_ServerCheck::run()
 
       if ( i == myAttempts-1 ) {
         setError( tr( "Python container is not found.\n%1" ).arg ( error ) );
-        return;
+        OK = false;
+        //return;
       }
     }
   }
 
   // 8. Check supervision container
   if ( myCheckSVContainer ) {
-    for ( int i = 0; i < myAttempts ; i++ ) {
+    for ( int i = 0; (i < myAttempts) && OK ; i++ ) {
       Locker locker( this );
       
       setStep( current * myAttempts + i );
@@ -632,8 +649,11 @@ void Session_ServerCheck::run()
     
       if ( i == myAttempts-1 ) {
         setError( tr( "Supervision container is not found.\n%1" ).arg ( error ) );
-        return;
+        OK = false;
+        //return;
       }
     }
   }
+
+  delete [] argv;
 }
index 663700542731e2053418b52eec0f9fd4c4f7cd90..005b5eea8c611fb6ab28c3af83cac3da455ae1db 100755 (executable)
@@ -64,7 +64,7 @@ SALOME_Session_i::SALOME_Session_i(int argc,
 {
   _argc = argc ;
   _argv = argv ;
-  _isGUI = FALSE ;
+  _isGUI = false ;
   _runningStudies= 0 ;
   _orb = CORBA::ORB::_duplicate(orb) ;
   _poa = PortableServer::POA::_duplicate(poa) ;
index 9d48f307baee5c4cf230c158daead4527988e306..71056d6a6988490570eeb3abce50837234d5a8ed 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 d49af67d208af0e7af656c122c27ff6a2f193297..bf355581aee12154ca1c738cb2605b19441126d7 100644 (file)
@@ -59,8 +59,7 @@
 #include <QSlider>
 #include <QMainWindow>
 #include <QPixmapCache>
-
-#include <limits.h>
+#include <QTileRules>
 
 #define SHADOW          1
 #define LINE_GR_MARGIN  10
@@ -203,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 );
@@ -323,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;
@@ -345,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;
   }
 
@@ -359,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
 }
 
 /*!
@@ -375,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;
   }
 
@@ -389,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
 }
 
 /*!
@@ -403,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;
   }
 
@@ -555,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;
@@ -626,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 );
@@ -708,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:
@@ -758,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
   }
 }
 
@@ -777,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;
   }
 
@@ -906,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();
@@ -944,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:
@@ -963,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:
@@ -1495,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;
   }
 }
@@ -1511,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;
   }
 
@@ -1551,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: {
@@ -1567,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;
     }
@@ -1642,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;
@@ -1831,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) )
@@ -1845,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;
@@ -1961,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
   }
 }
 
@@ -1980,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);
@@ -2020,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)) {
@@ -2052,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
@@ -2077,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 )
@@ -2092,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
   }
 }
 
@@ -2108,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 )
@@ -2124,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
 }
 
 /*!
@@ -2140,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 )
@@ -2172,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 );
@@ -2216,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
@@ -2270,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 e81b5bffc80c5e90338fceff73ad7b0619b31ee8..47eb21dfba1213af40677668d08e556ee6743238 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 9fc4d0c5ac67c0065107ed121d512b34d0197b69..db9f680edc12350dd63ec93436558c0b8a58b797 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}")
\ No newline at end of file
index de23090b3031f0c210acffef59e42668b18d26c8..ab243b708b5aa747ad54e453b14990d5ee996602 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 cb05061e54a4b0b9a69a1d530a8f0814794d7484..6011212275e56410edb426188d2dbafa98be4a5a 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 904d80b955a2112255a6e3c2a088704dec4ee272..51dab073e62de32324ffd020c7599982bd403cb5 100644 (file)
@@ -18,6 +18,7 @@
 //
 
 #include <QtGui>
+#include <QInputDialog>
 
 #include "mainwindow.hxx"
 #include "TreeModel.hxx"
index 8833cb027bf15eb4e350ea1a22a2fbd920310907..35f45a6d87d80f7d6c7ecf5b24ef245f3b9f2cfe 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 d4dd5f76e30eee7913ee41dbe56fcaf57403dbbf..611346f4d9e81ad7425f65c98bcab5d6aecc84bf 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 8abd0fa018d63e436fbd9ebae43f5c3c2db8da7e..6179c167963d8c7660e3e816e66084fc50b79825 100755 (executable)
@@ -322,7 +322,7 @@ int VTKViewer_RenderWindowInteractor::CreateTimer(int vtkNotUsed(timertype))
   ///
   /// Start a one-shot timer for 10ms.
   ///
-  mTimer->setSingleShot(TRUE) ;
+  mTimer->setSingleShot(true) ;
   mTimer->start(10) ;
   return 1 ;
 }
index b00ceb1599b1074bbf60c520cae76b7e060aa551..3559088e843021dc2c5537b2a90054491a6bffa6 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 0aafe72d7fca3c3901f6b6db7ad7604ecfdecd02..b36e4366bdcbba67d29de0d0479f01ef28dca806 100644 (file)
@@ -37,7 +37,7 @@ public:
   ViewerTools_DialogBase(QtxAction* theAction,
                          QWidget* theParent,
                          const char* theName = "", 
-                         bool theModal = FALSE
+                         bool theModal = false
                          Qt::WindowFlags theWFalgs = 0);
 
   ~ViewerTools_DialogBase();
index 3c80f81a45418aae456d7fa2cd69f04d70cf7049..0ef5b54dbd4133260ff3a9697d177c09e51a0de7 100755 (executable)
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+INCLUDE(UseQtExt)
 
 INCLUDE_DIRECTORIES(
   ${CMAKE_CURRENT_BINARY_DIR}
   ${CMAKE_CURRENT_SOURCE_DIR}
   )
 
-
 SET(qtester_SOURCES
   qtester.cxx
   )
@@ -55,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
@@ -66,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}