From 1739d7cf27a6bb98f91aa32f3adeec8b909a0c55 Mon Sep 17 00:00:00 2001 From: imn Date: Thu, 12 Nov 2015 17:13:55 +0300 Subject: [PATCH] Merge Qt5 porting. --- CMakeLists.txt | 52 +++- SalomeGUIConfig.cmake.in | 16 +- adm_local/cmake_files/CMakeLists.txt | 7 +- adm_local/cmake_files/FindPyQt5.cmake | 116 ++++++++ .../cmake_files/FindSalomeParaView.cmake | 13 +- adm_local/cmake_files/FindSalomePyQt5.cmake | 37 +++ adm_local/cmake_files/FindSalomeQt4.cmake | 11 + adm_local/cmake_files/FindSalomeQt5.cmake | 69 +++++ .../{UsePyQt4.cmake => UsePyQt.cmake} | 48 +-- .../{UseQt4Ext.cmake => UseQtExt.cmake} | 38 ++- src/CAF/CAF_Study.cxx | 4 +- src/CAF/CMakeLists.txt | 6 +- src/CAM/CAM_Module.cxx | 27 ++ src/CAM/CAM_Module.h | 3 + src/CAM/CMakeLists.txt | 6 +- src/DDS/CMakeLists.txt | 1 - src/Event/CMakeLists.txt | 3 + src/GLViewer/CMakeLists.txt | 6 +- src/GLViewer/GLViewer_BaseObjects.cxx | 32 +- src/GLViewer/GLViewer_Context.cxx | 28 +- src/GLViewer/GLViewer_Context.h | 6 +- src/GLViewer/GLViewer_Drawer.cxx | 10 +- src/GLViewer/GLViewer_Grid.cxx | 4 +- src/GLViewer/GLViewer_ViewPort.cxx | 11 +- src/GLViewer/GLViewer_ViewPort2d.cxx | 6 +- src/GLViewer/GLViewer_Viewer.cxx | 4 +- src/GLViewer/GLViewer_Viewer2d.cxx | 14 +- src/GLViewer/GLViewer_Widget.cxx | 2 +- src/GUI_PY/CMakeLists.txt | 5 +- src/GraphicsView/CMakeLists.txt | 6 +- src/GraphicsView/GraphicsView_Object.cxx | 2 +- src/GuiHelpers/CMakeLists.txt | 4 +- src/HelpBrowser/CMakeLists.txt | 14 +- src/HelpBrowser/qtlocalpeer.cpp | 1 + src/ImageComposer/CMakeLists.txt | 2 - src/LightApp/CMakeLists.txt | 12 +- src/LightApp/LightApp_Application.cxx | 19 +- src/LightApp/LightApp_Dialog.cxx | 6 +- src/LightApp/LightApp_Driver.cxx | 4 +- src/LightApp/LightApp_ModuleAction.cxx | 2 +- src/LightApp/LightApp_NameDlg.cxx | 6 +- src/LogWindow/CMakeLists.txt | 6 +- src/OBJECT/CMakeLists.txt | 4 +- src/OCCViewer/CMakeLists.txt | 8 +- src/OCCViewer/OCCViewer_ClippingDlg.cxx | 12 +- .../OCCViewer_CreateRestoreViewDlg.cxx | 4 +- .../OCCViewer_SetRotationPointDlg.cxx | 4 +- src/OCCViewer/OCCViewer_SetRotationPointDlg.h | 2 +- src/OCCViewer/OCCViewer_Utilities.cxx | 2 +- src/OCCViewer/OCCViewer_ViewModel.cxx | 2 +- src/OCCViewer/OCCViewer_ViewPort.cxx | 11 +- src/OCCViewer/OCCViewer_ViewPort3d.cxx | 8 +- src/OCCViewer/OCCViewer_ViewSketcher.cxx | 4 + src/ObjBrowser/CMakeLists.txt | 6 +- src/PVViewer/CMakeLists.txt | 10 +- src/Plot2d/CMakeLists.txt | 6 +- src/Plot2d/Plot2d_FitDataDlg.cxx | 8 +- src/Plot2d/Plot2d_PlotItems.cxx | 8 +- src/Plot2d/Plot2d_SetupViewDlg.cxx | 10 +- src/Plot2d/Plot2d_ViewFrame.cxx | 16 +- src/PyConsole/CMakeLists.txt | 6 +- src/PyConsole/PyConsole_EnhEditor.cxx | 3 +- src/PyConsole/PyConsole_EnhEditor.h | 2 +- src/PyEditor/CMakeLists.txt | 6 +- src/PyEditor/PyEditor_SettingsDlg.cxx | 8 +- src/PyInterp/CMakeLists.txt | 4 +- src/PyViewer/CMakeLists.txt | 10 +- src/PyViewer/PyViewer_ViewWindow.cxx | 4 + src/QDS/CMakeLists.txt | 6 +- src/QDS/QDS_Datum.cxx | 2 +- src/Qtx/CMakeLists.txt | 12 +- src/Qtx/Qtx.cxx | 6 +- src/Qtx/QtxAction.cxx | 62 ++++ src/Qtx/QtxAction.h | 2 + src/Qtx/QtxActionToolMgr.cxx | 2 +- src/Qtx/QtxColorButton.cxx | 2 +- src/Qtx/QtxDialog.cxx | 5 +- src/Qtx/QtxDockAction.cxx | 4 +- src/Qtx/QtxFontEdit.cxx | 4 +- src/Qtx/QtxLogoMgr.cxx | 2 +- src/Qtx/QtxMainWindow.cxx | 2 +- src/Qtx/QtxPathDialog.cxx | 10 +- src/Qtx/QtxPathEdit.cxx | 2 +- src/Qtx/QtxPopupMgr.cxx | 22 +- src/Qtx/QtxPreferenceMgr.cxx | 2 +- src/Qtx/QtxResourceMgr.cxx | 8 +- src/Qtx/QtxSearchTool.cxx | 10 +- src/Qtx/QtxTranslator.cxx | 32 +- src/Qtx/QtxTranslator.h | 4 + src/Qtx/QtxTreeView.cxx | 27 +- src/Qtx/QtxWorkspace.cxx | 24 +- src/Qtx/QtxWorkspace.h | 4 +- src/Qtx/QtxWorkspaceAction.cxx | 30 +- src/Qtx/QtxWorkstack.cxx | 4 +- src/Qtx/QtxWorkstackAction.cxx | 6 +- src/QxScene/CMakeLists.txt | 6 +- .../SALOME_PYQT_GUI/CMakeLists.txt | 3 +- .../SALOME_PYQT_GUILight/CMakeLists.txt | 8 +- .../SALOME_PYQT_GUILight.sip | 6 +- src/SALOME_PYQT/SalomePyQt/CMakeLists.txt | 7 +- src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx | 8 +- src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip | 6 +- src/SOCC/CMakeLists.txt | 4 +- src/SPlot2d/CMakeLists.txt | 4 +- src/STD/CMakeLists.txt | 6 +- src/STD/STD_MDIDesktop.cxx | 17 +- src/SUIT/CMakeLists.txt | 6 +- src/SUIT/SUIT_ActionOperation.cxx | 4 +- src/SUIT/SUIT_Application.cxx | 22 ++ src/SUIT/SUIT_Application.h | 5 + src/SUIT/SUIT_DataBrowser.cxx | 2 +- src/SUIT/SUIT_Desktop.cxx | 2 +- src/SUIT/SUIT_FileDlg.cxx | 23 +- src/SUIT/SUIT_ResourceMgr.cxx | 2 +- src/SUIT/SUIT_TreeModel.cxx | 26 +- src/SUIT/SUIT_ViewManager.cxx | 2 +- src/SUIT/SUIT_ViewWindow.cxx | 4 +- src/SUITApp/CMakeLists.txt | 6 +- src/SUITApp/SUITApp.cxx | 7 + src/SUITApp/SUITApp_Application.cxx | 7 +- src/SUITApp/SUITApp_Application.h | 4 +- src/SVTK/CMakeLists.txt | 13 +- src/SVTK/SVTK_ComboAction.cxx | 2 +- .../SVTK_GenericRenderWindowInteractor.cxx | 2 +- src/SVTK/SVTK_NonIsometricDlg.cxx | 10 +- src/SVTK/SVTK_RenderWindowInteractor.cxx | 82 +++++- src/SVTK/SVTK_RenderWindowInteractor.h | 6 +- src/SVTK/SVTK_SetRotationPointDlg.cxx | 4 +- src/SVTK/SVTK_SpaceMouse.cxx | 273 +++++++++++++++--- src/SVTK/SVTK_SpaceMouse.h | 66 ++++- src/SVTK/SVTK_UpdateRateDlg.cxx | 16 +- src/SVTK/SVTK_ViewModel.cxx | 2 +- src/SVTK/SVTK_ViewParameterDlg.cxx | 4 +- src/SalomeApp/CMakeLists.txt | 6 +- src/SalomeApp/SalomeApp_Application.cxx | 29 +- src/SalomeApp/SalomeApp_Engine_i.cxx | 22 +- src/SalomeApp/SalomeApp_ListView.cxx | 4 + .../SalomeApp_StudyPropertiesDlg.cxx | 2 +- src/SalomeApp/pluginsdemo/CMakeLists.txt | 2 +- src/Session/SALOME_Session_Server.cxx | 31 +- src/Session/Session_ServerCheck.cxx | 58 ++-- src/Session/Session_Session_i.cxx | 2 +- src/Style/CMakeLists.txt | 8 +- src/Style/Style_Salome.cxx | 194 ++++++++++++- src/Style/Style_Salome.h | 14 +- src/TOOLSGUI/CMakeLists.txt | 7 +- src/TreeData/CMakeLists.txt | 6 +- src/TreeData/Test/CMakeLists.txt | 10 +- src/TreeData/Test/mainwindow.cxx | 1 + src/VTKViewer/CMakeLists.txt | 15 +- src/VTKViewer/VTKViewer_RenderWindow.cxx | 3 - .../VTKViewer_RenderWindowInteractor.cxx | 2 +- src/ViewerTools/CMakeLists.txt | 6 +- src/ViewerTools/ViewerTools_DialogBase.h | 2 +- tools/dlgfactory/CMakeLists.txt | 18 +- 155 files changed, 1694 insertions(+), 558 deletions(-) create mode 100644 adm_local/cmake_files/FindPyQt5.cmake create mode 100644 adm_local/cmake_files/FindSalomePyQt5.cmake create mode 100644 adm_local/cmake_files/FindSalomeQt5.cmake rename adm_local/cmake_files/{UsePyQt4.cmake => UsePyQt.cmake} (87%) rename adm_local/cmake_files/{UseQt4Ext.cmake => UseQtExt.cmake} (63%) diff --git a/CMakeLists.txt b/CMakeLists.txt index df762efd0..816db6fed 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 SALOMEConfig.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 SalomeConfig.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 diff --git a/SalomeGUIConfig.cmake.in b/SalomeGUIConfig.cmake.in index 5010a661f..641eacac8 100644 --- a/SalomeGUIConfig.cmake.in +++ b/SalomeGUIConfig.cmake.in @@ -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: diff --git a/adm_local/cmake_files/CMakeLists.txt b/adm_local/cmake_files/CMakeLists.txt index 8fabf8484..e52bb57b6 100755 --- a/adm_local/cmake_files/CMakeLists.txt +++ b/adm_local/cmake_files/CMakeLists.txt @@ -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 index 000000000..b255db01e --- /dev/null +++ b/adm_local/cmake_files/FindPyQt5.cmake @@ -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 /sip/QtCore, for a custom install +# - or /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() diff --git a/adm_local/cmake_files/FindSalomeParaView.cmake b/adm_local/cmake_files/FindSalomeParaView.cmake index 4363516ba..08c01ebc7 100644 --- a/adm_local/cmake_files/FindSalomeParaView.cmake +++ b/adm_local/cmake_files/FindSalomeParaView.cmake @@ -19,12 +19,21 @@ # 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 index 000000000..22598cc26 --- /dev/null +++ b/adm_local/cmake_files/FindSalomePyQt5.cmake @@ -0,0 +1,37 @@ +# Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author: Adrien Bruneton +# + +# PyQt5 detection for Salome +# +# !! Please read the generic detection procedure in SalomeMacros.cmake !! +# + +# PyQt needs SIP, call it automatically +FIND_PACKAGE(SalomeSIP REQUIRED) + +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(PyQt5 PYQT_PYUIC_EXECUTABLE 2) +MARK_AS_ADVANCED(PYQT_PYUIC_EXECUTABLE PYQT_PYRCC_EXECUTABLE PYQT_SIPS_DIR PYQT_PYUIC_PATH PYQT_PYRCC_PATH) + +IF(PYQT5_FOUND) + SALOME_ACCUMULATE_ENVIRONMENT(PATH ${PYQT_PYUIC_EXECUTABLE}) + SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${PYQT_PYTHONPATH}) + SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH ${PYQT_PYTHONPATH}) +ENDIF() diff --git a/adm_local/cmake_files/FindSalomeQt4.cmake b/adm_local/cmake_files/FindSalomeQt4.cmake index a89fc81a8..86faa8232 100644 --- a/adm_local/cmake_files/FindSalomeQt4.cmake +++ b/adm_local/cmake_files/FindSalomeQt4.cmake @@ -23,11 +23,22 @@ # # !! 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 index 000000000..e3d769460 --- /dev/null +++ b/adm_local/cmake_files/FindSalomeQt5.cmake @@ -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/UsePyQt4.cmake b/adm_local/cmake_files/UsePyQt.cmake similarity index 87% rename from adm_local/cmake_files/UsePyQt4.cmake rename to adm_local/cmake_files/UsePyQt.cmake index ee3ec4558..1c60d1690 100644 --- a/adm_local/cmake_files/UsePyQt4.cmake +++ b/adm_local/cmake_files/UsePyQt.cmake @@ -20,20 +20,20 @@ #################################################################### # -# _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME: internal function +# _PYQT_WRAP_GET_UNIQUE_TARGET_NAME: internal function # # Used to generate unique custom target name for usage in -# PYQT4_WRAP_UIC macro. +# PYQT_WRAP_UIC macro. # -# USAGE: _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(prefix unique_name) +# 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(_PYQT4_WRAP_GET_UNIQUE_TARGET_NAME name unique_name) - SET(_propertyName "_PYQT4_WRAP_UNIQUE_COUNTER_${name}") +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) @@ -45,12 +45,12 @@ ENDFUNCTION() #################################################################### # -# PYQT4_WRAP_UIC macro +# PYQT_WRAP_UIC macro # # Create Python modules by processing input *.ui (Qt designer) files with -# PyQt4 pyuic4 tool. +# PyQt pyuic tool. # -# USAGE: PYQT4_WRAP_UIC(output_files pyuic_files) +# USAGE: PYQT_WRAP_UIC(output_files pyuic_files) # # ARGUMENTS: # output_files [out] variable where output file names are listed to @@ -62,7 +62,7 @@ ENDFUNCTION() # - Macro automatically adds custom build target to generate output files # #################################################################### -MACRO(PYQT4_WRAP_UIC outfiles) +MACRO(PYQT_WRAP_UIC outfiles) IF(NOT WIN32) @@ -77,7 +77,7 @@ MACRO(PYQT4_WRAP_UIC outfiles) ) SET(${outfiles} ${${outfiles}} ${_output}) ENDFOREACH() - _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _uniqueTargetName) + _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _uniqueTargetName) ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL DEPENDS ${${outfiles}}) ELSE(NOT WIN32) @@ -90,30 +90,30 @@ MACRO(PYQT4_WRAP_UIC outfiles) #### SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) - _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _uniqueTargetName) + _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}) - _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _TgName) + _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 PYQT4_WRAP_UIC_TARGETS) + SET_TARGET_PROPERTIES(${_TgName} PROPERTIES FOLDER PYQT_WRAP_UIC_TARGETS) ADD_DEPENDENCIES(${_uniqueTargetName} DEPEND ${_TgName}) SET(${outfiles} ${${outfiles}} ${_output}) ENDFOREACH() ENDIF(NOT WIN32) -ENDMACRO(PYQT4_WRAP_UIC) +ENDMACRO(PYQT_WRAP_UIC) #################################################################### # -# PYQT4_WRAP_SIP macro +# PYQT_WRAP_SIP macro # # Generate C++ wrappings for *.sip files by processing them with sip. # -# USAGE: PYQT4_WRAP_SIP(output_files sip_files) +# USAGE: PYQT_WRAP_SIP(output_files sip_files) # # ARGUMENTS: # output_files [out] variable where output file names are listed to @@ -138,7 +138,7 @@ ENDMACRO(PYQT4_WRAP_UIC) # - Process several sip modules. # #################################################################### -MACRO(PYQT4_WRAP_SIP outfiles) +MACRO(PYQT_WRAP_SIP outfiles) SET(_output) SET(_module_input) FOREACH(_input ${ARGN}) @@ -175,16 +175,16 @@ MACRO(PYQT4_WRAP_SIP outfiles) COMMAND ${SIP_EXECUTABLE} ${PYQT_SIPFLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${_module_input} MAIN_DEPENDENCY ${_module_input} ) -ENDMACRO(PYQT4_WRAP_SIP) +ENDMACRO(PYQT_WRAP_SIP) #################################################################### # -# PYQT4_WRAP_QRC macro +# PYQT_WRAP_QRC macro # -# Generate Python wrappings for *.qrc files by processing them with pyrcc4. +# Generate Python wrappings for *.qrc files by processing them with pyrcc5. # -# USAGE: PYQT4_WRAP_QRC(output_files qrc_files) +# USAGE: PYQT_WRAP_QRC(output_files qrc_files) # # ARGUMENTS: # output_files [out] variable where output file names are listed to @@ -197,7 +197,7 @@ ENDMACRO(PYQT4_WRAP_SIP) # #################################################################### -MACRO(PYQT4_WRAP_QRC outfiles) +MACRO(PYQT_WRAP_QRC outfiles) FOREACH(_input ${ARGN}) GET_FILENAME_COMPONENT(_input_name ${_input} NAME) STRING(REPLACE ".qrc" "_qrc.py" _input_name ${_input_name}) @@ -209,6 +209,6 @@ MACRO(PYQT4_WRAP_QRC outfiles) ) SET(${outfiles} ${${outfiles}} ${_output}) ENDFOREACH() - _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_QRC_PY_FILES _uniqueTargetName) + _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_QRC_PY_FILES _uniqueTargetName) ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL DEPENDS ${${outfiles}}) -ENDMACRO(PYQT4_WRAP_QRC) +ENDMACRO(PYQT_WRAP_QRC) diff --git a/adm_local/cmake_files/UseQt4Ext.cmake b/adm_local/cmake_files/UseQtExt.cmake similarity index 63% rename from adm_local/cmake_files/UseQt4Ext.cmake rename to adm_local/cmake_files/UseQtExt.cmake index 32e776c62..03e40f2ac 100644 --- a/adm_local/cmake_files/UseQt4Ext.cmake +++ b/adm_local/cmake_files/UseQtExt.cmake @@ -17,24 +17,52 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INSTALL(CODE "MACRO(QT4_COMPILE_TS_ON_INSTALL MYLRELEASE MYTSFILE MYFULLDIR MYOUTQMFILE) +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(QT4_COMPILE_TS_ON_INSTALL)") +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(QT4_INSTALL_TS_RESOURCES MYTSFILES WHERETOINSTALL) +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 "QT4_COMPILE_TS_ON_INSTALL( \"${QT_LRELEASE_EXECUTABLE}\" \"${CMAKE_CURRENT_SOURCE_DIR}/${input}\" \"${CMAKE_INSTALL_PREFIX}/\${INSTALL_TS_DIR}\" ${output})") + 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(QT4_INSTALL_TS_RESOURCES) +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) diff --git a/src/CAF/CAF_Study.cxx b/src/CAF/CAF_Study.cxx index 054e71d58..d60fd3516 100755 --- a/src/CAF/CAF_Study.cxx +++ b/src/CAF/CAF_Study.cxx @@ -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; diff --git a/src/CAF/CMakeLists.txt b/src/CAF/CMakeLists.txt index dc2abccef..a34448604 100755 --- a/src/CAF/CMakeLists.txt +++ b/src/CAF/CMakeLists.txt @@ -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 diff --git a/src/CAM/CAM_Module.cxx b/src/CAM/CAM_Module.cxx index 5ad1dad48..a2cd873f0 100755 --- a/src/CAM/CAM_Module.cxx +++ b/src/CAM/CAM_Module.cxx @@ -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 ); diff --git a/src/CAM/CAM_Module.h b/src/CAM/CAM_Module.h index 69c541505..a744f5186 100755 --- a/src/CAM/CAM_Module.h +++ b/src/CAM/CAM_Module.h @@ -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() ); diff --git a/src/CAM/CMakeLists.txt b/src/CAM/CMakeLists.txt index f80a03def..012c32b5e 100755 --- a/src/CAM/CMakeLists.txt +++ b/src/CAM/CMakeLists.txt @@ -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 diff --git a/src/DDS/CMakeLists.txt b/src/DDS/CMakeLists.txt index 58279d66b..2ece4237c 100755 --- a/src/DDS/CMakeLists.txt +++ b/src/DDS/CMakeLists.txt @@ -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}) - diff --git a/src/Event/CMakeLists.txt b/src/Event/CMakeLists.txt index 9da467339..8f753936e 100755 --- a/src/Event/CMakeLists.txt +++ b/src/Event/CMakeLists.txt @@ -19,6 +19,9 @@ # --- options --- +# additional include directories +INCLUDE_DIRECTORIES(${QT_INCLUDES}) + # additional preprocessor / compiler flags ADD_DEFINITIONS(${QT_DEFINITIONS}) diff --git a/src/GLViewer/CMakeLists.txt b/src/GLViewer/CMakeLists.txt index 2a67388ab..7cdc7825c 100755 --- a/src/GLViewer/CMakeLists.txt +++ b/src/GLViewer/CMakeLists.txt @@ -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}) diff --git a/src/GLViewer/GLViewer_BaseObjects.cxx b/src/GLViewer/GLViewer_BaseObjects.cxx index 3773bb873..bec5bf103 100644 --- a/src/GLViewer/GLViewer_BaseObjects.cxx +++ b/src/GLViewer/GLViewer_BaseObjects.cxx @@ -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& 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; diff --git a/src/GLViewer/GLViewer_Context.cxx b/src/GLViewer/GLViewer_Context.cxx index 319662239..60df04be0 100644 --- a/src/GLViewer/GLViewer_Context.cxx +++ b/src/GLViewer/GLViewer_Context.cxx @@ -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 ); } /*! diff --git a/src/GLViewer/GLViewer_Context.h b/src/GLViewer/GLViewer_Context.h index e3af9817e..df27941f4 100644 --- a/src/GLViewer/GLViewer_Context.h +++ b/src/GLViewer/GLViewer_Context.h @@ -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 ); diff --git a/src/GLViewer/GLViewer_Drawer.cxx b/src/GLViewer/GLViewer_Drawer.cxx index 7f5a6a0e1..d8bd48cd3 100644 --- a/src/GLViewer/GLViewer_Drawer.cxx +++ b/src/GLViewer/GLViewer_Drawer.cxx @@ -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; } diff --git a/src/GLViewer/GLViewer_Grid.cxx b/src/GLViewer/GLViewer_Grid.cxx index a0745880b..49eb22ec1 100644 --- a/src/GLViewer/GLViewer_Grid.cxx +++ b/src/GLViewer/GLViewer_Grid.cxx @@ -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; } diff --git a/src/GLViewer/GLViewer_ViewPort.cxx b/src/GLViewer/GLViewer_ViewPort.cxx index 9d9c8cbd8..7a528a576 100644 --- a/src/GLViewer/GLViewer_ViewPort.cxx +++ b/src/GLViewer/GLViewer_ViewPort.cxx @@ -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 ); diff --git a/src/GLViewer/GLViewer_ViewPort2d.cxx b/src/GLViewer/GLViewer_ViewPort2d.cxx index d9df43cc1..641760fa7 100644 --- a/src/GLViewer/GLViewer_ViewPort2d.cxx +++ b/src/GLViewer/GLViewer_ViewPort2d.cxx @@ -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; } diff --git a/src/GLViewer/GLViewer_Viewer.cxx b/src/GLViewer/GLViewer_Viewer.cxx index 483b086d3..a4667ba45 100644 --- a/src/GLViewer/GLViewer_Viewer.cxx +++ b/src/GLViewer/GLViewer_Viewer.cxx @@ -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 ); } } diff --git a/src/GLViewer/GLViewer_Viewer2d.cxx b/src/GLViewer/GLViewer_Viewer2d.cxx index 2c9958520..8fadd22e0 100644 --- a/src/GLViewer/GLViewer_Viewer2d.cxx +++ b/src/GLViewer/GLViewer_Viewer2d.cxx @@ -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 ); } diff --git a/src/GLViewer/GLViewer_Widget.cxx b/src/GLViewer/GLViewer_Widget.cxx index ac60a1f8d..cec19f953 100644 --- a/src/GLViewer/GLViewer_Widget.cxx +++ b/src/GLViewer/GLViewer_Widget.cxx @@ -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() ); } } diff --git a/src/GUI_PY/CMakeLists.txt b/src/GUI_PY/CMakeLists.txt index e0d3e5e4d..ff4ebe3bf 100755 --- a/src/GUI_PY/CMakeLists.txt +++ b/src/GUI_PY/CMakeLists.txt @@ -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 diff --git a/src/GraphicsView/CMakeLists.txt b/src/GraphicsView/CMakeLists.txt index 60d068ba3..feae6f3b4 100755 --- a/src/GraphicsView/CMakeLists.txt +++ b/src/GraphicsView/CMakeLists.txt @@ -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}) diff --git a/src/GraphicsView/GraphicsView_Object.cxx b/src/GraphicsView/GraphicsView_Object.cxx index 5bdaa0a12..a3d1b87a3 100644 --- a/src/GraphicsView/GraphicsView_Object.cxx +++ b/src/GraphicsView/GraphicsView_Object.cxx @@ -43,7 +43,7 @@ GraphicsView_Object::GraphicsView_Object( QGraphicsItem* theParent ) //======================================================================= GraphicsView_Object::~GraphicsView_Object() { - QListIterator aChildIter( children() ); + QListIterator aChildIter( childItems() ); while( aChildIter.hasNext() ) { if( QGraphicsItem* aChild = aChildIter.next() ) diff --git a/src/GuiHelpers/CMakeLists.txt b/src/GuiHelpers/CMakeLists.txt index 65db77ba3..d3c57b042 100755 --- a/src/GuiHelpers/CMakeLists.txt +++ b/src/GuiHelpers/CMakeLists.txt @@ -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 diff --git a/src/HelpBrowser/CMakeLists.txt b/src/HelpBrowser/CMakeLists.txt index 6de2ec6c3..f67b5814e 100644 --- a/src/HelpBrowser/CMakeLists.txt +++ b/src/HelpBrowser/CMakeLists.txt @@ -17,11 +17,13 @@ # 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 diff --git a/src/HelpBrowser/qtlocalpeer.cpp b/src/HelpBrowser/qtlocalpeer.cpp index 332b0643f..19914f458 100644 --- a/src/HelpBrowser/qtlocalpeer.cpp +++ b/src/HelpBrowser/qtlocalpeer.cpp @@ -42,6 +42,7 @@ #include "qtlocalpeer.h" #include #include +#include #if defined(Q_OS_WIN) #include diff --git a/src/ImageComposer/CMakeLists.txt b/src/ImageComposer/CMakeLists.txt index 587eef55f..534f6c250 100755 --- a/src/ImageComposer/CMakeLists.txt +++ b/src/ImageComposer/CMakeLists.txt @@ -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} diff --git a/src/LightApp/CMakeLists.txt b/src/LightApp/CMakeLists.txt index 9b39c65e8..04e309b4a 100755 --- a/src/LightApp/CMakeLists.txt +++ b/src/LightApp/CMakeLists.txt @@ -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}) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index dd1d585e0..c800af179 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -62,8 +62,10 @@ #include +#ifdef USE_SALOME_STYLE #include #include +#endif // USE_SALOME_STYLE #include #include @@ -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 tbMap, dwMap; dockWindowsState( visArr, tbMap, dwMap ); - QList tbList = qFindChildren( desktop() ); + QList tbList = desktop()->findChildren(); for ( QList::iterator it = tbList.begin(); it != tbList.end(); ++it ) { QToolBar* tb = *it; tbMap.insert( tb->objectName(), tb->toggleViewAction()->isChecked() ); } - QList dwList = qFindChildren( desktop() ); + QList dwList = desktop()->findChildren(); for ( QList::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 LightApp_Application::findToolBars( const QStringList& names ) { QList aResult; - QList tbList = qFindChildren( desktop() ); + QList tbList = desktop()->findChildren(); for ( QList::iterator tit = tbList.begin(); tit != tbList.end(); ++tit ) { QToolBar* tb = *tit; QObject* po = Qtx::findParent( tb, "QMainWindow" ); diff --git a/src/LightApp/LightApp_Dialog.cxx b/src/LightApp/LightApp_Dialog.cxx index 6e7e6f990..1cb736412 100644 --- a/src/LightApp/LightApp_Dialog.cxx +++ b/src/LightApp/LightApp_Dialog.cxx @@ -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 ); } diff --git a/src/LightApp/LightApp_Driver.cxx b/src/LightApp/LightApp_Driver.cxx index 87e2bf429..59b1af283 100644 --- a/src/LightApp/LightApp_Driver.cxx +++ b/src/LightApp/LightApp_Driver.cxx @@ -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(); diff --git a/src/LightApp/LightApp_ModuleAction.cxx b/src/LightApp/LightApp_ModuleAction.cxx index d0df209ec..74513caf9 100755 --- a/src/LightApp/LightApp_ModuleAction.cxx +++ b/src/LightApp/LightApp_ModuleAction.cxx @@ -146,7 +146,7 @@ QList LightApp_ModuleAction::ComboAction::widgets() const QList wlist = createdWidgets(); for ( QList::const_iterator wit = wlist.begin(); wit != wlist.end(); ++wit ) - lst += qFindChildren(*wit); + lst += (*wit)->findChildren(); return lst; } diff --git a/src/LightApp/LightApp_NameDlg.cxx b/src/LightApp/LightApp_NameDlg.cxx index ca50011cb..baec05353 100644 --- a/src/LightApp/LightApp_NameDlg.cxx +++ b/src/LightApp/LightApp_NameDlg.cxx @@ -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 ); /***************************************************************/ diff --git a/src/LogWindow/CMakeLists.txt b/src/LogWindow/CMakeLists.txt index 44e2599fb..44bae202d 100755 --- a/src/LogWindow/CMakeLists.txt +++ b/src/LogWindow/CMakeLists.txt @@ -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}") diff --git a/src/OBJECT/CMakeLists.txt b/src/OBJECT/CMakeLists.txt index e594ba3e1..b9ec2c5af 100755 --- a/src/OBJECT/CMakeLists.txt +++ b/src/OBJECT/CMakeLists.txt @@ -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 --- diff --git a/src/OCCViewer/CMakeLists.txt b/src/OCCViewer/CMakeLists.txt index 8c4159c85..43f31d92f 100755 --- a/src/OCCViewer/CMakeLists.txt +++ b/src/OCCViewer/CMakeLists.txt @@ -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}) diff --git a/src/OCCViewer/OCCViewer_ClippingDlg.cxx b/src/OCCViewer/OCCViewer_ClippingDlg.cxx index 37fc6c6d0..983b360c9 100644 --- a/src/OCCViewer/OCCViewer_ClippingDlg.cxx +++ b/src/OCCViewer/OCCViewer_ClippingDlg.cxx @@ -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 ); /***************************************************************/ diff --git a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx index fd110bd38..4e7000696 100755 --- a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx +++ b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx @@ -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 ); } } diff --git a/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx b/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx index 591f5de82..f34af8b9e 100644 --- a/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx +++ b/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx @@ -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())); diff --git a/src/OCCViewer/OCCViewer_SetRotationPointDlg.h b/src/OCCViewer/OCCViewer_SetRotationPointDlg.h index 242e9c878..5b1490b48 100644 --- a/src/OCCViewer/OCCViewer_SetRotationPointDlg.h +++ b/src/OCCViewer/OCCViewer_SetRotationPointDlg.h @@ -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; } diff --git a/src/OCCViewer/OCCViewer_Utilities.cxx b/src/OCCViewer/OCCViewer_Utilities.cxx index 18e9096bc..baa9cbaa6 100755 --- a/src/OCCViewer/OCCViewer_Utilities.cxx +++ b/src/OCCViewer/OCCViewer_Utilities.cxx @@ -141,7 +141,7 @@ bool OCCViewer_Utilities::isDialogOpened( OCCViewer_ViewWindow* theView, const Q { bool isFound = false; OCCViewer_ViewFrame* aViewFrame = dynamic_cast( theView->parent()->parent() ); - QList allDialogs = qFindChildren( aViewFrame ); + QList allDialogs = aViewFrame->findChildren(); foreach ( QDialog* d, allDialogs ) if ( d->objectName() == theName ) isFound = true; diff --git a/src/OCCViewer/OCCViewer_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx index fe2546853..9e16a3923 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ b/src/OCCViewer/OCCViewer_ViewModel.cxx @@ -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 lst = qFindChildren( aView ); + QList lst = aView->findChildren(); QList::const_iterator it = lst.begin(), last = lst.end(); for ( ; it!=last; it++ ) { if ( (*it)->parentWidget()->isVisible() ) diff --git a/src/OCCViewer/OCCViewer_ViewPort.cxx b/src/OCCViewer/OCCViewer_ViewPort.cxx index ceb5d22ee..7575a6a66 100755 --- a/src/OCCViewer/OCCViewer_ViewPort.cxx +++ b/src/OCCViewer/OCCViewer_ViewPort.cxx @@ -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 ); diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.cxx b/src/OCCViewer/OCCViewer_ViewPort3d.cxx index 5e927fbb3..c61d8eb0e 100755 --- a/src/OCCViewer/OCCViewer_ViewPort3d.cxx +++ b/src/OCCViewer/OCCViewer_ViewPort3d.cxx @@ -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(); } diff --git a/src/OCCViewer/OCCViewer_ViewSketcher.cxx b/src/OCCViewer/OCCViewer_ViewSketcher.cxx index 164f24a34..862399de9 100755 --- a/src/OCCViewer/OCCViewer_ViewSketcher.cxx +++ b/src/OCCViewer/OCCViewer_ViewSketcher.cxx @@ -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 ); } } diff --git a/src/ObjBrowser/CMakeLists.txt b/src/ObjBrowser/CMakeLists.txt index 0ecb41c75..dd40c3b2e 100644 --- a/src/ObjBrowser/CMakeLists.txt +++ b/src/ObjBrowser/CMakeLists.txt @@ -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}") diff --git a/src/PVViewer/CMakeLists.txt b/src/PVViewer/CMakeLists.txt index 1c28c7750..45f3b7439 100644 --- a/src/PVViewer/CMakeLists.txt +++ b/src/PVViewer/CMakeLists.txt @@ -17,11 +17,11 @@ # 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}) diff --git a/src/Plot2d/CMakeLists.txt b/src/Plot2d/CMakeLists.txt index e5cbb1f27..958e939d3 100755 --- a/src/Plot2d/CMakeLists.txt +++ b/src/Plot2d/CMakeLists.txt @@ -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}) diff --git a/src/Plot2d/Plot2d_FitDataDlg.cxx b/src/Plot2d/Plot2d_FitDataDlg.cxx index 7d33637b0..bced039fc 100755 --- a/src/Plot2d/Plot2d_FitDataDlg.cxx +++ b/src/Plot2d/Plot2d_FitDataDlg.cxx @@ -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 ); diff --git a/src/Plot2d/Plot2d_PlotItems.cxx b/src/Plot2d/Plot2d_PlotItems.cxx index 2bd990364..2d585c08c 100644 --- a/src/Plot2d/Plot2d_PlotItems.cxx +++ b/src/Plot2d/Plot2d_PlotItems.cxx @@ -33,6 +33,8 @@ #include #include #include +#include + #include #include #include @@ -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(); diff --git a/src/Plot2d/Plot2d_SetupViewDlg.cxx b/src/Plot2d/Plot2d_SetupViewDlg.cxx index a6bfb8708..4ef7b9364 100755 --- a/src/Plot2d/Plot2d_SetupViewDlg.cxx +++ b/src/Plot2d/Plot2d_SetupViewDlg.cxx @@ -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(); diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index db3e2acc5..efa7311c7 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -75,13 +75,11 @@ #include #include #include +#include +#include #include #include -#include - -#include -#include #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() ); diff --git a/src/PyConsole/CMakeLists.txt b/src/PyConsole/CMakeLists.txt index 36904dd3c..6dc393da5 100755 --- a/src/PyConsole/CMakeLists.txt +++ b/src/PyConsole/CMakeLists.txt @@ -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}") diff --git a/src/PyConsole/PyConsole_EnhEditor.cxx b/src/PyConsole/PyConsole_EnhEditor.cxx index 38cb69365..d4cf274a2 100644 --- a/src/PyConsole/PyConsole_EnhEditor.cxx +++ b/src/PyConsole/PyConsole_EnhEditor.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #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; diff --git a/src/PyConsole/PyConsole_EnhEditor.h b/src/PyConsole/PyConsole_EnhEditor.h index 8f8fc9cb9..f505066d3 100644 --- a/src/PyConsole/PyConsole_EnhEditor.h +++ b/src/PyConsole/PyConsole_EnhEditor.h @@ -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(); diff --git a/src/PyEditor/CMakeLists.txt b/src/PyEditor/CMakeLists.txt index 338c99da0..f5e7beb4f 100644 --- a/src/PyEditor/CMakeLists.txt +++ b/src/PyEditor/CMakeLists.txt @@ -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}") diff --git a/src/PyEditor/PyEditor_SettingsDlg.cxx b/src/PyEditor/PyEditor_SettingsDlg.cxx index 83f0e381e..247c02e7c 100644 --- a/src/PyEditor/PyEditor_SettingsDlg.cxx +++ b/src/PyEditor/PyEditor_SettingsDlg.cxx @@ -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(); diff --git a/src/PyInterp/CMakeLists.txt b/src/PyInterp/CMakeLists.txt index b55001ef6..07cef33db 100755 --- a/src/PyInterp/CMakeLists.txt +++ b/src/PyInterp/CMakeLists.txt @@ -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 diff --git a/src/PyViewer/CMakeLists.txt b/src/PyViewer/CMakeLists.txt index 2f9961782..0c6e5af2d 100644 --- a/src/PyViewer/CMakeLists.txt +++ b/src/PyViewer/CMakeLists.txt @@ -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}") diff --git a/src/PyViewer/PyViewer_ViewWindow.cxx b/src/PyViewer/PyViewer_ViewWindow.cxx index 3fcdb0f63..47a9a4582 100644 --- a/src/PyViewer/PyViewer_ViewWindow.cxx +++ b/src/PyViewer/PyViewer_ViewWindow.cxx @@ -35,6 +35,10 @@ #include #include +#include +#include +#include +#include /*! \class PyViewer_ViewWindow diff --git a/src/QDS/CMakeLists.txt b/src/QDS/CMakeLists.txt index fbe9e270b..1fa265cce 100755 --- a/src/QDS/CMakeLists.txt +++ b/src/QDS/CMakeLists.txt @@ -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}") diff --git a/src/QDS/QDS_Datum.cxx b/src/QDS/QDS_Datum.cxx index d8eadcad7..0b74d0d4b 100644 --- a/src/QDS/QDS_Datum.cxx +++ b/src/QDS/QDS_Datum.cxx @@ -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; } } diff --git a/src/Qtx/CMakeLists.txt b/src/Qtx/CMakeLists.txt index 32df69661..29697558d 100755 --- a/src/Qtx/CMakeLists.txt +++ b/src/Qtx/CMakeLists.txt @@ -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}") diff --git a/src/Qtx/Qtx.cxx b/src/Qtx/Qtx.cxx index 1a85d9853..f43ec8504 100755 --- a/src/Qtx/Qtx.cxx +++ b/src/Qtx/Qtx.cxx @@ -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++ ) diff --git a/src/Qtx/QtxAction.cxx b/src/Qtx/QtxAction.cxx index bca3d0538..4b449408e 100755 --- a/src/Qtx/QtxAction.cxx +++ b/src/Qtx/QtxAction.cxx @@ -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. */ diff --git a/src/Qtx/QtxAction.h b/src/Qtx/QtxAction.h index 23a3a686e..9f39d75d8 100755 --- a/src/Qtx/QtxAction.h +++ b/src/Qtx/QtxAction.h @@ -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* ); diff --git a/src/Qtx/QtxActionToolMgr.cxx b/src/Qtx/QtxActionToolMgr.cxx index c47ba73f8..c24a5820a 100644 --- a/src/Qtx/QtxActionToolMgr.cxx +++ b/src/Qtx/QtxActionToolMgr.cxx @@ -229,7 +229,7 @@ QToolBar* QtxActionToolMgr::find( const QString& title, QMainWindow* mw ) const QString pattern = title.toLower(); QToolBar* res = 0; - QList toolbars = qFindChildren( mw ); + QList toolbars = mw->findChildren( ); for ( QList::iterator it = toolbars.begin(); it != toolbars.end() && !res; ++it ) { if ( (*it)->windowTitle().toLower() == pattern ) diff --git a/src/Qtx/QtxColorButton.cxx b/src/Qtx/QtxColorButton.cxx index 8bb4769ad..de2fe97da 100644 --- a/src/Qtx/QtxColorButton.cxx +++ b/src/Qtx/QtxColorButton.cxx @@ -325,7 +325,7 @@ void QtxColorButton::paintEvent( QPaintEvent* e ) */ void QtxColorButton::updateState() { - QList bList = qFindChildren( menu() ); + QList bList = menu()->findChildren(); for ( QList::iterator cit = bList.begin(); cit != bList.end(); ++cit ) updateButton( *cit ); } diff --git a/src/Qtx/QtxDialog.cxx b/src/Qtx/QtxDialog.cxx index 37574e2d7..47a3a2867 100755 --- a/src/Qtx/QtxDialog.cxx +++ b/src/Qtx/QtxDialog.cxx @@ -1327,7 +1327,7 @@ void QtxDialog::keyPressEvent( QKeyEvent* e ) if ( e->key() == Qt::Key_Tab && e->modifiers() & Qt::ControlModifier ) { - QObject* tab = qFindChild( this ); + QObject* tab = this->findChild( ); 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; diff --git a/src/Qtx/QtxDockAction.cxx b/src/Qtx/QtxDockAction.cxx index c4e827f3b..9e741adaf 100755 --- a/src/Qtx/QtxDockAction.cxx +++ b/src/Qtx/QtxDockAction.cxx @@ -152,7 +152,7 @@ void QtxDockAction::toolBars( QList& lst ) const if ( !mw ) return; - QList toolbars = qFindChildren( mw ); + QList toolbars = mw->findChildren( ); for ( QList::iterator it = toolbars.begin(); it != toolbars.end(); ++it ) { QToolBar* tb = *it; @@ -173,7 +173,7 @@ void QtxDockAction::dockWidgets( QList& lst ) const if ( !mw ) return; - QList dockwidgets = qFindChildren( mw ); + QList dockwidgets = mw->findChildren( ); for ( QList::iterator it = dockwidgets.begin(); it != dockwidgets.end(); ++it ) { QDockWidget* dw = *it; diff --git a/src/Qtx/QtxFontEdit.cxx b/src/Qtx/QtxFontEdit.cxx index 2e23aec54..bc50f2994 100644 --- a/src/Qtx/QtxFontEdit.cxx +++ b/src/Qtx/QtxFontEdit.cxx @@ -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(); } diff --git a/src/Qtx/QtxLogoMgr.cxx b/src/Qtx/QtxLogoMgr.cxx index a8cecea95..d82d2db23 100644 --- a/src/Qtx/QtxLogoMgr.cxx +++ b/src/Qtx/QtxLogoMgr.cxx @@ -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 ) diff --git a/src/Qtx/QtxMainWindow.cxx b/src/Qtx/QtxMainWindow.cxx index f7af18db8..c71fec882 100644 --- a/src/Qtx/QtxMainWindow.cxx +++ b/src/Qtx/QtxMainWindow.cxx @@ -215,7 +215,7 @@ void QtxMainWindow::Resizer::setFilters( bool on ) myMain->layout()->removeEventFilter( this ); } - QTimer* t = qFindChild( myMain->layout() ); + QTimer* t = myMain->layout()->findChild( ); if ( t ) { if ( on ) t->installEventFilter( this ); diff --git a/src/Qtx/QtxPathDialog.cxx b/src/Qtx/QtxPathDialog.cxx index 0fefcd6bb..da7d3c29f 100755 --- a/src/Qtx/QtxPathDialog.cxx +++ b/src/Qtx/QtxPathDialog.cxx @@ -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; diff --git a/src/Qtx/QtxPathEdit.cxx b/src/Qtx/QtxPathEdit.cxx index 67b5dfa45..acc0120b8 100644 --- a/src/Qtx/QtxPathEdit.cxx +++ b/src/Qtx/QtxPathEdit.cxx @@ -211,7 +211,7 @@ void QtxPathEdit::onBrowse( bool /*on*/ ) } if ( !path.isEmpty() ) - myPath->setText( QDir::convertSeparators( path ) ); + myPath->setText( QDir::toNativeSeparators( path ) ); myPath->setFocus(); diff --git a/src/Qtx/QtxPopupMgr.cxx b/src/Qtx/QtxPopupMgr.cxx index 93371e022..e1f40d40d 100644 --- a/src/Qtx/QtxPopupMgr.cxx +++ b/src/Qtx/QtxPopupMgr.cxx @@ -26,8 +26,12 @@ #include "QtxPopupMgr.h" #include "QtxAction.h" #include "QtxEvalExpr.h" +#include #include +#include +#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& v1, const QList& v2 ) +{ + QList::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 diff --git a/src/Qtx/QtxPreferenceMgr.cxx b/src/Qtx/QtxPreferenceMgr.cxx index db5c0f9aa..bfdcc1d66 100644 --- a/src/Qtx/QtxPreferenceMgr.cxx +++ b/src/Qtx/QtxPreferenceMgr.cxx @@ -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; diff --git a/src/Qtx/QtxResourceMgr.cxx b/src/Qtx/QtxResourceMgr.cxx index 35f052e03..fbc7e44ab 100644 --- a/src/Qtx/QtxResourceMgr.cxx +++ b/src/Qtx/QtxResourceMgr.cxx @@ -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, QMapsetMargin( 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() ) ); diff --git a/src/Qtx/QtxTranslator.cxx b/src/Qtx/QtxTranslator.cxx index f1cf72fbe..bde67e78f 100644 --- a/src/Qtx/QtxTranslator.cxx +++ b/src/Qtx/QtxTranslator.cxx @@ -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) diff --git a/src/Qtx/QtxTranslator.h b/src/Qtx/QtxTranslator.h index cabd6af20..cbe7e0456 100644 --- a/src/Qtx/QtxTranslator.h +++ b/src/Qtx/QtxTranslator.h @@ -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 diff --git a/src/Qtx/QtxTreeView.cxx b/src/Qtx/QtxTreeView.cxx index 291292357..2709c362b 100644 --- a/src/Qtx/QtxTreeView.cxx +++ b/src/Qtx/QtxTreeView.cxx @@ -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( iconData ) ) - icon = qVariantValue( iconData ); - else if ( qVariantCanConvert( iconData ) ) - icon = qVariantValue( iconData ); +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + if ( iconData.canConvert( QVariant::Icon ) ) + icon = iconData.value(); + else if ( iconData.canConvert( QVariant::Pixmap ) ) + icon = iconData.value(); +#else + if ( iconData.canConvert( QMetaType::QIcon ) ) + icon = iconData.value(); + else if ( iconData.canConvert( QMetaType::QPixmap ) ) + icon = iconData.value(); +#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( 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 } /*! diff --git a/src/Qtx/QtxWorkspace.cxx b/src/Qtx/QtxWorkspace.cxx index c7af11e52..8739e529b 100644 --- a/src/Qtx/QtxWorkspace.cxx +++ b/src/Qtx/QtxWorkspace.cxx @@ -22,7 +22,7 @@ // #include "QtxWorkspace.h" -#include +#include /*! \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 winList = subWindowList(); if ( winList.isEmpty() ) return; int count = 0; - for ( QWidgetList::const_iterator itr = winList.begin(); itr != winList.end(); ++itr ) + for ( QList::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::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 winList = subWindowList(); if ( winList.isEmpty() ) return; int count = 0; - for ( QWidgetList::const_iterator itr = winList.begin(); itr != winList.end(); ++itr ) + for ( QList::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::iterator it = winList.begin(); it != winList.end(); ++it ) { QWidget* win = *it; if ( win->windowState() & Qt::WindowMinimized ) diff --git a/src/Qtx/QtxWorkspace.h b/src/Qtx/QtxWorkspace.h index 87c3b8ed8..58f72ecdd 100644 --- a/src/Qtx/QtxWorkspace.h +++ b/src/Qtx/QtxWorkspace.h @@ -25,13 +25,13 @@ #include "Qtx.h" -#include +#include #ifdef WIN32 #pragma warning( disable:4251 ) #endif -class QTX_EXPORT QtxWorkspace : public QWorkspace +class QTX_EXPORT QtxWorkspace : public QMdiArea { Q_OBJECT diff --git a/src/Qtx/QtxWorkspaceAction.cxx b/src/Qtx/QtxWorkspaceAction.cxx index 5bac837df..1818a6d68 100644 --- a/src/Qtx/QtxWorkspaceAction.cxx +++ b/src/Qtx/QtxWorkspaceAction.cxx @@ -28,7 +28,7 @@ #include "QtxWorkspace.h" #include -#include +#include /*! \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 winList = ws->subWindowList(); + for ( QList::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 wList = ws->subWindowList(); + for ( QList::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 wList = ws->subWindowList(); if ( idx >= 0 && idx < (int)wList.count() ) wList.at( idx )->setFocus(); } diff --git a/src/Qtx/QtxWorkstack.cxx b/src/Qtx/QtxWorkstack.cxx index 6721d6d8a..dd071fe5f 100644 --- a/src/Qtx/QtxWorkstack.cxx +++ b/src/Qtx/QtxWorkstack.cxx @@ -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 ); } } diff --git a/src/Qtx/QtxWorkstackAction.cxx b/src/Qtx/QtxWorkstackAction.cxx index 09bf5eeb1..ab2e4a61c 100644 --- a/src/Qtx/QtxWorkstackAction.cxx +++ b/src/Qtx/QtxWorkstackAction.cxx @@ -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 ); diff --git a/src/QxScene/CMakeLists.txt b/src/QxScene/CMakeLists.txt index f6ad5530f..a8398a7bc 100755 --- a/src/QxScene/CMakeLists.txt +++ b/src/QxScene/CMakeLists.txt @@ -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}) diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/CMakeLists.txt b/src/SALOME_PYQT/SALOME_PYQT_GUI/CMakeLists.txt index ca6a50173..f68c10539 100755 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/CMakeLists.txt +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/CMakeLists.txt @@ -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) diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUILight/CMakeLists.txt b/src/SALOME_PYQT/SALOME_PYQT_GUILight/CMakeLists.txt index 705323f50..183a186b3 100755 --- a/src/SALOME_PYQT/SALOME_PYQT_GUILight/CMakeLists.txt +++ b/src/SALOME_PYQT/SALOME_PYQT_GUILight/CMakeLists.txt @@ -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 diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_GUILight.sip b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_GUILight.sip index 6cd8e5dd5..1601b48f9 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_GUILight.sip +++ b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_GUILight.sip @@ -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 diff --git a/src/SALOME_PYQT/SalomePyQt/CMakeLists.txt b/src/SALOME_PYQT/SalomePyQt/CMakeLists.txt index e77ddf6ae..bba191dd1 100755 --- a/src/SALOME_PYQT/SalomePyQt/CMakeLists.txt +++ b/src/SALOME_PYQT/SalomePyQt/CMakeLists.txt @@ -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) diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx index 42e812425..609aaf77c 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx @@ -120,7 +120,7 @@ namespace PyModuleHelper* getPythonHelper() { LightApp_Module* module = getActiveModule(); - PyModuleHelper* helper = module ? qFindChild( module, "python_module_helper" ) : 0; + PyModuleHelper* helper = module ? module->findChild( "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( module, "python_module_helper" ); + PyModuleHelper* helper = module->findChild( "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 lst = qFindChildren( wnd, "Viewport" ); + QList lst = wnd->findChildren( "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; diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip index 0c32162b1..0ab24632c 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip @@ -28,7 +28,11 @@ %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) diff --git a/src/SOCC/CMakeLists.txt b/src/SOCC/CMakeLists.txt index e68bc32b8..2ca53c708 100755 --- a/src/SOCC/CMakeLists.txt +++ b/src/SOCC/CMakeLists.txt @@ -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 diff --git a/src/SPlot2d/CMakeLists.txt b/src/SPlot2d/CMakeLists.txt index cc3c6f753..aa28f0996 100755 --- a/src/SPlot2d/CMakeLists.txt +++ b/src/SPlot2d/CMakeLists.txt @@ -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 diff --git a/src/STD/CMakeLists.txt b/src/STD/CMakeLists.txt index 4531c7792..ef51dc038 100755 --- a/src/STD/CMakeLists.txt +++ b/src/STD/CMakeLists.txt @@ -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}) diff --git a/src/STD/STD_MDIDesktop.cxx b/src/STD/STD_MDIDesktop.cxx index 9ec6f70ca..3feae0641 100755 --- a/src/STD/STD_MDIDesktop.cxx +++ b/src/STD/STD_MDIDesktop.cxx @@ -32,6 +32,7 @@ #include #include +#include #include @@ -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( myWorkspace->activeSubWindow()->widget() ); } /*! @@ -87,10 +82,10 @@ QList STD_MDIDesktop::windows() const { QList winList; - QWidgetList children = myWorkspace->windowList(); - for ( QWidgetList::iterator it = children.begin(); it != children.end(); ++it ) + QList children = myWorkspace->subWindowList(); + for ( QList::iterator it = children.begin(); it != children.end(); ++it ) { - SUIT_ViewWindow* vw = ::qobject_cast( *it ); + SUIT_ViewWindow* vw = ::qobject_cast( (*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.*/ diff --git a/src/SUIT/CMakeLists.txt b/src/SUIT/CMakeLists.txt index 4fb3b4e49..210626d92 100644 --- a/src/SUIT/CMakeLists.txt +++ b/src/SUIT/CMakeLists.txt @@ -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}) diff --git a/src/SUIT/SUIT_ActionOperation.cxx b/src/SUIT/SUIT_ActionOperation.cxx index 62c565315..cf3a9e964 100644 --- a/src/SUIT/SUIT_ActionOperation.cxx +++ b/src/SUIT/SUIT_ActionOperation.cxx @@ -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 ) ); } diff --git a/src/SUIT/SUIT_Application.cxx b/src/SUIT/SUIT_Application.cxx index 811be3e9a..e978085bb 100755 --- a/src/SUIT/SUIT_Application.cxx +++ b/src/SUIT/SUIT_Application.cxx @@ -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 ); diff --git a/src/SUIT/SUIT_Application.h b/src/SUIT/SUIT_Application.h index 542b160bb..1d80b8d0a 100755 --- a/src/SUIT/SUIT_Application.h +++ b/src/SUIT/SUIT_Application.h @@ -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(); diff --git a/src/SUIT/SUIT_DataBrowser.cxx b/src/SUIT/SUIT_DataBrowser.cxx index f2b6949bc..af75627ca 100644 --- a/src/SUIT/SUIT_DataBrowser.cxx +++ b/src/SUIT/SUIT_DataBrowser.cxx @@ -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]; } /*! diff --git a/src/SUIT/SUIT_Desktop.cxx b/src/SUIT/SUIT_Desktop.cxx index 96bc10f3d..f3cf4039d 100755 --- a/src/SUIT/SUIT_Desktop.cxx +++ b/src/SUIT/SUIT_Desktop.cxx @@ -127,7 +127,7 @@ void SUIT_Desktop::customEvent( QEvent* e ) wid->testAttribute( Qt::WA_WState_Hidden ); addWindow( wid ); - wid->setShown( !invis ); + wid->setVisible( !invis ); } } diff --git a/src/SUIT/SUIT_FileDlg.cxx b/src/SUIT/SUIT_FileDlg.cxx index 20a4ac493..51eaf1b78 100755 --- a/src/SUIT/SUIT_FileDlg.cxx +++ b/src/SUIT/SUIT_FileDlg.cxx @@ -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 ); diff --git a/src/SUIT/SUIT_ResourceMgr.cxx b/src/SUIT/SUIT_ResourceMgr.cxx index 88942671e..86dbf2959 100755 --- a/src/SUIT/SUIT_ResourceMgr.cxx +++ b/src/SUIT/SUIT_ResourceMgr.cxx @@ -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(); diff --git a/src/SUIT/SUIT_TreeModel.cxx b/src/SUIT/SUIT_TreeModel.cxx index d2a8a655b..491fcdcd6 100755 --- a/src/SUIT/SUIT_TreeModel.cxx +++ b/src/SUIT/SUIT_TreeModel.cxx @@ -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= 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(); } diff --git a/src/SUIT/SUIT_ViewManager.cxx b/src/SUIT/SUIT_ViewManager.cxx index fc2ebf2d9..0aaf64573 100755 --- a/src/SUIT/SUIT_ViewManager.cxx +++ b/src/SUIT/SUIT_ViewManager.cxx @@ -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.*/ diff --git a/src/SUIT/SUIT_ViewWindow.cxx b/src/SUIT/SUIT_ViewWindow.cxx index 9edcf4c23..eed1244fd 100755 --- a/src/SUIT/SUIT_ViewWindow.cxx +++ b/src/SUIT/SUIT_ViewWindow.cxx @@ -403,7 +403,7 @@ void SUIT_ViewWindow::updateSyncViews() SUIT_Application* app = SUIT_Session::session()->activeApplication(); if ( app ) { SUIT_Desktop* d = app->desktop(); - QList allViews = qFindChildren( d ); + QList allViews = d->findChildren(); 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 allViews = qFindChildren( d ); + QList allViews = d->findChildren(); foreach( SUIT_ViewWindow* vw, allViews ) { if ( !vw->cameraProperties().isValid() ) continue; // omit views not supporting camera properties diff --git a/src/SUITApp/CMakeLists.txt b/src/SUITApp/CMakeLists.txt index 677edbfd3..4da028a4c 100755 --- a/src/SUITApp/CMakeLists.txt +++ b/src/SUITApp/CMakeLists.txt @@ -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}") diff --git a/src/SUITApp/SUITApp.cxx b/src/SUITApp/SUITApp.cxx index 0feb3e385..45da4a120 100644 --- a/src/SUITApp/SUITApp.cxx +++ b/src/SUITApp/SUITApp.cxx @@ -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 @@ -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() ); diff --git a/src/SUITApp/SUITApp_Application.cxx b/src/SUITApp/SUITApp_Application.cxx index 9850d927e..7864c19d5 100644 --- a/src/SUITApp/SUITApp_Application.cxx +++ b/src/SUITApp/SUITApp_Application.cxx @@ -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 diff --git a/src/SUITApp/SUITApp_Application.h b/src/SUITApp/SUITApp_Application.h index 43266c29d..ec2f94330 100644 --- a/src/SUITApp/SUITApp_Application.h +++ b/src/SUITApp/SUITApp_Application.h @@ -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; diff --git a/src/SVTK/CMakeLists.txt b/src/SVTK/CMakeLists.txt index 53a802ae3..d2a4072e9 100755 --- a/src/SVTK/CMakeLists.txt +++ b/src/SVTK/CMakeLists.txt @@ -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 diff --git a/src/SVTK/SVTK_ComboAction.cxx b/src/SVTK/SVTK_ComboAction.cxx index 1403de1da..865469493 100644 --- a/src/SVTK/SVTK_ComboAction.cxx +++ b/src/SVTK/SVTK_ComboAction.cxx @@ -99,7 +99,7 @@ void SVTK_ComboAction::update() { QList aList = createdWidgets(); for ( QList::const_iterator it = aList.begin(); it != aList.end(); ++it ) - updateCombo( qFindChild(*it) ); + updateCombo( (*it)->findChild() ); } void SVTK_ComboAction::updateCombo( QComboBox* combo ) diff --git a/src/SVTK/SVTK_GenericRenderWindowInteractor.cxx b/src/SVTK/SVTK_GenericRenderWindowInteractor.cxx index 196e55a4c..75e2a6ef4 100644 --- a/src/SVTK/SVTK_GenericRenderWindowInteractor.cxx +++ b/src/SVTK/SVTK_GenericRenderWindowInteractor.cxx @@ -76,7 +76,7 @@ QVTK_GenericRenderWindowInteractor // Start a one-shot timer for ms. // static int DELAY = 1; - myTimer->setSingleShot(TRUE); + myTimer->setSingleShot(true); myTimer->start(DELAY); return 1; } diff --git a/src/SVTK/SVTK_NonIsometricDlg.cxx b/src/SVTK/SVTK_NonIsometricDlg.cxx index 009ba0c08..a07a76bc1 100644 --- a/src/SVTK/SVTK_NonIsometricDlg.cxx +++ b/src/SVTK/SVTK_NonIsometricDlg.cxx @@ -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 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 button QPushButton* m_bApply = new QPushButton(tr("&Apply"), aGroupBox2); m_bApply->setObjectName("m_bApply"); - m_bApply->setAutoDefault(TRUE); + m_bApply->setAutoDefault(true); // Create 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); diff --git a/src/SVTK/SVTK_RenderWindowInteractor.cxx b/src/SVTK/SVTK_RenderWindowInteractor.cxx index ac07e118c..55e3b3cb9 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.cxx +++ b/src/SVTK/SVTK_RenderWindowInteractor.cxx @@ -35,7 +35,10 @@ // Put Qt includes before the X11 includes which #define the symbol None // (see SVTK_SpaceMouse.h) to avoid the compilation error. #ifndef WIN32 -# include +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#include +#endif +#include #endif #include @@ -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(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 */ diff --git a/src/SVTK/SVTK_RenderWindowInteractor.h b/src/SVTK/SVTK_RenderWindowInteractor.h index b66ca9d4a..5d3382803 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.h +++ b/src/SVTK/SVTK_RenderWindowInteractor.h @@ -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 myRenderWindow; vtkSmartPointer myDevice; }; diff --git a/src/SVTK/SVTK_SetRotationPointDlg.cxx b/src/SVTK/SVTK_SetRotationPointDlg.cxx index d8705969b..f88de7fad 100755 --- a/src/SVTK/SVTK_SetRotationPointDlg.cxx +++ b/src/SVTK/SVTK_SetRotationPointDlg.cxx @@ -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())); diff --git a/src/SVTK/SVTK_SpaceMouse.cxx b/src/SVTK/SVTK_SpaceMouse.cxx index 5943ef6aa..2990db6d9 100644 --- a/src/SVTK/SVTK_SpaceMouse.cxx +++ b/src/SVTK/SVTK_SpaceMouse.cxx @@ -28,65 +28,59 @@ #include #include +#include + #ifndef WIN32 #include -#include #include #include #include +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#include +#else +#include +#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 diff --git a/src/SVTK/SVTK_SpaceMouse.h b/src/SVTK/SVTK_SpaceMouse.h index caa559432..733b826a1 100644 --- a/src/SVTK/SVTK_SpaceMouse.h +++ b/src/SVTK/SVTK_SpaceMouse.h @@ -27,21 +27,25 @@ #ifndef SVTK_SpaceMouse_h #define SVTK_SpaceMouse_h +#include + #ifndef WIN32 extern "C" { #include +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #include +#else +#include +#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 diff --git a/src/SVTK/SVTK_UpdateRateDlg.cxx b/src/SVTK/SVTK_UpdateRateDlg.cxx index 15a8d0a24..80ad0e440 100644 --- a/src/SVTK/SVTK_UpdateRateDlg.cxx +++ b/src/SVTK/SVTK_UpdateRateDlg.cxx @@ -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())); } diff --git a/src/SVTK/SVTK_ViewModel.cxx b/src/SVTK/SVTK_ViewModel.cxx index eb3a754e9..7f1be4798 100644 --- a/src/SVTK/SVTK_ViewModel.cxx +++ b/src/SVTK/SVTK_ViewModel.cxx @@ -565,7 +565,7 @@ void SVTK_Viewer::contextMenuPopup( QMenu* thePopup ) if(TViewWindow* aView = dynamic_cast(myViewManager->getActiveView())){ //Support of several toolbars in the popup menu - QList lst = qFindChildren( aView ); + QList lst = aView->findChildren(); QList::const_iterator it = lst.begin(), last = lst.end(); for( ; it!=last; it++ ) thePopup->addAction( (*it)->toggleViewAction() ); diff --git a/src/SVTK/SVTK_ViewParameterDlg.cxx b/src/SVTK/SVTK_ViewParameterDlg.cxx index 6db03e854..eb1d0d6aa 100755 --- a/src/SVTK/SVTK_ViewParameterDlg.cxx +++ b/src/SVTK/SVTK_ViewParameterDlg.cxx @@ -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())); diff --git a/src/SalomeApp/CMakeLists.txt b/src/SalomeApp/CMakeLists.txt index 5335fa4d8..8c29843b4 100755 --- a/src/SalomeApp/CMakeLists.txt +++ b/src/SalomeApp/CMakeLists.txt @@ -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}) diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 11d041cb7..ef1cddd2a 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -84,6 +84,7 @@ #include #include +#include #include #include #include @@ -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_::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 args1(argc); + char** argv = new char*[argc]; + for ( int i = 0; i < argc; ++i ) { + args1[i] = args[i].toStdString(); + argv[i] = const_cast( args1[i].c_str() ); + } + + ORB_INIT& init = *SINGLETON_::Instance(); + _orb = init( argc, argv ); + + delete [] argv; + } + return _orb; } diff --git a/src/SalomeApp/SalomeApp_Engine_i.cxx b/src/SalomeApp/SalomeApp_Engine_i.cxx index 9b58f1e36..b26a8424c 100644 --- a/src/SalomeApp/SalomeApp_Engine_i.cxx +++ b/src/SalomeApp/SalomeApp_Engine_i.cxx @@ -302,10 +302,24 @@ char* SalomeApp_Engine_i::getVersion() */ CORBA::ORB_var SalomeApp_Engine_i::orb() { - ORB_INIT& init = *SINGLETON_::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 args1(argc); + char** argv = new char*[argc]; + for ( int i = 0; i < argc; ++i ) { + args1[i] = args[i].toStdString(); + argv[i] = const_cast( args1[i].c_str() ); + } + + ORB_INIT& init = *SINGLETON_::Instance(); + _orb = init( argc, argv ); + + delete [] argv; + } + return _orb; } diff --git a/src/SalomeApp/SalomeApp_ListView.cxx b/src/SalomeApp/SalomeApp_ListView.cxx index 95e970b41..4ba39a4ef 100644 --- a/src/SalomeApp/SalomeApp_ListView.cxx +++ b/src/SalomeApp/SalomeApp_ListView.cxx @@ -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; diff --git a/src/SalomeApp/SalomeApp_StudyPropertiesDlg.cxx b/src/SalomeApp/SalomeApp_StudyPropertiesDlg.cxx index 1e2f82524..801faa612 100644 --- a/src/SalomeApp/SalomeApp_StudyPropertiesDlg.cxx +++ b/src/SalomeApp/SalomeApp_StudyPropertiesDlg.cxx @@ -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 ); diff --git a/src/SalomeApp/pluginsdemo/CMakeLists.txt b/src/SalomeApp/pluginsdemo/CMakeLists.txt index 35f8784a6..f8ec9d6fb 100755 --- a/src/SalomeApp/pluginsdemo/CMakeLists.txt +++ b/src/SalomeApp/pluginsdemo/CMakeLists.txt @@ -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 diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index 7e1fbe5f4..aa050e373 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -52,7 +52,9 @@ #include #include +#ifdef USE_SALOME_STYLE #include +#endif // USE_SALOME_STYLE #include "GUI_version.h" #include @@ -97,19 +99,22 @@ * - 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 /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 diff --git a/src/Session/Session_ServerCheck.cxx b/src/Session/Session_ServerCheck.cxx index 2789e23a8..3cb7fa8a5 100644 --- a/src/Session/Session_ServerCheck.cxx +++ b/src/Session/Session_ServerCheck.cxx @@ -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 args1(argc); + char** argv = new char*[argc]; + for ( int i = 0; i < argc; ++i ) { + args1[i] = args[i].toStdString(); + argv[i] = const_cast( 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_::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; } diff --git a/src/Session/Session_Session_i.cxx b/src/Session/Session_Session_i.cxx index 663700542..005b5eea8 100755 --- a/src/Session/Session_Session_i.cxx +++ b/src/Session/Session_Session_i.cxx @@ -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) ; diff --git a/src/Style/CMakeLists.txt b/src/Style/CMakeLists.txt index 9d48f307b..71056d6a6 100755 --- a/src/Style/CMakeLists.txt +++ b/src/Style/CMakeLists.txt @@ -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}) diff --git a/src/Style/Style_Salome.cxx b/src/Style/Style_Salome.cxx index d49af67d2..bf355581a 100644 --- a/src/Style/Style_Salome.cxx +++ b/src/Style/Style_Salome.cxx @@ -59,8 +59,7 @@ #include #include #include - -#include +#include #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(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((QWidget*)w) ) @@ -1845,7 +1931,11 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt, = qstyleoption_cast(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(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(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( opt ), SC_ComboBoxArrow, wid ); +#else + QRect old_r = QCommonStyle::subControlRect( CC_ComboBox, + qstyleoption_cast( opt ), + SC_ComboBoxArrow, wid ); +#endif int old_w = old_r.width(); res.setWidth( w-h+old_w-2 ); break; diff --git a/src/Style/Style_Salome.h b/src/Style/Style_Salome.h index e81b5bffc..47eb21dfb 100644 --- a/src/Style/Style_Salome.h +++ b/src/Style/Style_Salome.h @@ -24,9 +24,12 @@ #define STYLE_SALOME_H #include "Style.h" - +#include +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #include - +#else +#include +#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 diff --git a/src/TOOLSGUI/CMakeLists.txt b/src/TOOLSGUI/CMakeLists.txt index 9fc4d0c5a..db9f680ed 100755 --- a/src/TOOLSGUI/CMakeLists.txt +++ b/src/TOOLSGUI/CMakeLists.txt @@ -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 diff --git a/src/TreeData/CMakeLists.txt b/src/TreeData/CMakeLists.txt index de23090b3..ab243b708 100755 --- a/src/TreeData/CMakeLists.txt +++ b/src/TreeData/CMakeLists.txt @@ -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 diff --git a/src/TreeData/Test/CMakeLists.txt b/src/TreeData/Test/CMakeLists.txt index cb05061e5..601121227 100755 --- a/src/TreeData/Test/CMakeLists.txt +++ b/src/TreeData/Test/CMakeLists.txt @@ -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}) diff --git a/src/TreeData/Test/mainwindow.cxx b/src/TreeData/Test/mainwindow.cxx index 904d80b95..51dab073e 100644 --- a/src/TreeData/Test/mainwindow.cxx +++ b/src/TreeData/Test/mainwindow.cxx @@ -18,6 +18,7 @@ // #include +#include #include "mainwindow.hxx" #include "TreeModel.hxx" diff --git a/src/VTKViewer/CMakeLists.txt b/src/VTKViewer/CMakeLists.txt index 8833cb027..35f45a6d8 100755 --- a/src/VTKViewer/CMakeLists.txt +++ b/src/VTKViewer/CMakeLists.txt @@ -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}) - - - diff --git a/src/VTKViewer/VTKViewer_RenderWindow.cxx b/src/VTKViewer/VTKViewer_RenderWindow.cxx index d4dd5f76e..611346f4d 100755 --- a/src/VTKViewer/VTKViewer_RenderWindow.cxx +++ b/src/VTKViewer/VTKViewer_RenderWindow.cxx @@ -34,9 +34,6 @@ #ifndef WIN32 #include #include -//#include -//#include -//#include #endif /*!Constructor. Create render window with parant \a parent and name \a name. diff --git a/src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx b/src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx index 8abd0fa01..6179c1679 100755 --- a/src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx +++ b/src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx @@ -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 ; } diff --git a/src/ViewerTools/CMakeLists.txt b/src/ViewerTools/CMakeLists.txt index b00ceb159..3559088e8 100755 --- a/src/ViewerTools/CMakeLists.txt +++ b/src/ViewerTools/CMakeLists.txt @@ -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}") diff --git a/src/ViewerTools/ViewerTools_DialogBase.h b/src/ViewerTools/ViewerTools_DialogBase.h index 0aafe72d7..b36e4366b 100644 --- a/src/ViewerTools/ViewerTools_DialogBase.h +++ b/src/ViewerTools/ViewerTools_DialogBase.h @@ -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(); diff --git a/tools/dlgfactory/CMakeLists.txt b/tools/dlgfactory/CMakeLists.txt index 3c80f81a4..0ef5b54db 100755 --- a/tools/dlgfactory/CMakeLists.txt +++ b/tools/dlgfactory/CMakeLists.txt @@ -16,13 +16,13 @@ # # 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} -- 2.39.2