From d7a5d82ac52e1382d892aa386ba330b81cc751db Mon Sep 17 00:00:00 2001 From: imn Date: Thu, 12 Nov 2015 17:13:55 +0300 Subject: [PATCH] Migrate to Qt 5 --- CMakeLists.txt | 49 +++++--- SalomeGUIConfig.cmake.in | 4 +- adm_local/cmake_files/CMakeLists.txt | 7 +- adm_local/cmake_files/FindPyQt5.cmake | 116 ++++++++++++++++++ adm_local/cmake_files/FindSalomePyQt5.cmake | 37 ++++++ adm_local/cmake_files/FindSalomeQt5.cmake | 68 ++++++++++ .../{UsePyQt4.cmake => UsePyQt.cmake} | 52 ++++---- .../{UseQt4Ext.cmake => UseQtExt.cmake} | 10 +- src/CAF/CAF_Study.cxx | 4 +- src/CAF/CMakeLists.txt | 28 +++-- src/CAM/CMakeLists.txt | 26 ++-- src/DDS/CMakeLists.txt | 3 +- src/Event/CMakeLists.txt | 12 +- src/GLViewer/CMakeLists.txt | 29 +++-- src/GLViewer/GLViewer_BaseObjects.cxx | 32 ++--- src/GLViewer/GLViewer_Context.cxx | 28 ++--- src/GLViewer/GLViewer_Context.h | 6 +- src/GLViewer/GLViewer_Drawer.cxx | 27 ++-- src/GLViewer/GLViewer_Grid.cxx | 4 +- src/GLViewer/GLViewer_ViewPort.cxx | 6 +- src/GLViewer/GLViewer_ViewPort2d.cxx | 6 +- src/GLViewer/GLViewer_Viewer.cxx | 2 +- src/GLViewer/GLViewer_Viewer2d.cxx | 14 +-- src/GLViewer/GLViewer_Widget.cxx | 2 +- src/GUI_PY/CMakeLists.txt | 6 +- src/GUI_PY/dockwidgets.py | 4 +- src/GUI_PY/genericdialog.py | 6 +- src/GUI_PY/mytestdialog.py | 10 +- src/GUI_PY/selectvars.py | 4 +- src/GraphicsView/CMakeLists.txt | 26 ++-- src/GraphicsView/GraphicsView_Object.cxx | 14 +-- src/GuiHelpers/CMakeLists.txt | 17 ++- src/HelpBrowser/CMakeLists.txt | 34 +++-- src/HelpBrowser/qtlocalpeer.cpp | 1 + src/ImageComposer/CMakeLists.txt | 16 ++- src/LightApp/CMakeLists.txt | 36 ++++-- src/LightApp/LightApp_Application.cxx | 8 +- 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 | 26 ++-- src/OBJECT/CMakeLists.txt | 11 +- src/OCCViewer/CMakeLists.txt | 37 ++++-- src/OCCViewer/OCCViewer_ClippingDlg.cxx | 12 +- .../OCCViewer_CreateRestoreViewDlg.cxx | 4 +- .../OCCViewer_SetRotationPointDlg.cxx | 4 +- src/OCCViewer/OCCViewer_SetRotationPointDlg.h | 2 +- src/OCCViewer/OCCViewer_ViewModel.cxx | 2 +- src/OCCViewer/OCCViewer_ViewPort.cxx | 6 +- src/OCCViewer/OCCViewer_ViewPort3d.cxx | 4 +- src/OCCViewer/OCCViewer_ViewSketcher.cxx | 4 +- src/ObjBrowser/CMakeLists.txt | 26 ++-- src/PVViewer/CMakeLists.txt | 21 ++-- src/Plot2d/CMakeLists.txt | 26 ++-- src/Plot2d/Plot2d_FitDataDlg.cxx | 8 +- src/Plot2d/Plot2d_PlotItems.cxx | 8 +- src/Plot2d/Plot2d_SetupViewDlg.cxx | 10 +- src/Plot2d/Plot2d_ViewFrame.cxx | 8 +- src/Plot2d/Plot2d_ViewWindow.cxx | 4 +- src/PyConsole/CMakeLists.txt | 26 ++-- src/PyConsole/PyConsole_EnhEditor.cxx | 3 +- src/PyConsole/PyConsole_EnhEditor.h | 2 +- src/PyEditor/CMakeLists.txt | 26 ++-- src/PyEditor/PyEditor_SettingsDlg.cxx | 8 +- src/PyInterp/CMakeLists.txt | 23 +++- src/PyViewer/CMakeLists.txt | 36 ++++-- src/PyViewer/PyViewer_ViewWindow.cxx | 13 +- src/QDS/CMakeLists.txt | 26 ++-- src/QDS/QDS_Datum.cxx | 2 +- src/Qtx/CMakeLists.txt | 36 ++++-- src/Qtx/Qtx.cxx | 6 +- src/Qtx/QtxActionMenuMgr.cxx | 2 +- src/Qtx/QtxActionMgr.cxx | 4 +- src/Qtx/QtxActionToolMgr.cxx | 4 +- src/Qtx/QtxColorButton.cxx | 2 +- src/Qtx/QtxDialog.cxx | 3 +- 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 | 7 +- src/Qtx/QtxPreferenceMgr.cxx | 2 +- src/Qtx/QtxResourceMgr.cxx | 14 +-- src/Qtx/QtxSearchTool.cxx | 10 +- src/Qtx/QtxTranslator.cxx | 6 +- src/Qtx/QtxTranslator.h | 2 +- src/Qtx/QtxTreeView.cxx | 14 +-- src/Qtx/QtxWebBrowser.cxx | 2 +- src/Qtx/QtxWorkspace.cxx | 24 ++-- src/Qtx/QtxWorkspace.h | 4 +- src/Qtx/QtxWorkspaceAction.cxx | 22 ++-- src/Qtx/QtxWorkstack.cxx | 4 +- src/Qtx/QtxWorkstackAction.cxx | 6 +- src/QxScene/CMakeLists.txt | 26 ++-- src/ResExporter/CMakeLists.txt | 15 ++- src/SALOME_PY/CMakeLists.txt | 15 ++- .../SALOME_PYQT_GUI/CMakeLists.txt | 17 ++- .../SALOME_PYQT_GUILight/CMakeLists.txt | 21 +++- .../SALOME_PYQT_GUILight.sip | 4 +- .../SALOME_PYQT_PyModule.cxx | 6 +- src/SALOME_PYQT/SalomePyQt/CMakeLists.txt | 21 +++- src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx | 8 +- src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip | 4 +- src/SALOME_SWIG/CMakeLists.txt | 11 +- src/SOCC/CMakeLists.txt | 23 +++- src/SPlot2d/CMakeLists.txt | 23 +++- src/STD/CMakeLists.txt | 26 ++-- src/STD/STD_MDIDesktop.cxx | 10 +- src/SUIT/CMakeLists.txt | 26 ++-- src/SUIT/SUIT_ActionOperation.cxx | 4 +- src/SUIT/SUIT_DataBrowser.cxx | 2 +- src/SUIT/SUIT_Desktop.cxx | 2 +- src/SUIT/SUIT_FileDlg.cxx | 22 ++-- src/SUIT/SUIT_LicenseDlg.cxx | 2 +- src/SUIT/SUIT_ResourceMgr.cxx | 2 +- src/SUIT/SUIT_TreeModel.cxx | 6 +- src/SUIT/SUIT_ViewManager.cxx | 2 +- src/SUIT/SUIT_ViewWindow.cxx | 4 +- src/SUITApp/CMakeLists.txt | 26 ++-- src/SUITApp/SUITApp.cxx | 4 +- src/SUITApp/SUITApp_Application.cxx | 12 +- src/SUITApp/SUITApp_Application.h | 2 +- src/SVTK/CMakeLists.txt | 30 +++-- src/SVTK/SVTK_ComboAction.cxx | 2 +- .../SVTK_GenericRenderWindowInteractor.cxx | 2 +- src/SVTK/SVTK_NonIsometricDlg.cxx | 10 +- src/SVTK/SVTK_RenderWindowInteractor.cxx | 11 +- src/SVTK/SVTK_RenderWindowInteractor.h | 5 +- src/SVTK/SVTK_SetRotationPointDlg.cxx | 4 +- src/SVTK/SVTK_UpdateRateDlg.cxx | 16 +-- src/SVTK/SVTK_ViewModel.cxx | 2 +- src/SVTK/SVTK_ViewParameterDlg.cxx | 4 +- src/SalomeApp/CMakeLists.txt | 16 ++- src/SalomeApp/SalomeApp_Application.cxx | 17 ++- src/SalomeApp/SalomeApp_Engine_i.cxx | 8 +- src/SalomeApp/SalomeApp_ListView.cxx | 2 +- .../SalomeApp_StudyPropertiesDlg.cxx | 2 +- src/SalomeApp/pluginsdemo/CMakeLists.txt | 2 +- src/SalomeApp/pluginsdemo/minmax_dialog.py | 4 +- src/SalomeApp/pluginsdemo/minmax_plugin.py | 8 +- src/SalomeApp/pluginsdemo/tubedialog.py | 4 +- src/SalomeApp/pluginsdemo/tubedialog_ui.py | 4 +- src/SalomeApp/salome_pluginsmanager.py | 6 +- src/Session/CMakeLists.txt | 15 ++- src/Session/SALOME_Session_Server.cxx | 22 ++-- src/Session/Session_ServerCheck.cxx | 8 +- src/Session/Session_Session_i.cxx | 2 +- src/Style/CMakeLists.txt | 37 ++++-- src/Style/Style_Salome.cxx | 89 +++++++------- src/Style/Style_Salome.h | 4 +- src/TOOLSGUI/CMakeLists.txt | 17 +-- src/TreeData/CMakeLists.txt | 23 +++- src/TreeData/Test/CMakeLists.txt | 33 +++-- src/TreeData/Test/mainwindow.cxx | 1 + src/VTKViewer/CMakeLists.txt | 41 ++++--- src/VTKViewer/VTKViewer_RenderWindow.cxx | 2 +- .../VTKViewer_RenderWindowInteractor.cxx | 2 +- src/ViewerTools/CMakeLists.txt | 26 ++-- src/ViewerTools/ViewerTools_DialogBase.h | 2 +- tools/dlgfactory/CMakeLists.txt | 18 +-- 163 files changed, 1461 insertions(+), 744 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} (85%) rename adm_local/cmake_files/{UseQt4Ext.cmake => UseQtExt.cmake} (80%) diff --git a/CMakeLists.txt b/CMakeLists.txt index df762efd0..db5f050ef 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,8 @@ 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 Qt5" ON) +OPTION(SALOME_BUILD_WITH_PYQT5 "Build SALOME with PyQt5" ON) # Advanced options: CMAKE_DEPENDENT_OPTION(SALOME_LIGHT_ONLY "Build SALOME Light only (no CORBA)" OFF @@ -75,6 +77,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 +129,7 @@ ENDIF() ## GUI specifics ## -FIND_PACKAGE(SalomeSIP REQUIRED) # should come after Python and before PyQt4 +FIND_PACKAGE(SalomeSIP REQUIRED) # should come after Python and before PyQt # Build with GUI observers feature IF(SALOME_GUI_USE_OBSERVERS) @@ -146,12 +149,24 @@ 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) + INCLUDE(${QT_USE_FILE}) +ELSE() + ADD_DEFINITIONS(-fPIC) + #SET(CMAKE_AUTOMOC ON) + SET(CMAKE_INCLUDE_CURRENT_DIR ON) + FIND_PACKAGE(SalomeQt5 REQUIRED) + SET(SALOME_USE_PVVIEWER OFF) +ENDIF() -# PyQt4 -FIND_PACKAGE(SalomePyQt4 REQUIRED) +# PyQt +IF (NOT SALOME_BUILD_WITH_PYQT5) + FIND_PACKAGE(SalomePyQt4 REQUIRED) +ELSE() + FIND_PACKAGE(SalomePyQt5 REQUIRED) +ENDIF() # Optional prerequisites for GUI IF(NOT SALOME_USE_GLVIEWER) @@ -168,13 +183,14 @@ 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") ENDIF() IF (SALOME_USE_PVVIEWER) - FIND_PACKAGE(SalomeParaView) + find_package(ParaView REQUIRED) + #FIND_PACKAGE(SalomeParaView) SALOME_LOG_OPTIONAL_PACKAGE(ParaView SALOME_USE_PVVIEWER) ELSE() ADD_DEFINITIONS("-DDISABLE_PVVIEWER") @@ -198,12 +214,15 @@ IF(NOT SALOME_USE_SALOMEOBJECT) ADD_DEFINITIONS("-DDISABLE_SALOMEOBJECT") ENDIF() -# Detection summary: -SALOME_PACKAGE_REPORT_AND_CHECK() +# Detection summary: +IF (NOT SALOME_BUILD_WITH_QT5) + SALOME_PACKAGE_REPORT_AND_CHECK() +ENDIF() # 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") @@ -385,8 +404,8 @@ 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}") +SET(QT_ROOT_DIR "${QT_ROOT_DIR}") +SET(PYQT_ROOT_DIR "${PYQT_ROOT_DIR}") SET(CAS_ROOT_DIR "${CAS_ROOT_DIR}") SET(OPENGL_ROOT_DIR "${OPENGL_ROOT_DIR}") SET(VTK_ROOT_DIR "${VTK_ROOT_DIR}") @@ -395,13 +414,13 @@ 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) +SALOME_CONFIGURE_PREPARE(CAS OpenGL PyQt5 Qt5 Qwt SIP VTK) 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 +431,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 QT5_ROOT_DIR PYQT5_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..86d92ac2b 100644 --- a/SalomeGUIConfig.cmake.in +++ b/SalomeGUIConfig.cmake.in @@ -109,8 +109,8 @@ 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@") +SET_AND_CHECK(QT_ROOT_DIR_EXP "@PACKAGE_QT_ROOT_DIR@") +SET_AND_CHECK(PYQT_ROOT_DIR_EXP "@PACKAGE_PYQT_ROOT_DIR@") 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/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/FindSalomeQt5.cmake b/adm_local/cmake_files/FindSalomeQt5.cmake new file mode 100644 index 000000000..04fc9f7fa --- /dev/null +++ b/adm_local/cmake_files/FindSalomeQt5.cmake @@ -0,0 +1,68 @@ +# 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 !! +# + +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5Core Qt5Core_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR) +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5Gui Qt5Gui_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR) +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5Widgets Qt5Widgets_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR) +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5Network Qt5Network_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR) +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5Xml Qt5Xml_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR) +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5OpenGL Qt5OpenGL_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR) +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5PrintSupport Qt5PrintSupport_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR) +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5WebKit Qt5WebKit_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR) +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5WebKitWidgets Qt5WebKitWidgets_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR) +SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt5X11Extras Qt5X11Extras_INCLUDE_DIRS 1 ENVVAR QT5_ROOT_DIR) + +get_filename_component(LINGUIST_PATH ${Qt5Core_DIR} DIRECTORY) +get_filename_component(LINGUIST_PATH ${LINGUIST_PATH} DIRECTORY) +get_filename_component(LINGUIST_PATH ${LINGUIST_PATH} DIRECTORY) + +set(LINGUIST_PATH ${LINGUIST_PATH}/bin) + +FIND_PROGRAM(QT_LUPDATE_EXECUTABLE NAMES lupdate PATHS ${LINGUIST_PATH} NO_DEFAULT_PATH) +if(QT_LUPDATE_EXECUTABLE) + message(STATUS "Found lupdate: " ${QT_LUPDATE_EXECUTABLE}) +else(QT_LUPDATE_EXECUTABLE) + if(Linguist_FIND_REQUIRED) + message(FATAL_ERROR "Could NOT find lupdate") + endif(Linguist_FIND_REQUIRED) +endif(QT_LUPDATE_EXECUTABLE) + +FIND_PROGRAM(QT_LRELEASE_EXECUTABLE NAMES lrelease PATHS ${LINGUIST_PATH} NO_DEFAULT_PATH) +if(QT_LRELEASE_EXECUTABLE) + message(STATUS "Found lrelease: " ${QT_LRELEASE_EXECUTABLE}) +else(QT_LRELEASE_EXECUTABLE) + if(Linguist_FIND_REQUIRED) + message(FATAL_ERROR "Could NOT find lrelease") + endif(Linguist_FIND_REQUIRED) +endif(QT_LRELEASE_EXECUTABLE) + +#MARK_AS_ADVANCED(QT_QMAKE_EXECUTABLE) +# +#IF(QT5_FOUND) +# SALOME_ACCUMULATE_HEADERS(QT_INCLUDES) +# SALOME_ACCUMULATE_ENVIRONMENT(PATH ${QT_QMAKE_EXECUTABLE}) +# SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${QT_QTCORE_LIBRARY}) +#ENDIF() diff --git a/adm_local/cmake_files/UsePyQt4.cmake b/adm_local/cmake_files/UsePyQt.cmake similarity index 85% rename from adm_local/cmake_files/UsePyQt4.cmake rename to adm_local/cmake_files/UsePyQt.cmake index ee3ec4558..7931573e6 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) - ADD_CUSTOM_TARGET(${_TgName} ${PYQT_PYUIC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input} + _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _TgName) + ADD_CUSTOM_TARGET(${_TgName} ${PYQT_PYUIC_PATH} ${_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,18 +197,18 @@ 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}) SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name}) ADD_CUSTOM_COMMAND( OUTPUT ${_output} - COMMAND ${PYQT_PYRCC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input} + COMMAND ${PYQT_PYRCC_PATH} ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input} MAIN_DEPENDENCY ${_input} ) SET(${outfiles} ${${outfiles}} ${_output}) ENDFOREACH() - _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_QRC_PY_FILES _uniqueTargetName) + _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 80% rename from adm_local/cmake_files/UseQt4Ext.cmake rename to adm_local/cmake_files/UseQtExt.cmake index 32e776c62..3d9c6f66d 100644 --- a/adm_local/cmake_files/UseQt4Ext.cmake +++ b/adm_local/cmake_files/UseQtExt.cmake @@ -17,24 +17,24 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INSTALL(CODE "MACRO(QT4_COMPILE_TS_ON_INSTALL MYLRELEASE MYTSFILE MYFULLDIR MYOUTQMFILE) +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) 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..ee70e268c 100755 --- a/src/CAF/CMakeLists.txt +++ b/src/CAF/CMakeLists.txt @@ -17,13 +17,21 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${CAS_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/src/Qtx ${PROJECT_SOURCE_DIR}/src/SUIT @@ -31,10 +39,10 @@ INCLUDE_DIRECTORIES( ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${CAS_DEFINITIONS} ${QT_DEFINITIONS}) +ADD_DEFINITIONS(${CAS_DEFINITIONS} ${_QT_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} ${CAS_OCAF} ${CAS_OCAFVIS} qtx suit std) +SET(_link_LIBRARIES ${_QT_LIBRARIES} ${CAS_OCAF} ${CAS_OCAFVIS} qtx suit std) # --- headers --- @@ -66,7 +74,11 @@ SET(_ts_RESOURCES # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES @@ -82,8 +94,8 @@ SET(caf_SOURCES ${_other_SOURCES} ${_moc_SOURCES}) # --- rules --- ADD_LIBRARY(caf ${caf_SOURCES}) -TARGET_LINK_LIBRARIES(caf ${QT_LIBRARIES} ${_link_LIBRARIES}) +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/CMakeLists.txt b/src/CAM/CMakeLists.txt index f80a03def..ef70f5618 100755 --- a/src/CAM/CMakeLists.txt +++ b/src/CAM/CMakeLists.txt @@ -17,13 +17,21 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/src/Qtx ${PROJECT_SOURCE_DIR}/src/SUIT @@ -31,10 +39,10 @@ INCLUDE_DIRECTORIES( ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} qtx suit std) +SET(_link_LIBRARIES ${_QT_LIBRARIES} qtx suit std) # --- headers --- @@ -67,7 +75,11 @@ SET(_ts_RESOURCES # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES @@ -88,4 +100,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..fc89ac778 100755 --- a/src/DDS/CMakeLists.txt +++ b/src/DDS/CMakeLists.txt @@ -60,5 +60,4 @@ ADD_LIBRARY(DDS ${DDS_SOURCES}) 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}) - +INSTALL(FILES ${DDS_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) \ No newline at end of file diff --git a/src/Event/CMakeLists.txt b/src/Event/CMakeLists.txt index 9da467339..09e9e2c84 100755 --- a/src/Event/CMakeLists.txt +++ b/src/Event/CMakeLists.txt @@ -18,12 +18,18 @@ # # --- options --- - +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES}) +SET(_link_LIBRARIES ${_QT_LIBRARIES}) # --- headers --- diff --git a/src/GLViewer/CMakeLists.txt b/src/GLViewer/CMakeLists.txt index 2a67388ab..4f0108dc0 100755 --- a/src/GLViewer/CMakeLists.txt +++ b/src/GLViewer/CMakeLists.txt @@ -17,22 +17,30 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES} ${Qt5OpenGL_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS} ${Qt5OpenGL_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5OpenGL_LIBRARIES}) +ENDIF() # --- options --- INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PROJECT_SOURCE_DIR}/src/Qtx ${PROJECT_SOURCE_DIR}/src/SUIT ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${CAS_DEFINITIONS} ${QT_DEFINITIONS}) +ADD_DEFINITIONS(${CAS_DEFINITIONS} ${_QT_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} ${CAS_KERNEL} ${OPENGL_LIBRARIES} qtx suit) +SET(_link_LIBRARIES ${_QT_LIBRARIES} ${CAS_KERNEL} ${OPENGL_LIBRARIES} qtx suit) IF(NOT WIN32) LIST(APPEND _link_LIBRARIES Xmu) ENDIF() @@ -104,8 +112,11 @@ SET(_other_RESOURCES # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) - +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES GLViewer_AspectLine.cxx @@ -144,6 +155,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}") -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/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..a38fd76a6 100644 --- a/src/GLViewer/GLViewer_Drawer.cxx +++ b/src/GLViewer/GLViewer_Drawer.cxx @@ -442,29 +442,24 @@ static GLuint displayListBase( QFont* theFont ) int aFontCont = 0; QString aFontDef = theFont->toString(); char** xFontList = XListFonts( aDisp, aFontDef.toLatin1()/*aFindFont.myFontString.data()*/, 1, &aFontCont ); - if( !theFont->handle() ) - { #ifdef _DEBUG_ - printf( "Can't load font %s. loading default font....\n", aFontDef.toLatin1().data()/*aFindFont.myFontString.data()*/ ); + printf( "Can't load font %s. loading default font....\n", aFontDef.toLatin1().data()/*aFindFont.myFontString.data()*/ ); #endif - QString aFontMask ("-*-*-*-r-*-*-"); - aFontMask += aFontDef/*aFindFont.myFontString*/.section( ',', 1, 1 ); + QString aFontMask ("-*-*-*-r-*-*-"); + aFontMask += aFontDef/*aFindFont.myFontString*/.section( ',', 1, 1 ); #ifdef _DEBUG_ - printf( "Height of Default font: %s\n", aFontDef/*aFindFont.myFontString*/.section( ',', 1, 1 ).data() ); + printf( "Height of Default font: %s\n", aFontDef/*aFindFont.myFontString*/.section( ',', 1, 1 ).data() ); #endif - aFontMask += "-*-*-*-m-*-*-*"; - xFontList = XListFonts( aDisp, aFontMask.toLatin1().constData()/*"-*-*-*-r-*-*-12-*-*-*-m-*-*-*"*/, 1, &aFontCont ); - if( aFontCont == 0 ) - { + 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" ); + printf( "Can't load default font\n" ); #endif - return 0; - } - glXUseXFont( (Font)(XLoadFont( aDisp,xFontList[0] )), 0, 256, listBase ); + return 0; } - else - glXUseXFont( (Font)(theFont->handle()), 0, 256, listBase ); + glXUseXFont( (Font)(XLoadFont( aDisp,xFontList[0] )), 0, 256, listBase ); 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..d05fbc551 100644 --- a/src/GLViewer/GLViewer_ViewPort.cxx +++ b/src/GLViewer/GLViewer_ViewPort.cxx @@ -43,7 +43,7 @@ #include #if !defined WIN32 -#include +#include #include #include #include @@ -122,13 +122,13 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi ) cout << "Choosing cmap for vID = " << vi->visualid << endl; #endif - if ( vi->visualid == XVisualIDFromVisual( (Visual*)QX11Info::appVisual() ) ) + /* if ( vi->visualid == XVisualIDFromVisual( (Visual*)QX11Info::appVisual() ) ) { #ifdef DEBUG cout << "Using x11AppColormap" << endl; #endif return QX11Info::appColormap(); - } + } */ if ( mesa_gl ) { 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..38dbcad82 100644 --- a/src/GLViewer/GLViewer_Viewer.cxx +++ b/src/GLViewer/GLViewer_Viewer.cxx @@ -888,7 +888,7 @@ void GLViewer_ViewSketcher::onSketch( SketchState state ) if ( state == Fin ) { - QApplication::syncX(); /* force rectangle redrawing */ + QApplication::sync(); /* force rectangle redrawing */ 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..2d1714c20 100755 --- a/src/GUI_PY/CMakeLists.txt +++ b/src/GUI_PY/CMakeLists.txt @@ -17,8 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UsePyQt4) - +INCLUDE(UsePyQt) # --- resources --- # uic files / to be processed by pyuic @@ -31,8 +30,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/GUI_PY/dockwidgets.py b/src/GUI_PY/dockwidgets.py index 8bd579758..4322cb5ea 100644 --- a/src/GUI_PY/dockwidgets.py +++ b/src/GUI_PY/dockwidgets.py @@ -1,5 +1,5 @@ -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * import SalomePyQt diff --git a/src/GUI_PY/genericdialog.py b/src/GUI_PY/genericdialog.py index 9be5cee62..8bd156955 100644 --- a/src/GUI_PY/genericdialog.py +++ b/src/GUI_PY/genericdialog.py @@ -21,7 +21,7 @@ __author__="gboulant" __date__ ="$31 mars 2010 17:09:53$" -from PyQt4.QtGui import QDialog, QMessageBox +from PyQt5.QtGui import QDialog, QMessageBox from genericdialog_ui import Ui_GenericDialog @@ -113,8 +113,8 @@ class GenericDialog(QDialog): # def TEST_GenericDialog(): import sys - from PyQt4.QtGui import QApplication - from PyQt4.QtCore import QObject, SIGNAL, SLOT + from PyQt5.QtGui import QApplication + from PyQt5.QtCore import QObject, SIGNAL, SLOT app = QApplication(sys.argv) QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()")) diff --git a/src/GUI_PY/mytestdialog.py b/src/GUI_PY/mytestdialog.py index 24d057640..de3c8aaad 100644 --- a/src/GUI_PY/mytestdialog.py +++ b/src/GUI_PY/mytestdialog.py @@ -71,7 +71,7 @@ class MyTestDialog(GenericDialog): return name -from PyQt4.QtCore import SIGNAL +from PyQt5.QtCore import SIGNAL class MyTestDialogWithSignals(MyTestDialog): """ This class is to illustrate the usage of the GenericDialog in the @@ -104,8 +104,8 @@ class MyTestDialogWithSignals(MyTestDialog): def TEST_MyTestDialog_modal(): import sys - from PyQt4.QtCore import QObject, SIGNAL, SLOT - from PyQt4.QtGui import QApplication + from PyQt5.QtCore import QObject, SIGNAL, SLOT + from PyQt5.QtGui import QApplication app = QApplication(sys.argv) QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()")) @@ -126,8 +126,8 @@ class DialogListener: def TEST_MyTestDialog_non_modal(): import sys - from PyQt4.QtCore import QObject, SIGNAL, SLOT - from PyQt4.QtGui import QApplication + from PyQt5.QtCore import QObject, SIGNAL, SLOT + from PyQt5.QtGui import QApplication app = QApplication(sys.argv) QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()")) diff --git a/src/GUI_PY/selectvars.py b/src/GUI_PY/selectvars.py index 412b6b82b..e80a77f87 100644 --- a/src/GUI_PY/selectvars.py +++ b/src/GUI_PY/selectvars.py @@ -21,8 +21,8 @@ # import os -from PyQt4 import QtGui, QtCore -from PyQt4.QtCore import Qt +from PyQt5 import QtGui, QtCore +from PyQt5.QtCore import Qt import salome from salome.kernel.studyedit import getStudyEditor diff --git a/src/GraphicsView/CMakeLists.txt b/src/GraphicsView/CMakeLists.txt index 60d068ba3..eacb1af47 100755 --- a/src/GraphicsView/CMakeLists.txt +++ b/src/GraphicsView/CMakeLists.txt @@ -17,23 +17,31 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PROJECT_SOURCE_DIR}/src/Qtx ${PROJECT_SOURCE_DIR}/src/SUIT ${PROJECT_SOURCE_DIR}/src/ImageComposer ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} qtx suit ImageComposer) +SET(_link_LIBRARIES ${_QT_LIBRARIES} qtx suit ImageComposer) # --- headers --- @@ -85,7 +93,11 @@ SET(_other_RESOURCES # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES @@ -109,6 +121,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..b18d44c27 100644 --- a/src/GraphicsView/GraphicsView_Object.cxx +++ b/src/GraphicsView/GraphicsView_Object.cxx @@ -43,15 +43,15 @@ GraphicsView_Object::GraphicsView_Object( QGraphicsItem* theParent ) //======================================================================= GraphicsView_Object::~GraphicsView_Object() { - QListIterator aChildIter( children() ); - while( aChildIter.hasNext() ) + QList aList = childItems(); + for( QList::const_iterator aChild = aList.begin(); aChild != aList.end(); ++aChild ) { - if( QGraphicsItem* aChild = aChildIter.next() ) + if( *aChild ) { - removeFromGroup( aChild ); - if( QGraphicsScene* aScene = aChild->scene() ) - aScene->removeItem( aChild ); - delete aChild; + removeFromGroup( *aChild ); + if( QGraphicsScene* aScene = (*aChild)->scene() ) + aScene->removeItem( *aChild ); + delete ( *aChild ); aChild = 0; } } diff --git a/src/GuiHelpers/CMakeLists.txt b/src/GuiHelpers/CMakeLists.txt index 65db77ba3..29379501f 100755 --- a/src/GuiHelpers/CMakeLists.txt +++ b/src/GuiHelpers/CMakeLists.txt @@ -17,10 +17,17 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) +ENDIF() # additional include directories INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} - ${QT_INCLUDES} + ${_QT_INCLUDES} ${Boost_INCLUDE_DIRS} ${OMNIORB_INCLUDE_DIR} ${PTHREAD_INCLUDE_DIR} @@ -36,7 +43,7 @@ INCLUDE_DIRECTORIES( # additional preprocessor / compiler flags ADD_DEFINITIONS( ${CAS_DEFINITIONS} - ${QT_DEFINITIONS} + ${_QT_DEFINITIONS} ${BOOST_DEFINITIONS} ${OMNIORB_DEFINITIONS} ) @@ -69,7 +76,11 @@ SET(SalomeGuiHelpers_HEADERS ${_moc_HEADERS} ${_other_HEADERS}) # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES diff --git a/src/HelpBrowser/CMakeLists.txt b/src/HelpBrowser/CMakeLists.txt index 6de2ec6c3..7eea49a87 100644 --- a/src/HelpBrowser/CMakeLists.txt +++ b/src/HelpBrowser/CMakeLists.txt @@ -18,21 +18,30 @@ # # --- options --- +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES} ${Qt5Network_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES}) +ENDIF() # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PROJECT_SOURCE_DIR}/src/Qtx ) # additional preprocessor / compiler flags ADD_DEFINITIONS( - ${QT_DEFINITIONS} + ${_QT_DEFINITIONS} ) # libraries to link to SET(_link_LIBRARIES - ${QT_LIBRARIES} + ${_QT_LIBRARIES} qtx ) @@ -50,12 +59,17 @@ SET(_moc_HEADERS 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}) +IF (NOT SALOME_BUILD_WITH_QT5) + # sources / moc wrappings + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) + # sources / rcc wrappings + QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +ELSE() + # sources / moc wrappings + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) + # sources / rcc wrappings + QT5_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +ENDIF() # sources / to compile SET(_other_SOURCES @@ -76,4 +90,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..6ee554dfa 100755 --- a/src/ImageComposer/CMakeLists.txt +++ b/src/ImageComposer/CMakeLists.txt @@ -17,18 +17,26 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES}) +SET(_link_LIBRARIES ${_QT_LIBRARIES}) # --- headers --- diff --git a/src/LightApp/CMakeLists.txt b/src/LightApp/CMakeLists.txt index 9b39c65e8..305671348 100755 --- a/src/LightApp/CMakeLists.txt +++ b/src/LightApp/CMakeLists.txt @@ -17,14 +17,23 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES} ) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} - ${QT_INCLUDES} + ${_QT_INCLUDES} ${HDF5_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIR} ${PROJECT_BINARY_DIR} @@ -88,7 +97,7 @@ IF(SALOME_USE_PYCONSOLE) ENDIF() # additional preprocessor / compiler flags -ADD_DEFINITIONS(${CAS_DEFINITIONS} ${QT_DEFINITIONS} ${HDF5_DEFINITIONS}) +ADD_DEFINITIONS(${CAS_DEFINITIONS} ${_QT_DEFINITIONS} ${HDF5_DEFINITIONS}) IF(SALOME_USE_PLOT2DVIEWER) ADD_DEFINITIONS(${QWT_DEFINITIONS}) ENDIF() @@ -99,7 +108,7 @@ ENDIF() # libraries to link to SET(_link_LIBRARIES ${CAS_KERNEL} - ${QT_LIBRARIES} + ${_QT_LIBRARIES} ${HDF5_LIBRARIES} CASCatch qtx suit std SalomeStyle SalomePrs CAM LogWindow ObjBrowser Event ${KERNEL_SalomeHDFPersist} ${KERNEL_SALOMELocalTrace} @@ -231,12 +240,17 @@ SET(_other_RESOURCES ) # --- sources --- - -# sources / rcc wrappings -QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) - -# sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + # sources / moc wrappings + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) + # sources / rcc wrappings + QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +ELSE() + # sources / moc wrappings + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) + # sources / rcc wrappings + QT5_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +ENDIF() # sources / static SET(_other_SOURCES @@ -298,6 +312,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 f50576ea8..402215d8c 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -2013,7 +2013,7 @@ QWidget* LightApp_Application::createWindow( const int flag ) // Create OBSelector new LightApp_OBSelector( ob, mySelMgr ); - ob->treeView()->header()->setResizeMode(SUIT_DataObject::VisibilityId, QHeaderView::Fixed); + ob->treeView()->header()->setSectionResizeMode(SUIT_DataObject::VisibilityId, QHeaderView::Fixed); 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" ) ); @@ -4008,14 +4008,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; @@ -4802,7 +4802,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..13a8a255c 100755 --- a/src/LogWindow/CMakeLists.txt +++ b/src/LogWindow/CMakeLists.txt @@ -17,22 +17,30 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PROJECT_SOURCE_DIR}/src/Qtx ${PROJECT_SOURCE_DIR}/src/SUIT ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} qtx suit) +SET(_link_LIBRARIES ${_QT_LIBRARIES} qtx suit) # --- headers --- @@ -54,7 +62,11 @@ SET(_ts_RESOURCES # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES LogWindow.cxx) @@ -69,4 +81,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..dd489c295 100755 --- a/src/OBJECT/CMakeLists.txt +++ b/src/OBJECT/CMakeLists.txt @@ -18,6 +18,13 @@ # # --- options --- +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # additional include directories INCLUDE_DIRECTORIES( @@ -26,10 +33,10 @@ INCLUDE_DIRECTORIES( ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS} ${CAS_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS} ${CAS_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} ${CAS_LDPATH} ${CAS_KERNEL} ${CAS_TKV3d} ViewerData) +SET(_link_LIBRARIES ${_QT_LIBRARIES} ${CAS_LDPATH} ${CAS_KERNEL} ${CAS_TKV3d} ViewerData) # --- headers --- diff --git a/src/OCCViewer/CMakeLists.txt b/src/OCCViewer/CMakeLists.txt index 01e7473bb..1eb831ec9 100755 --- a/src/OCCViewer/CMakeLists.txt +++ b/src/OCCViewer/CMakeLists.txt @@ -20,15 +20,23 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} ${OGL_INCLUDE_DIRS} - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PTHREAD_INCLUDE_DIR} ${PROJECT_SOURCE_DIR}/src/CASCatch ${PROJECT_SOURCE_DIR}/src/Qtx @@ -39,11 +47,11 @@ INCLUDE_DIRECTORIES( ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${OGL_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS} ${CAS_DEFINITIONS} ${OGL_DEFINITIONS}) # libraries to link to SET(_link_LIBRARIES - ${OPENGL_LIBRARIES} ${QT_LIBRARIES} ${CAS_KERNEL} ${CAS_VIEWER} ${CAS_TKGeomAlgo} + ${OPENGL_LIBRARIES} ${_QT_LIBRARIES} ${CAS_KERNEL} ${CAS_VIEWER} ${CAS_TKGeomAlgo} ${CAS_TKTopAlgo} ${CAS_TKG2d} ${CAS_TKOpenGl} CASCatch qtx suit ViewerTools ViewerData OpenGLUtils ) @@ -144,12 +152,17 @@ SET(_other_RESOURCES ) # --- sources --- - -# sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) - -# sources / rcc wrappings -QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +IF (NOT SALOME_BUILD_WITH_QT5) + # sources / moc wrappings + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) + # sources / rcc wrappings + QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +ELSE() + # sources / moc wrappings + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) + # sources / rcc wrappings + QT5_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +ENDIF() # sources / static SET(_other_SOURCES @@ -186,6 +199,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_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx index 282cc5721..fe1b2b871 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ b/src/OCCViewer/OCCViewer_ViewModel.cxx @@ -990,7 +990,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..d4460d0c8 100755 --- a/src/OCCViewer/OCCViewer_ViewPort.cxx +++ b/src/OCCViewer/OCCViewer_ViewPort.cxx @@ -41,7 +41,7 @@ #include #if !defined WIN32 -#include +#include #include #include #include @@ -115,13 +115,13 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi ) //cout << "Choosing cmap for vID = " << vi->visualid << endl; //#endif - if ( vi->visualid == XVisualIDFromVisual( (Visual*)QX11Info::appVisual() ) ) + /*if ( vi->visualid == XVisualIDFromVisual( (Visual*)QX11Info::appVisual() ) ) { #ifdef DEBUG // cout << "Using x11AppColormap" << endl; #endif return QX11Info::appColormap(); - } + }*/ if ( mesa_gl ) { diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.cxx b/src/OCCViewer/OCCViewer_ViewPort3d.cxx index cc6d7bf5a..b77acd70d 100755 --- a/src/OCCViewer/OCCViewer_ViewPort3d.cxx +++ b/src/OCCViewer/OCCViewer_ViewPort3d.cxx @@ -590,7 +590,7 @@ void OCCViewer_ViewPort3d::paintEvent( QPaintEvent* e ) mapView( activeView() ); #endif if ( !myWindow.IsNull() ) { - QApplication::syncX(); + QApplication::sync(); QRect rc = e->rect(); if ( !myPaintersRedrawing ) activeView()->Redraw( rc.x(), rc.y(), rc.width(), rc.height() ); @@ -609,7 +609,7 @@ void OCCViewer_ViewPort3d::resizeEvent( QResizeEvent* e ) if ( !mapped( activeView() ) ) mapView( activeView() ); #endif - QApplication::syncX(); + QApplication::sync(); if ( !activeView().IsNull() ) activeView()->MustBeResized(); } diff --git a/src/OCCViewer/OCCViewer_ViewSketcher.cxx b/src/OCCViewer/OCCViewer_ViewSketcher.cxx index 164f24a34..fffd12e05 100755 --- a/src/OCCViewer/OCCViewer_ViewSketcher.cxx +++ b/src/OCCViewer/OCCViewer_ViewSketcher.cxx @@ -298,7 +298,7 @@ void OCCViewer_RectSketcher::onSketch( SketchState state ) if ( state == Fin ) { - QApplication::syncX(); /* force rectangle redrawing */ + QApplication::sync(); /* force rectangle redrawing */ mypViewWindow->activateSketching( OCCViewer_ViewWindow::NoSketching ); } } @@ -515,7 +515,7 @@ void OCCViewer_PolygonSketcher::onSketch( SketchState state ) mypPolyRB->clearGeometry(); mypPolyRB->hide(); } - QApplication::syncX(); + QApplication::sync(); mypViewWindow->activateSketching( OCCViewer_ViewWindow::NoSketching ); } } diff --git a/src/ObjBrowser/CMakeLists.txt b/src/ObjBrowser/CMakeLists.txt index 0ecb41c75..24d298648 100644 --- a/src/ObjBrowser/CMakeLists.txt +++ b/src/ObjBrowser/CMakeLists.txt @@ -17,21 +17,29 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PROJECT_SOURCE_DIR}/src/Qtx ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} qtx) +SET(_link_LIBRARIES ${_QT_LIBRARIES} qtx) # --- headers --- @@ -56,7 +64,11 @@ SET(_ts_RESOURCES # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES OB_Browser.cxx) @@ -71,4 +83,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 65d5f73b5..9e26191d4 100644 --- a/src/PVViewer/CMakeLists.txt +++ b/src/PVViewer/CMakeLists.txt @@ -17,7 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) +INCLUDE(UseQtExt) # Install ParaView filters, etc ... ADD_SUBDIRECTORY(resources) @@ -78,12 +78,17 @@ SET(_ts_RESOURCES ) # --- sources --- - -# sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) - -# sources / rcc wrappings -QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +IF (NOT SALOME_BUILD_WITH_QT5) + # sources / moc wrappings + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) + # sources / rcc wrappings + QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +ELSE() + # sources / moc wrappings + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) + # sources / rcc wrappings + QT5_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +ENDIF() # sources / static SET(_other_SOURCES @@ -109,7 +114,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..cbbeec3b0 100755 --- a/src/Plot2d/CMakeLists.txt +++ b/src/Plot2d/CMakeLists.txt @@ -17,13 +17,21 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${QWT_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/src/Qtx @@ -31,10 +39,10 @@ INCLUDE_DIRECTORIES( ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS} ${QWT_DEFINITIONS} ${PYTHON_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS} ${QWT_DEFINITIONS} ${PYTHON_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} ${QWT_LIBRARY} ${PYTHON_LIBRARIES} qtx suit) +SET(_link_LIBRARIES ${_QT_LIBRARIES} ${QWT_LIBRARY} ${PYTHON_LIBRARIES} qtx suit) # --- headers --- @@ -108,7 +116,11 @@ SET(_other_RESOURCES # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES @@ -144,6 +156,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..1031b089d 100644 --- a/src/Plot2d/Plot2d_PlotItems.cxx +++ b/src/Plot2d/Plot2d_PlotItems.cxx @@ -40,6 +40,8 @@ #include #include +#include + const int SPACING = 10; const int SYMBOL_SIZE = 13; @@ -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..c1b53f966 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -58,7 +58,7 @@ #include #include #include -#include +#include #include #include #include @@ -78,7 +78,7 @@ #include #include -#include +#include #include #include @@ -1642,7 +1642,7 @@ void Plot2d_ViewFrame::getFitRangeByMarkers(double& xMin, double& xMax, */ int Plot2d_ViewFrame::testOperation( const QMouseEvent& me ) { - int btn = me.button() | me.modifiers(); + int btn = me.buttons() | me.modifiers(); const int zoomBtn = Qt::ControlModifier | Qt::LeftButton; const int panBtn = Qt::ControlModifier | Qt::MidButton; const int fitBtn = Qt::ControlModifier | Qt::RightButton; @@ -2683,7 +2683,7 @@ void Plot2d_ViewFrame::plotMousePressed( const QMouseEvent& me ) } } else { - int btn = me.button() | me.modifiers(); + int btn = me.buttons() | me.modifiers(); if (btn == Qt::RightButton) { QMouseEvent* aEvent = new QMouseEvent(QEvent::MouseButtonPress, me.pos(), me.button(), me.buttons(), me.modifiers() ); diff --git a/src/Plot2d/Plot2d_ViewWindow.cxx b/src/Plot2d/Plot2d_ViewWindow.cxx index 69e1310e1..67877c639 100755 --- a/src/Plot2d/Plot2d_ViewWindow.cxx +++ b/src/Plot2d/Plot2d_ViewWindow.cxx @@ -46,8 +46,8 @@ #include #include #include -#include -#include +#include +#include #include diff --git a/src/PyConsole/CMakeLists.txt b/src/PyConsole/CMakeLists.txt index 36904dd3c..c0b4ca8a2 100755 --- a/src/PyConsole/CMakeLists.txt +++ b/src/PyConsole/CMakeLists.txt @@ -17,13 +17,21 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PYTHON_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/src/Qtx ${PROJECT_SOURCE_DIR}/src/SUIT @@ -32,10 +40,10 @@ INCLUDE_DIRECTORIES( ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS} ${PYTHON_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS} ${PYTHON_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} ${PYTHON_LIBRARIES} qtx suit PyInterp Event) +SET(_link_LIBRARIES ${_QT_LIBRARIES} ${PYTHON_LIBRARIES} qtx suit PyInterp Event) # --- headers --- @@ -70,7 +78,11 @@ SET(_ts_RESOURCES # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES @@ -93,5 +105,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..f199d36df 100644 --- a/src/PyEditor/CMakeLists.txt +++ b/src/PyEditor/CMakeLists.txt @@ -19,21 +19,29 @@ # Author : Maxim GLIBIN, Open CASCADE S.A.S. (maxim.glibin@opencascade.com) # -INCLUDE(UseQt4Ext) - +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PROJECT_SOURCE_DIR}/src/Qtx ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${PLATFORM_LIBS} ${QT_LIBRARIES} qtx) +SET(_link_LIBRARIES ${PLATFORM_LIBS} ${_QT_LIBRARIES} qtx) # --- headers --- @@ -66,7 +74,11 @@ SET(_ts_RESOURCES ) # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES @@ -86,4 +98,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..e6174f101 100755 --- a/src/PyInterp/CMakeLists.txt +++ b/src/PyInterp/CMakeLists.txt @@ -17,22 +17,29 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PYTHON_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/src/Event ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS} ${PYTHON_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS} ${PYTHON_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} ${PYTHON_LIBRARIES} Event) +SET(_link_LIBRARIES ${_QT_LIBRARIES} ${PYTHON_LIBRARIES} Event) # --- headers --- @@ -56,7 +63,11 @@ SET(PyInterp_HEADERS ${_other_HEADERS}) # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_internal_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES diff --git a/src/PyViewer/CMakeLists.txt b/src/PyViewer/CMakeLists.txt index 2f9961782..32214bdfe 100644 --- a/src/PyViewer/CMakeLists.txt +++ b/src/PyViewer/CMakeLists.txt @@ -19,21 +19,30 @@ # Author : Maxim GLIBIN, Open CASCADE S.A.S. (maxim.glibin@opencascade.com) # -INCLUDE(UseQt4Ext) +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PROJECT_SOURCE_DIR}/src/Qtx ${PROJECT_SOURCE_DIR}/src/SUIT ${PROJECT_SOURCE_DIR}/src/PyEditor ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${PLATFORM_LIBS} ${QT_LIBRARIES} qtx suit PyEditor) +SET(_link_LIBRARIES ${PLATFORM_LIBS} ${_QT_LIBRARIES} qtx suit PyEditor) # header files / to be processed by moc SET(_moc_HEADERS @@ -62,11 +71,18 @@ SET(_ts_RESOURCES # resource files / to be processed by rcc SET(_rcc_RESOURCES ${RESOURCES_PATH}/PyEditor.qrc) -# sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) - -# sources / rcc wrappings -QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +# --- sources --- +IF (NOT SALOME_BUILD_WITH_QT5) + # sources / moc wrappings + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) + # sources / rcc wrappings + QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +ELSE() + # sources / moc wrappings + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) + # sources / rcc wrappings + QT5_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +ENDIF() # sources / static SET(_other_SOURCES @@ -89,4 +105,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..8a674c3e5 100644 --- a/src/PyViewer/PyViewer_ViewWindow.cxx +++ b/src/PyViewer/PyViewer_ViewWindow.cxx @@ -35,6 +35,9 @@ #include #include +#include +#include +#include /*! \class PyViewer_ViewWindow @@ -69,7 +72,7 @@ void PyViewer_ViewWindow::initLayout() connect( my_TextEditor->document(), SIGNAL( modificationChanged( bool ) ), this, SLOT( setWindowModified( bool ) ) ); - statusBar()->showMessage( tr("STS_READY") ); + //statusBar()->showMessage( tr("STS_READY") ); } } @@ -448,8 +451,8 @@ void PyViewer_ViewWindow::loadFile( const QString &theFilePath ) setCurrentFile( theFilePath ); aFile.close(); - if ( isExternal() ) - statusBar()->showMessage( tr( "STS_F_LOADED" ), 2000 ); + /*if ( isExternal() ) + statusBar()->showMessage( tr( "STS_F_LOADED" ), 2000 ); */ } /*! @@ -474,8 +477,8 @@ bool PyViewer_ViewWindow::saveFile( const QString &theFilePath ) setCurrentFile( theFilePath ); aFile.close(); - if ( isExternal() ) - statusBar()->showMessage( tr( "STS_F_SAVED" ), 2000 ); + /*if ( isExternal() ) + statusBar()->showMessage( tr( "STS_F_SAVED" ), 2000 ); */ return true; } diff --git a/src/QDS/CMakeLists.txt b/src/QDS/CMakeLists.txt index fbe9e270b..16cc8f149 100755 --- a/src/QDS/CMakeLists.txt +++ b/src/QDS/CMakeLists.txt @@ -17,23 +17,31 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PROJECT_SOURCE_DIR}/src/Qtx ${PROJECT_SOURCE_DIR}/src/DDS ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS} ${CAS_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS} ${CAS_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} ${CAS_KERNEL} qtx DDS) +SET(_link_LIBRARIES ${_QT_LIBRARIES} ${CAS_KERNEL} qtx DDS) # --- headers --- @@ -74,7 +82,11 @@ SET(_ts_RESOURCES # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES @@ -104,4 +116,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..f12aff1b9 100755 --- a/src/Qtx/CMakeLists.txt +++ b/src/Qtx/CMakeLists.txt @@ -17,18 +17,27 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES} ${Qt5Xml_INCLUDES} ${Qt5WebKit_INCLUDES} ${Qt5WebKitWidgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS} ${Qt5Xml_DEFINITIONS} ${Qt5WebKit_DEFINITIONS} ${Qt5WebKitWidgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5Xml_LIBRARIES} ${Qt5WebKit_LIBRARIES} ${Qt5WebKitWidgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories -INCLUDE_DIRECTORIES(${QT_INCLUDES}) +INCLUDE_DIRECTORIES(${_QT_INCLUDES}) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} ${OPENGL_LIBRARIES}) +SET(_link_LIBRARIES ${_QT_LIBRARIES} ${OPENGL_LIBRARIES}) # --- headers --- @@ -110,12 +119,17 @@ 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}) +IF (NOT SALOME_BUILD_WITH_QT5) + # sources / moc wrappings + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) + # sources / rcc wrappings + QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +ELSE() + # sources / moc wrappings + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) + # sources / rcc wrappings + QT5_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +ENDIF() # sources / static SET(_other_SOURCES @@ -186,4 +200,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 a4df0a7c3..eb5ddb0d2 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/QtxActionMenuMgr.cxx b/src/Qtx/QtxActionMenuMgr.cxx index 9fd3a3f15..8cdd79f69 100644 --- a/src/Qtx/QtxActionMenuMgr.cxx +++ b/src/Qtx/QtxActionMenuMgr.cxx @@ -1290,7 +1290,7 @@ int QtxActionMenuMgr::MenuCreator::append( const QString& tag, const bool subMen QtxAction* newAct = new QtxAction( strValue( attr, tooltip ), set, strValue( attr, label ), - QKeySequence( strValue( attr, accel ) ), + QKeySequence( strValue( attr, accel ) )[0], myMgr ); newAct->setToolTip( strValue( attr, tooltip ) ); QString toggleact = strValue( attr, toggle ); diff --git a/src/Qtx/QtxActionMgr.cxx b/src/Qtx/QtxActionMgr.cxx index c7e640049..b32f5cfc9 100644 --- a/src/Qtx/QtxActionMgr.cxx +++ b/src/Qtx/QtxActionMgr.cxx @@ -29,8 +29,8 @@ #include #include #ifndef QT_NO_DOM -#include -#include +#include +#include #include #endif diff --git a/src/Qtx/QtxActionToolMgr.cxx b/src/Qtx/QtxActionToolMgr.cxx index c47ba73f8..f9f629004 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 ) @@ -858,7 +858,7 @@ int QtxActionToolMgr::ToolCreator::append( const QString& tag, const bool /*subM set = QIcon( pix ); QtxAction* newAct = new QtxAction( strValue( attr, tooltip ), set, strValue( attr, label ), - QKeySequence( strValue( attr, accel ) ), myMgr ); + QKeySequence( strValue( attr, accel ) )[0], myMgr ); QString toggleact = strValue( attr, toggle ); newAct->setCheckable( !toggleact.isEmpty() ); newAct->setChecked( toggleact.toLower() == "true" ); 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..22c364959 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,7 +1442,6 @@ void QtxDialog::reject() void QtxDialog::emitSignal() { QApplication::instance()->processEvents(); - QApplication::syncX(); 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..c2eadeb6a 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::MenubarUpdated || */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..aed5f399a 100644 --- a/src/Qtx/QtxPopupMgr.cxx +++ b/src/Qtx/QtxPopupMgr.cxx @@ -56,7 +56,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; } @@ -65,7 +65,7 @@ bool operator<( const QVariant& v1, const QVariant& v2 ) } } return t1 < t2; -} +} /*! \class QtxPopupMgr::PopupCreator @@ -154,8 +154,9 @@ int QtxPopupMgr::PopupCreator::append( const QString& tag, const bool subMenu, } QString actLabel = strValue( attr, label ); + QKeySequence seq = QKeySequence( strValue( attr, accel ) ); QtxAction* newAct = new QtxAction( strValue( attr, tooltip ), set, actLabel, - QKeySequence( strValue( attr, accel ) ), + seq[0], myMgr ); newAct->setToolTip( strValue( attr, tooltip ) ); QString toggleact = strValue( attr, toggle ); 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 68511cf35..529bfc8df 100644 --- a/src/Qtx/QtxResourceMgr.cxx +++ b/src/Qtx/QtxResourceMgr.cxx @@ -36,9 +36,9 @@ #include #include #ifndef QT_NO_DOM -#include -#include -#include +#include +#include +#include #endif #include @@ -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..ff656d093 100644 --- a/src/Qtx/QtxTranslator.cxx +++ b/src/Qtx/QtxTranslator.cxx @@ -70,10 +70,10 @@ QtxTranslator::~QtxTranslator() \param comment 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* comment, int n ) const { - QString res = QTranslator::translate( context, sourceText, comment ); + QString res = QTranslator::translate( context, sourceText, comment, n ); if( res.isNull() ) - res = QTranslator::translate( GLOBAL_CONTEXT, sourceText, comment ); + res = QTranslator::translate( GLOBAL_CONTEXT, sourceText, comment, n ); return res; } diff --git a/src/Qtx/QtxTranslator.h b/src/Qtx/QtxTranslator.h index cabd6af20..9cc672541 100644 --- a/src/Qtx/QtxTranslator.h +++ b/src/Qtx/QtxTranslator.h @@ -32,7 +32,7 @@ class QTX_EXPORT QtxTranslator : public QTranslator public: QtxTranslator( QObject* parent = 0 ); ~QtxTranslator(); - virtual QString translate( const char*, const char*, const char* = 0 ) const; + virtual QString translate( const char*, const char*, const char* = 0, int n = -1 ) const; }; #endif diff --git a/src/Qtx/QtxTreeView.cxx b/src/Qtx/QtxTreeView.cxx index 291292357..1257742f0 100644 --- a/src/Qtx/QtxTreeView.cxx +++ b/src/Qtx/QtxTreeView.cxx @@ -107,10 +107,10 @@ 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 ( iconData.canConvert( QMetaType::QIcon ) ) + icon = iconData.value(); + else if ( iconData.canConvert( QMetaType::QPixmap ) ) + icon = iconData.value(); } if( ( !lab.isEmpty() || !icon.isNull() ) && appropriate.isValid() ? appropriate.toInt()==Qtx::Toggled : true ) @@ -136,7 +136,7 @@ void QtxTreeView::Header::contextMenuEvent( QContextMenuEvent* e ) } else if ( a && a == sortAction ) { setSortIndicatorShown( a->isChecked() ); - setClickable( a->isChecked() ); + setSectionsClickable( a->isChecked() ); QtxTreeView* view = qobject_cast( parent() ); if ( view ) { view->emitSortingEnabled( a->isChecked() ); @@ -181,7 +181,7 @@ QtxTreeView::QtxTreeView( QWidget* parent ) : QTreeView( parent ) { setHeader( new Header( false, this ) ); - header()->setMovable( true ); + header()->setSectionsMovable( true ); } /*! @@ -193,7 +193,7 @@ QtxTreeView::QtxTreeView( const bool enableSortMenu, QWidget* parent ) : QTreeView( parent ) { setHeader( new Header( enableSortMenu, this ) ); - header()->setMovable( true ); + header()->setSectionsMovable( true ); } /*! diff --git a/src/Qtx/QtxWebBrowser.cxx b/src/Qtx/QtxWebBrowser.cxx index 146029464..ef9928f81 100644 --- a/src/Qtx/QtxWebBrowser.cxx +++ b/src/Qtx/QtxWebBrowser.cxx @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include namespace 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..d4b037048 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,7 +311,7 @@ void QtxWorkspaceAction::removedFrom( QWidget* w ) */ void QtxWorkspaceAction::updateContent() { - bool count = workspace() ? workspace()->windowList().count() : 0; + bool count = workspace() ? workspace()->subWindowList().count() : 0; action( Cascade )->setEnabled( count ); action( Tile )->setEnabled( count ); action( HTile )->setEnabled( count ); @@ -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..f4d796801 100755 --- a/src/QxScene/CMakeLists.txt +++ b/src/QxScene/CMakeLists.txt @@ -17,22 +17,30 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PROJECT_SOURCE_DIR}/src/Qtx ${PROJECT_SOURCE_DIR}/src/SUIT ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} qtx suit) +SET(_link_LIBRARIES ${_QT_LIBRARIES} qtx suit) # --- headers --- @@ -75,7 +83,11 @@ SET(_other_RESOURCES # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES @@ -94,6 +106,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/ResExporter/CMakeLists.txt b/src/ResExporter/CMakeLists.txt index 70e072215..e4d12ae40 100755 --- a/src/ResExporter/CMakeLists.txt +++ b/src/ResExporter/CMakeLists.txt @@ -18,20 +18,29 @@ # # --- options --- +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/src/Qtx ${PROJECT_SOURCE_DIR}/src/SUIT ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} qtx suit) +SET(_link_LIBRARIES ${_QT_LIBRARIES} qtx suit) # --- rules --- diff --git a/src/SALOME_PY/CMakeLists.txt b/src/SALOME_PY/CMakeLists.txt index 31abe4b6e..bb4beb27f 100755 --- a/src/SALOME_PY/CMakeLists.txt +++ b/src/SALOME_PY/CMakeLists.txt @@ -20,11 +20,20 @@ INCLUDE(${VTK_USE_FILE}) # --- options --- +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # additional include directories INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PYTHON_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/src/CAM ${PROJECT_SOURCE_DIR}/src/Event @@ -40,14 +49,14 @@ INCLUDE_DIRECTORIES( # additional preprocessor / compiler flags ADD_DEFINITIONS( ${CAS_DEFINITIONS} - ${QT_DEFINITIONS} + ${_QT_DEFINITIONS} ${PYTHON_DEFINITIONS} ) # libraries to link to SET(_link_LIBRARIES ${PYTHON_LIBRARIES} - ${QT_LIBRARIES} + ${_QT_LIBRARIES} ${OPENGL_LIBRARIES} ${VTK_LIBRARIES} LightApp diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/CMakeLists.txt b/src/SALOME_PYQT/SALOME_PYQT_GUI/CMakeLists.txt index ca6a50173..8ba03240b 100755 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/CMakeLists.txt +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/CMakeLists.txt @@ -22,11 +22,18 @@ IF(SALOME_USE_VTKVIEWER) ENDIF() # --- options --- +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) +ENDIF() # additional include directories INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} - ${QT_INCLUDES} + ${_QT_INCLUDES} ${SIP_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIR} @@ -44,7 +51,7 @@ INCLUDE_DIRECTORIES( # additional preprocessor / compiler flags ADD_DEFINITIONS( - ${QT_DEFINITIONS} + ${_QT_DEFINITIONS} ${CAS_DEFINITIONS} ${PYTHON_DEFINITIONS} ${BOOST_DEFINITIONS} @@ -75,7 +82,11 @@ SET(SalomePyQtGUI_HEADERS ${_moc_HEADERS} ${_other_HEADERS}) # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # 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..b6a9f4cfc 100755 --- a/src/SALOME_PYQT/SALOME_PYQT_GUILight/CMakeLists.txt +++ b/src/SALOME_PYQT/SALOME_PYQT_GUILight/CMakeLists.txt @@ -17,17 +17,24 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UsePyQt4) +INCLUDE(UsePyQt) IF(SALOME_USE_VTKVIEWER) INCLUDE(${VTK_USE_FILE}) ENDIF() # --- options --- +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) +ENDIF() # additional include directories INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} - ${QT_INCLUDES} + ${_QT_INCLUDES} ${SIP_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIR} @@ -48,7 +55,7 @@ INCLUDE_DIRECTORIES( # additional preprocessor / compiler flags ADD_DEFINITIONS( - ${QT_DEFINITIONS} + ${_QT_DEFINITIONS} ${CAS_DEFINITIONS} ${PYTHON_DEFINITIONS} ) @@ -91,10 +98,14 @@ SET(_sip_files SALOME_PYQT_GUILight.sip) # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # 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..d2bfb2253 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,7 @@ %Module SalomePyQtGUILight -%Import QtGuimod.sip +%Import QtGui/QtGuimod.sip +%Import QtCore/QtCoremod.sip +%Import QtWidgets/QtWidgetsmod.sip %Import QtXmlmod.sip diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_PyModule.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_PyModule.cxx index 9141c339a..9c2d6d5e1 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_PyModule.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_PyModule.cxx @@ -429,7 +429,7 @@ void PyModuleHelper::XmlHandler::createMenu( QDomNode& parentNode, icon, // icon label, // menu text tooltip, // status-bar text - QKeySequence( accel ), // keyboard accelerator + QKeySequence( accel )[0], // keyboard accelerator module(), // action owner toggle ); // toogled action myHelper->connectAction( action ); @@ -503,7 +503,7 @@ void PyModuleHelper::XmlHandler::createToolBar( QDomNode& parentNode ) icon, // icon label, // menu text tooltip, // status-bar text - QKeySequence( accel ), // keyboard accelerator + QKeySequence( accel )[0], // keyboard accelerator module(), // action owner toggle ); // toogled action myHelper->connectAction( action ); @@ -558,7 +558,7 @@ void PyModuleHelper::XmlHandler::insertPopupItems( QDomNode& parentNode, QMenu* icon, // icon label, // menu text tooltip, // status-bar text - QKeySequence( accel ), // keyboard accelerator + QKeySequence( accel )[0], // keyboard accelerator module(), // action owner toggle ); // toogled action myHelper->connectAction( action ); diff --git a/src/SALOME_PYQT/SalomePyQt/CMakeLists.txt b/src/SALOME_PYQT/SalomePyQt/CMakeLists.txt index e77ddf6ae..a97afd43f 100755 --- a/src/SALOME_PYQT/SalomePyQt/CMakeLists.txt +++ b/src/SALOME_PYQT/SalomePyQt/CMakeLists.txt @@ -17,17 +17,24 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UsePyQt4) +INCLUDE(UsePyQt) IF(SALOME_USE_VTKVIEWER) INCLUDE(${VTK_USE_FILE}) ENDIF() # --- options --- +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) +ENDIF() # additional include directories INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} - ${QT_INCLUDES} + ${_QT_INCLUDES} ${QWT_INCLUDE_DIR} ${SIP_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} @@ -72,7 +79,7 @@ ENDIF(SALOME_LIGHT_ONLY) # additional preprocessor / compiler flags ADD_DEFINITIONS( ${QWT_DEFINITIONS} - ${QT_DEFINITIONS} + ${_QT_DEFINITIONS} ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS} ${PYTHON_DEFINITIONS} @@ -104,10 +111,14 @@ ENDIF(SALOME_USE_PLOT2DVIEWER) # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # 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..414b23bda 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip @@ -28,7 +28,9 @@ %Feature ENABLE_CORBA %Feature ENABLE_PLOT2D -%Import QtGuimod.sip +%Import QtGui/QtGuimod.sip +%Import QtCore/QtCoremod.sip +%Import QtWidgets/QtWidgetsmod.sip %Import QtXmlmod.sip %If (ENABLE_PLOT2D) diff --git a/src/SALOME_SWIG/CMakeLists.txt b/src/SALOME_SWIG/CMakeLists.txt index 0f4f3e410..3fc03007e 100755 --- a/src/SALOME_SWIG/CMakeLists.txt +++ b/src/SALOME_SWIG/CMakeLists.txt @@ -23,12 +23,19 @@ IF(SALOME_USE_VTKVIEWER) ENDIF() # --- options --- +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) +ENDIF() # additional include directories INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_DIRS} ${CAS_INCLUDE_DIRS} - ${QT_INCLUDES} + ${_QT_INCLUDES} ${QWT_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/src/CAM @@ -53,7 +60,7 @@ SET_SOURCE_FILES_PROPERTIES(libSALOME_Swig.i PROPERTIES SWIG_DEFINITIONS "-shado SET_SOURCE_FILES_PROPERTIES(libSALOME_SwigPYTHON_wrap.cxx PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H") # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS} ${QWT_DEFINITIONS} ${CAS_DEFINITIONS} ${PYTHON_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS} ${QWT_DEFINITIONS} ${CAS_DEFINITIONS} ${PYTHON_DEFINITIONS}) # --- headers --- diff --git a/src/SOCC/CMakeLists.txt b/src/SOCC/CMakeLists.txt index e68bc32b8..3d5af9598 100755 --- a/src/SOCC/CMakeLists.txt +++ b/src/SOCC/CMakeLists.txt @@ -17,14 +17,21 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - # --- options --- +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # additional include directories INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PROJECT_SOURCE_DIR}/src/Qtx ${PROJECT_SOURCE_DIR}/src/SUIT ${PROJECT_SOURCE_DIR}/src/OBJECT @@ -34,11 +41,11 @@ INCLUDE_DIRECTORIES( ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${OGL_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS} ${CAS_DEFINITIONS} ${OGL_DEFINITIONS}) # libraries to link to SET(_link_LIBRARIES - ${QT_LIBRARIES} ${CAS_KERNEL} ${CAS_VIEWER} + ${_QT_LIBRARIES} ${CAS_KERNEL} ${CAS_VIEWER} qtx suit SalomeObject SalomePrs OCCViewer ) @@ -62,7 +69,11 @@ SET(SOCC_HEADERS ${_moc_HEADERS} ${_other_HEADERS}) # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES diff --git a/src/SPlot2d/CMakeLists.txt b/src/SPlot2d/CMakeLists.txt index cc3c6f753..57c711b1b 100755 --- a/src/SPlot2d/CMakeLists.txt +++ b/src/SPlot2d/CMakeLists.txt @@ -17,14 +17,21 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - # --- options --- +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # additional include directories INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} - ${QT_INCLUDES} + ${_QT_INCLUDES} ${QWT_INCLUDE_DIR} ${PROJECT_SOURCE_DIR}/src/Qtx ${PROJECT_SOURCE_DIR}/src/SUIT @@ -34,10 +41,10 @@ INCLUDE_DIRECTORIES( ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS} ${QWT_DEFINITIONS} ${CAS_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS} ${QWT_DEFINITIONS} ${CAS_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} ${QWT_LIBRARY} qtx suit Plot2d SalomePrs SalomeObject) +SET(_link_LIBRARIES ${_QT_LIBRARIES} ${QWT_LIBRARY} qtx suit Plot2d SalomePrs SalomeObject) # --- headers --- @@ -61,7 +68,11 @@ SET(SPlot2d_HEADERS ${_moc_HEADERS} ${_other_HEADERS}) # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES diff --git a/src/STD/CMakeLists.txt b/src/STD/CMakeLists.txt index 4531c7792..dd93c39c1 100755 --- a/src/STD/CMakeLists.txt +++ b/src/STD/CMakeLists.txt @@ -17,22 +17,30 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PROJECT_SOURCE_DIR}/src/Qtx ${PROJECT_SOURCE_DIR}/src/SUIT ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} qtx suit) +SET(_link_LIBRARIES ${_QT_LIBRARIES} qtx suit) # --- headers --- @@ -84,7 +92,11 @@ SET(_other_RESOURCES # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES @@ -104,6 +116,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..4dc02ba1f 100755 --- a/src/STD/STD_MDIDesktop.cxx +++ b/src/STD/STD_MDIDesktop.cxx @@ -73,7 +73,7 @@ SUIT_ViewWindow* STD_MDIDesktop::activeWindow() const { SUIT_ViewWindow* wnd = 0; - QWidget* wid = myWorkspace->activeWindow(); + QWidget* wid = (QWidget*)myWorkspace->activeSubWindow(); if ( wid && wid->inherits( "SUIT_ViewWindow" ) ) wnd = (SUIT_ViewWindow*)wid; @@ -87,10 +87,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( (QWidget*)(*it) ); if ( vw ) winList.append( vw ); } @@ -106,7 +106,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..e51235f05 100644 --- a/src/SUIT/CMakeLists.txt +++ b/src/SUIT/CMakeLists.txt @@ -17,25 +17,33 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PROJECT_SOURCE_DIR}/src/Qtx ${PROJECT_SOURCE_DIR}/src/ObjBrowser ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS}) IF(ENABLE_TESTRECORDER) ADD_DEFINITIONS("-DENABLE_TESTRECORDER ${TESTRECORDER_DEFINITIONS}") ENDIF() # libraries to link to -SET(_link_LIBRARIES ${PLATFORM_LIBS} ${QT_LIBRARIES} qtx ObjBrowser) +SET(_link_LIBRARIES ${PLATFORM_LIBS} ${_QT_LIBRARIES} qtx ObjBrowser) IF(ENABLE_TESTRECORDER) LIST(APPEND _link_LIBRARIES ${TESTRECORDER_LIBS}) ENDIF() @@ -107,7 +115,11 @@ SET(_other_RESOURCES # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES @@ -154,7 +166,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..fd9ab2e9c 100644 --- a/src/SUIT/SUIT_ActionOperation.cxx +++ b/src/SUIT/SUIT_ActionOperation.cxx @@ -57,7 +57,7 @@ void SUIT_ActionOperation::setAction( const QString& text, const QIcon& icon, const QString& menuText, QKeySequence accel, QObject* parent, bool toggle ) { - setAction( new QtxAction( text, icon, menuText, accel, parent, toggle ) ); + setAction( new QtxAction( text, icon, menuText, accel[0], parent, toggle ) ); } /*!Set action. @@ -66,7 +66,7 @@ void SUIT_ActionOperation::setAction( const QString& text, const QIcon& icon, void SUIT_ActionOperation::setAction( const QString& text, const QString& menuText, QKeySequence accel, QObject* parent, bool toggle ) { - setAction( new QtxAction( text, menuText, accel, parent, toggle ) ); + setAction( new QtxAction( text, menuText, accel[0], parent, toggle ) ); } /*!Set action. 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..eec0f3f9c 100755 --- a/src/SUIT/SUIT_FileDlg.cxx +++ b/src/SUIT/SUIT_FileDlg.cxx @@ -131,8 +131,8 @@ SUIT_FileDlg::SUIT_FileDlg( QWidget* parent, bool open, bool showQuickDir, bool setWindowIcon( parent->windowIcon() ); // GDD - myUrls.insert(0,QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::ApplicationsLocation))); - myUrls.insert(0,QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::HomeLocation))); + myUrls.insert(0,QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation))); + myUrls.insert(0,QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::HomeLocation))); setSidebarUrls(myUrls); // add quick directories widgets @@ -518,7 +518,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 +529,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 +599,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 +768,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 +875,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_LicenseDlg.cxx b/src/SUIT/SUIT_LicenseDlg.cxx index e2c15f54e..5f6ededea 100755 --- a/src/SUIT/SUIT_LicenseDlg.cxx +++ b/src/SUIT/SUIT_LicenseDlg.cxx @@ -25,7 +25,7 @@ #include #include #include -#include +#include //#include #include #include 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..01b19f183 100755 --- a/src/SUIT/SUIT_TreeModel.cxx +++ b/src/SUIT/SUIT_TreeModel.cxx @@ -515,7 +515,7 @@ void SUIT_TreeModel::registerColumn( const int group_id, const QString& name, co int n = myColumns.size(); myColumns.resize( n+1 ); myColumns[n] = inf; - reset(); + //reset(); } } @@ -537,7 +537,7 @@ void SUIT_TreeModel::unregisterColumn( const int group_id, const QString& name ) myColumns[i].myIds.remove( group_id ); if ( myColumns[i].myIds.isEmpty() ) { myColumns.remove( i ); - reset(); + //reset(); } break; } @@ -766,7 +766,7 @@ void SUIT_TreeModel::setRoot( SUIT_DataObject* r ) myRoot = r; //initialize(); - reset(); + //reset(); 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..0ae4ed585 100755 --- a/src/SUITApp/CMakeLists.txt +++ b/src/SUITApp/CMakeLists.txt @@ -17,13 +17,21 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT__INCLUDES} ${PYTHON_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIR} ${PROJECT_BINARY_DIR} @@ -33,13 +41,13 @@ INCLUDE_DIRECTORIES( ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS} ${PYTHON_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS} ${PYTHON_DEFINITIONS}) IF(ENABLE_TESTRECORDER) ADD_DEFINITIONS("-DENABLE_TESTRECORDER ${TESTRECORDER_DEFINITIONS}") ENDIF() # libraries to link to -SET(_link_LIBRARIES ${PLATFORM_LIBS} ${QT_LIBRARIES} qtx suit SalomeStyle) +SET(_link_LIBRARIES ${PLATFORM_LIBS} ${_QT_LIBRARIES} qtx suit SalomeStyle) IF(SALOME_USE_PYCONSOLE) LIST(APPEND _link_LIBRARIES ${PYTHON_LIBRARIES}) ENDIF() @@ -80,7 +88,11 @@ SET(_ts_RESOURCES # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES @@ -105,4 +117,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 9b260f801..1e5edf1c1 100644 --- a/src/SUITApp/SUITApp.cxx +++ b/src/SUITApp/SUITApp.cxx @@ -187,9 +187,9 @@ int main( int argc, char* argv[] ) //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 ) { + /*if(remote.length() > 0 || client.length() > 0 ) { QApplication::setGraphicsSystem(QLatin1String("native")); - } + }*/ SUITApp_Application app( argc, argv ); QString cfgAppName = getAppName( argList.isEmpty() ? QString() : argList.first() ); diff --git a/src/SUITApp/SUITApp_Application.cxx b/src/SUITApp/SUITApp_Application.cxx index 9850d927e..817d49884 100644 --- a/src/SUITApp/SUITApp_Application.cxx +++ b/src/SUITApp/SUITApp_Application.cxx @@ -43,13 +43,13 @@ SUITApp_Application::SUITApp_Application( int& argc, char** argv, SUIT_Exception #ifdef ENABLE_TESTRECORDER : TestApplication( argc, argv ), #else -#ifndef WIN32 +//#ifndef WIN32 // 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() ), -#else + // : QApplication( (Display*)Qtx::getDisplay(), argc, argv, Qtx::getVisual() ), +//#else : QApplication( argc, argv ), -#endif +//#endif #endif myExceptHandler( hand ) { @@ -58,7 +58,7 @@ myExceptHandler( hand ) /*! Constructor */ -SUITApp_Application::SUITApp_Application( int& argc, char** argv, Type type, SUIT_ExceptionHandler* hand ) +/*SUITApp_Application::SUITApp_Application( int& argc, char** argv, Type type, SUIT_ExceptionHandler* hand ) #ifdef ENABLE_TESTRECORDER : TestApplication( argc, argv ), #else @@ -67,7 +67,7 @@ SUITApp_Application::SUITApp_Application( int& argc, char** argv, Type type, SUI myExceptHandler( hand ) { } - +*/ /*! 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..73cf2077f 100644 --- a/src/SUITApp/SUITApp_Application.h +++ b/src/SUITApp/SUITApp_Application.h @@ -51,7 +51,7 @@ class SUIT_ExceptionHandler; public: SUITApp_Application( int& argc, char** argv, SUIT_ExceptionHandler* = 0 ); - SUITApp_Application( int& argc, char** argv, Type type, SUIT_ExceptionHandler* = 0 ); + //SUITApp_Application( int& argc, char** argv, Type type, SUIT_ExceptionHandler* = 0 ); virtual bool notify( QObject* receiver, QEvent* e ); diff --git a/src/SVTK/CMakeLists.txt b/src/SVTK/CMakeLists.txt index 53a802ae3..804dfc5f9 100755 --- a/src/SVTK/CMakeLists.txt +++ b/src/SVTK/CMakeLists.txt @@ -17,15 +17,24 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) +INCLUDE(UseQtExt) INCLUDE(${VTK_USE_FILE}) # --- options --- +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES} ${Qt5X11Extras_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS} ${Qt5X11Extras_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5X11Extras_LIBRARIES}) +ENDIF() # additional include directories INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} - ${QT_INCLUDES} + ${_QT_INCLUDES} ${Boost_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIR} ${PROJECT_SOURCE_DIR}/src/Qtx @@ -38,13 +47,13 @@ INCLUDE_DIRECTORIES( ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS}) +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 +157,11 @@ SET(_other_RESOURCES # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS} ${_moc_internal_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS} ${_moc_internal_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS} ${_moc_internal_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES @@ -196,7 +209,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..61258a22e 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.cxx +++ b/src/SVTK/SVTK_RenderWindowInteractor.cxx @@ -439,24 +439,24 @@ QVTK_RenderWindowInteractor #endif } - +/* #ifdef WIN32 /*! To handle native Win32 events (from such devices as SpaceMouse) */ -bool QVTK_RenderWindowInteractor::winEvent( MSG* msg, long* result ) +/*bool QVTK_RenderWindowInteractor::winEvent( MSG* msg, long* result ) { // TODO: Implement event handling for SpaceMouse return QWidget::winEvent( msg, result); } #else - +*/ /*! To handle native X11 events (from such devices as SpaceMouse) */ -bool +/*bool QVTK_RenderWindowInteractor ::x11Event( XEvent *xEvent ) { @@ -485,8 +485,7 @@ QVTK_RenderWindowInteractor return QWidget::x11Event( xEvent ); } -#endif - +#endif */ /*! Constructor */ diff --git a/src/SVTK/SVTK_RenderWindowInteractor.h b/src/SVTK/SVTK_RenderWindowInteractor.h index b66ca9d4a..4e4e64e32 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.h +++ b/src/SVTK/SVTK_RenderWindowInteractor.h @@ -121,13 +121,12 @@ class SVTK_EXPORT QVTK_RenderWindowInteractor: public QWidget virtual void focusInEvent( QFocusEvent* ); virtual void focusOutEvent( QFocusEvent* ); - //! To handle native events (from such devices as SpaceMouse) +/* //! To handle native events (from such devices as SpaceMouse) #ifdef WIN32 virtual bool winEvent( MSG*, long* ); #else virtual bool x11Event( XEvent *e ); -#endif - +#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_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..d4881fd4e 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() @@ -32,7 +32,7 @@ ENDIF() # additional include directories INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} - ${QT_INCLUDES} + ${_QT_INCLUDES} ${QWT_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIR} @@ -63,7 +63,7 @@ ENDIF() # additional preprocessor / compiler flags ADD_DEFINITIONS( - ${QT_DEFINITIONS} + ${_QT_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${QWT_DEFINITIONS} ${CAS_DEFINITIONS} @@ -77,7 +77,7 @@ ENDIF() # libraries to link to SET(_link_LIBRARIES ${CAS_KERNEL} - ${QT_LIBRARIES} + ${_QT_LIBRARIES} ${PYTHON_LIBRARIES} ${KERNEL_OpUtil} ${KERNEL_SALOMELocalTrace} ${KERNEL_SalomeDSClient} ${KERNEL_TOOLSDS} CASCatch suit std CAM ObjBrowser SalomePrs Event @@ -184,7 +184,11 @@ SET(_other_RESOURCES # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES @@ -235,7 +239,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 b7db9089f..d67b2652a 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -84,6 +84,7 @@ #include #include +#include #include #include #include @@ -187,9 +188,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(); @@ -198,7 +199,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) { @@ -874,7 +875,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 ); @@ -1294,7 +1295,13 @@ void SalomeApp_Application::moduleActionSelected( const int id ) CORBA::ORB_var SalomeApp_Application::orb() { ORB_INIT& init = *SINGLETON_::Instance(); - static CORBA::ORB_var _orb = init( qApp->argc(), qApp->argv() ); + int size = qApp->arguments().size(); + char* argv[size]; + for ( int i = 0; i < size; ++i) + { + argv[i] = qApp->arguments()[i].toLatin1().data(); + } + static CORBA::ORB_var _orb = init( size, argv ); return _orb; } diff --git a/src/SalomeApp/SalomeApp_Engine_i.cxx b/src/SalomeApp/SalomeApp_Engine_i.cxx index 9b58f1e36..ee4b8c4b3 100644 --- a/src/SalomeApp/SalomeApp_Engine_i.cxx +++ b/src/SalomeApp/SalomeApp_Engine_i.cxx @@ -305,7 +305,13 @@ 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() ); + int size = qApp->arguments().size(); + char* argv[size]; + for ( int i = 0; i < size; ++i) + { + argv[i] = qApp->arguments()[i].toLatin1().data(); + } + static CORBA::ORB_var _orb = init( size, argv ); return _orb; } diff --git a/src/SalomeApp/SalomeApp_ListView.cxx b/src/SalomeApp/SalomeApp_ListView.cxx index 95e970b41..f02808298 100644 --- a/src/SalomeApp/SalomeApp_ListView.cxx +++ b/src/SalomeApp/SalomeApp_ListView.cxx @@ -84,7 +84,7 @@ SalomeApp_ListView::SalomeApp_ListView( QWidget* parent ) setRootIsDecorated(false); setAllColumnsShowFocus(false); // header()->setClickEnabled(false); - header()->setMovable(false); + header()->setSectionsMovable(false); myEditedItem = 0; myEdit = 0; diff --git a/src/SalomeApp/SalomeApp_StudyPropertiesDlg.cxx b/src/SalomeApp/SalomeApp_StudyPropertiesDlg.cxx index 8c5e8db03..d30e3be5e 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..b77a3478d 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 PyQt5 pyuic tool, see UsePyQt5.cmake SET(_plugins_SCRIPTS minmax_dialog.py minmax_plugin.py diff --git a/src/SalomeApp/pluginsdemo/minmax_dialog.py b/src/SalomeApp/pluginsdemo/minmax_dialog.py index b5c5db667..832000efe 100644 --- a/src/SalomeApp/pluginsdemo/minmax_dialog.py +++ b/src/SalomeApp/pluginsdemo/minmax_dialog.py @@ -21,11 +21,11 @@ # Form implementation generated from reading ui file 'minmax.ui' # # Created: Thu Mar 1 15:23:57 2012 -# by: PyQt4 UI code generator 4.8.1 +# by: PyQt5 UI code generator 5.5.0 # # WARNING! All changes made in this file will be lost! -from PyQt4 import QtCore, QtGui +from PyQt5 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 diff --git a/src/SalomeApp/pluginsdemo/minmax_plugin.py b/src/SalomeApp/pluginsdemo/minmax_plugin.py index adc759426..80d84ccb0 100644 --- a/src/SalomeApp/pluginsdemo/minmax_plugin.py +++ b/src/SalomeApp/pluginsdemo/minmax_plugin.py @@ -25,10 +25,10 @@ def minmax(context): studyId = context.studyId sg = context.sg - from PyQt4.QtGui import QDialog - from PyQt4.QtGui import QMessageBox - from PyQt4.QtCore import Qt - from PyQt4.QtCore import SIGNAL + from PyQt5.QtGui import QDialog + from PyQt5.QtGui import QMessageBox + from PyQt5.QtCore import Qt + from PyQt5.QtCore import SIGNAL from minmax_dialog import Ui_Dialog diff --git a/src/SalomeApp/pluginsdemo/tubedialog.py b/src/SalomeApp/pluginsdemo/tubedialog.py index 9d1e8f5cb..0b63b2583 100644 --- a/src/SalomeApp/pluginsdemo/tubedialog.py +++ b/src/SalomeApp/pluginsdemo/tubedialog.py @@ -19,8 +19,8 @@ # Author : Guillaume Boulant (EDF) import sys -from PyQt4 import QtGui -from PyQt4 import QtCore +from PyQt5 import QtGui +from PyQt5 import QtCore from tubedialog_ui import TubeDialog_UI diff --git a/src/SalomeApp/pluginsdemo/tubedialog_ui.py b/src/SalomeApp/pluginsdemo/tubedialog_ui.py index 571e6c992..98e9563b2 100644 --- a/src/SalomeApp/pluginsdemo/tubedialog_ui.py +++ b/src/SalomeApp/pluginsdemo/tubedialog_ui.py @@ -20,8 +20,8 @@ # Author : Guillaume Boulant (EDF) import sys -from PyQt4 import QtGui -from PyQt4 import QtCore +from PyQt5 import QtGui +from PyQt5 import QtCore class TubeDialog_UI(QtGui.QDialog): diff --git a/src/SalomeApp/salome_pluginsmanager.py b/src/SalomeApp/salome_pluginsmanager.py index 10bf174fd..79da22b02 100644 --- a/src/SalomeApp/salome_pluginsmanager.py +++ b/src/SalomeApp/salome_pluginsmanager.py @@ -44,7 +44,7 @@ name salome_plugins.py (example follows):: import salome_pluginsmanager def about(context): - from PyQt4.QtGui import QMessageBox + from PyQt5.QtGui import QMessageBox QMessageBox.about(None, "About SALOME pluginmanager", "SALOME plugins manager in SALOME virtual application ") salome_pluginsmanager.AddFunction('About plugins','About SALOME pluginmanager',about) @@ -84,8 +84,8 @@ context attributes: """ import os,sys,traceback -from PyQt4 import QtGui -from PyQt4 import QtCore +from PyQt5 import QtGui +from PyQt5 import QtCore import salome diff --git a/src/Session/CMakeLists.txt b/src/Session/CMakeLists.txt index 4dec09b30..0172a793d 100755 --- a/src/Session/CMakeLists.txt +++ b/src/Session/CMakeLists.txt @@ -18,10 +18,19 @@ # # --- options --- +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5X11Extras_LIBRARIES}) +ENDIF() # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} ${CAS_INCLUDE_DIRS} @@ -43,7 +52,7 @@ INCLUDE_DIRECTORIES( # additional preprocessor / compiler flags ADD_DEFINITIONS( - ${QT_DEFINITIONS} + ${_QT_DEFINITIONS} ${BOOST_DEFINITIONS} ${PYTHON_DEFINITIONS} ${CAS_DEFINITIONS} @@ -55,7 +64,7 @@ ENDIF() # libraries to link to SET(_link_LIBRARIES - ${QT_LIBRARIES} + ${_QT_LIBRARIES} ${CAS_KERNEL} ${OMNIORB_LIBRARIES} ${KERNEL_SalomeNS} diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index 7bbb7b274..5f09b3615 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -98,7 +98,7 @@ * - get session state */ -void MessageOutput( QtMsgType type, const char* msg ) +void MessageOutput( QtMsgType type, const QMessageLogContext &context, const QString &msg ) { switch ( type ) { @@ -106,10 +106,10 @@ void MessageOutput( QtMsgType type, const char* msg ) //MESSAGE( "Debug: " << msg ); break; case QtWarningMsg: - MESSAGE( "Warning: " << msg ); + MESSAGE( "Warning: " << msg.toLatin1().data() ); break; case QtFatalMsg: - MESSAGE( "Fatal: " << msg ); + MESSAGE( "Fatal: " << msg.toLatin1().data() ); break; } } @@ -251,13 +251,13 @@ public: SALOME_QApplication( int& argc, char** argv ) : TestApplication( argc, argv ), myHandler ( 0 ) {} #else SALOME_QApplication( int& argc, char** argv ) -#ifndef WIN32 +//#ifndef WIN32 // 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() ), -#else +// : QApplication( (Display*)Qtx::getDisplay(), argc, argv, Qtx::getVisual() ), +//#else : QApplication( argc, argv ), -#endif +//#endif myHandler ( 0 ) {} #endif @@ -341,14 +341,14 @@ void shutdownServers( SALOME_NamingService* theNS ) int main( int argc, char **argv ) { // Install Qt debug messages handler - qInstallMsgHandler( MessageOutput ); + qInstallMessageHandler( MessageOutput ); //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 ) { + /*if(remote.length() > 0 || client.length() > 0 ) { QApplication::setGraphicsSystem(QLatin1String("native")); - } + }*/ // add $QTDIR/plugins to the pluins search path for image plugins QString qtdir = qgetenv( "QT_ROOT_DIR" ); @@ -379,7 +379,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 ); diff --git a/src/Session/Session_ServerCheck.cxx b/src/Session/Session_ServerCheck.cxx index 3f0fc2954..6ced17569 100644 --- a/src/Session/Session_ServerCheck.cxx +++ b/src/Session/Session_ServerCheck.cxx @@ -252,8 +252,12 @@ void Session_ServerCheck::run() // start check servers int current = 0; QString error; - int argc = QApplication::instance()->argc(); - char** argv = QApplication::instance()->argv(); + int argc = QApplication::instance()->arguments().size(); + char* argv[argc]; + for ( int i = 0; i < argc; ++i) + { + argv[i] = QApplication::instance()->arguments()[i].toLatin1().data(); + } // 1. Check naming service for ( int i = 0; i < myAttempts; i++ ) { 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..375c62123 100755 --- a/src/Style/CMakeLists.txt +++ b/src/Style/CMakeLists.txt @@ -17,21 +17,29 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES} ${Qt5Network_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PROJECT_SOURCE_DIR}/src/Qtx ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} qtx) +SET(_link_LIBRARIES ${_QT_LIBRARIES} qtx) # --- headers --- @@ -70,12 +78,17 @@ SET(_ts_RESOURCES resources/Style_msg_fr.ts SET(_other_RESOURCES resources/SalomeStyle.xml) # --- sources --- - -# sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) - -# sources / rcc wrappings -QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +IF (NOT SALOME_BUILD_WITH_QT5) + # sources / moc wrappings + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) + # sources / rcc wrappings + QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +ELSE() + # sources / moc wrappings + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) + # sources / rcc wrappings + QT5_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +ENDIF() # sources / static SET(_other_SOURCES @@ -96,6 +109,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..7134bb735 100644 --- a/src/Style/Style_Salome.cxx +++ b/src/Style/Style_Salome.cxx @@ -61,6 +61,7 @@ #include #include +#include #define SHADOW 1 #define LINE_GR_MARGIN 10 @@ -203,7 +204,7 @@ Style_Model* Style_Salome::myModel = 0; Use Style_Salome::apply() static function to set SALOME style to the application. */ Style_Salome::Style_Salome() - : QWindowsStyle() + : QCommonStyle() { // initialize SALOME style resources Q_INIT_RESOURCE( Style ); @@ -323,7 +324,7 @@ Style_Model* Style_Salome::model() */ void Style_Salome::polish ( QApplication* app ) { - QWindowsStyle::polish( app ); + QCommonStyle::polish( app ); if ( checkDebugLevel(1) ) { return; @@ -345,7 +346,7 @@ void Style_Salome::polish ( QApplication* app ) void Style_Salome::polish ( QWidget* w ) { if ( checkDebugLevel(2) ) { - QWindowsStyle::polish( w ); + QCommonStyle::polish( w ); return; } @@ -359,7 +360,7 @@ void Style_Salome::polish ( QWidget* w ) w->setAttribute( Qt::WA_Hover ); } - QWindowsStyle::polish( w ); + QCommonStyle::polish( w ); } /*! @@ -375,7 +376,7 @@ void Style_Salome::polish ( QWidget* w ) void Style_Salome::unpolish( QWidget* w ) { if ( checkDebugLevel(3) ) { - QWindowsStyle::unpolish( w ); + QCommonStyle::unpolish( w ); return; } @@ -389,7 +390,7 @@ void Style_Salome::unpolish( QWidget* w ) w->setAttribute( Qt::WA_Hover, false ); } - QWindowsStyle::unpolish( w ); + QCommonStyle::unpolish( w ); } /*! @@ -403,7 +404,7 @@ void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComp QPainter* p, const QWidget* w ) const { if ( checkDebugLevel(4) ) { - QWindowsStyle::drawComplexControl( cc, opt, p, w ); + QCommonStyle::drawComplexControl( cc, opt, p, w ); return; } @@ -555,7 +556,7 @@ void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComp if ((slider->subControls & SC_SliderGroove) && groove.isValid()) { QStyleOptionSlider tmpSlider = *slider; tmpSlider.subControls = SC_SliderGroove; - QWindowsStyle::drawComplexControl(cc, &tmpSlider, p, w); + QCommonStyle::drawComplexControl(cc, &tmpSlider, p, w); } if (slider->subControls & SC_SliderTickmarks) { QStyleOptionSlider tmpSlider = *slider; @@ -626,7 +627,7 @@ void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComp if (w && ( qobject_cast(w->parentWidget() ) || ( toolbutton->state & State_AutoRaise && !( toolbutton->state & State_MouseOver ) ) ) ) { - QWindowsStyle::drawComplexControl( cc, opt, p, w ); + QCommonStyle::drawComplexControl( cc, opt, p, w ); return; } int aMinDelta = (int)model()->widgetRounding( Style_Model::ButtonRadius ); @@ -708,7 +709,7 @@ void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComp } } case CC_TitleBar: { - QWindowsStyle::drawComplexControl( cc, opt, p, w ); + QCommonStyle::drawComplexControl( cc, opt, p, w ); break; } case CC_GroupBox: @@ -758,11 +759,11 @@ void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComp break; } case CC_Dial: { - QWindowsStyle::drawComplexControl( cc, opt, p, w ); + QCommonStyle::drawComplexControl( cc, opt, p, w ); break; } default: - QWindowsStyle::drawComplexControl( cc, opt, p, w ); + QCommonStyle::drawComplexControl( cc, opt, p, w ); } } @@ -777,7 +778,7 @@ void Style_Salome::drawControl( ControlElement ce, const QStyleOption* opt, QPainter* p, const QWidget* w ) const { if ( checkDebugLevel(5) ) { - QWindowsStyle::drawControl( ce, opt, p, w ); + QCommonStyle::drawControl( ce, opt, p, w ); return; } @@ -906,7 +907,7 @@ void Style_Salome::drawControl( ControlElement ce, const QStyleOption* opt, break; } case CE_Splitter: { - QWindowsStyle::drawControl( ce, opt, p, w ); + QCommonStyle::drawControl( ce, opt, p, w ); QRect r = opt->rect; bool horiz = r.width() > r.height(); int aLen = model()->splitHandleLength(); @@ -963,10 +964,10 @@ void Style_Salome::drawControl( ControlElement ce, const QStyleOption* opt, } QStyleOptionTab* copyTab = (QStyleOptionTab*)tab; copyTab->rect = oldRect; - QWindowsStyle::drawControl( ce, copyTab, p, w ); + QCommonStyle::drawControl( ce, copyTab, p, w ); } else - QWindowsStyle::drawControl( ce, opt, p, w ); + QCommonStyle::drawControl( ce, opt, p, w ); break; } case CE_MenuBarItem: @@ -1495,7 +1496,7 @@ void Style_Salome::drawControl( ControlElement ce, const QStyleOption* opt, break; } default: - QWindowsStyle::drawControl( ce, opt, p, w ); + QCommonStyle::drawControl( ce, opt, p, w ); break; } } @@ -1511,7 +1512,7 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt, QPainter* p, const QWidget* w ) const { if ( checkDebugLevel(6) ) { - QWindowsStyle::drawPrimitive( pe, opt, p, w ); + QCommonStyle::drawPrimitive( pe, opt, p, w ); return; } @@ -1551,7 +1552,7 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt, break; } else - QWindowsStyle::drawPrimitive( pe, opt, p, w ); + QCommonStyle::drawPrimitive( pe, opt, p, w ); } break; case PE_FrameFocusRect: { @@ -1567,7 +1568,7 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt, aBrdTopCol, aBrdBotCol, false, false, isHover, true ); } else { - QWindowsStyle::drawPrimitive( pe, opt, p, w ); + QCommonStyle::drawPrimitive( pe, opt, p, w ); } break; } @@ -1642,7 +1643,7 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt, p->setPen(opt->palette.text().color()); } // Fall through! case PE_IndicatorViewItemCheck: - case PE_Q3CheckListIndicator: { + /* case PE_Q3CheckListIndicator: { if (!doRestore) { p->save(); doRestore = true; @@ -1683,7 +1684,7 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt, if (doRestore) p->restore(); break; - } + }*/ case PE_IndicatorRadioButton: { if ( hasHover() && (opt->state & State_Enabled) && (opt->state & State_MouseOver) ) drawHoverRect(p, w->rect(), opt->palette.color( QPalette::Window ), @@ -1831,7 +1832,7 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt, break; } case PE_Widget: { - QWindowsStyle::drawPrimitive( pe, opt, p, w ); + QCommonStyle::drawPrimitive( pe, opt, p, w ); if ( !w ) break; if( w->parent() && !qobject_cast((QWidget*)w) ) @@ -1845,7 +1846,7 @@ 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) { - QWindowsStyle::drawPrimitive( pe, opt, p, w ); + QCommonStyle::drawPrimitive( pe, opt, p, w ); break; } QRect aSelRect = tbb->selectedTabRect; @@ -1961,11 +1962,11 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt, aPal.setBrush( QPalette::AlternateBase, QBrush( gr_alt ) ); aWdg->setPalette( aPal ); } - QWindowsStyle::drawPrimitive( pe, opt, p, w ); + QCommonStyle::drawPrimitive( pe, opt, p, w ); break; } default: - QWindowsStyle::drawPrimitive( pe, opt, p, w ); + QCommonStyle::drawPrimitive( pe, opt, p, w ); } } @@ -1980,10 +1981,10 @@ int Style_Salome::pixelMetric( PixelMetric metric, const QStyleOption* opt, const QWidget* w ) const { if ( checkDebugLevel(7) ) { - return QWindowsStyle::pixelMetric( metric, opt, w ); + return QCommonStyle::pixelMetric( metric, opt, w ); } - int aRes = QWindowsStyle::pixelMetric( metric, opt, w ); + int aRes = QCommonStyle::pixelMetric( metric, opt, w ); switch( metric ) { case PM_SliderLength: { aRes += (int)((double)model()->sliderSize()/2); @@ -2020,10 +2021,10 @@ QSize Style_Salome::sizeFromContents( ContentsType ct, const QStyleOption* opt, const QSize& contentsSize, const QWidget* w ) const { if ( checkDebugLevel(8) ) { - return QWindowsStyle::sizeFromContents( ct, opt,contentsSize, w ); + return QCommonStyle::sizeFromContents( ct, opt,contentsSize, w ); } - QSize sz = QWindowsStyle::sizeFromContents( ct, opt, contentsSize, w ); + QSize sz = QCommonStyle::sizeFromContents( ct, opt, contentsSize, w ); switch (ct) { case CT_TabBarTab: if (const QStyleOptionTab *tab = qstyleoption_cast(opt)) { @@ -2052,7 +2053,7 @@ 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 - QRect old_arrow = QWindowsStyle::subControlRect( CC_ComboBox, cmb, + QRect old_arrow = QCommonStyle::subControlRect( CC_ComboBox, cmb, SC_ComboBoxArrow, w ); int aDelta = res.height() - old_arrow.width(); // right value if ( cmb->editable ) @@ -2077,7 +2078,7 @@ QPixmap Style_Salome::standardPixmap(StandardPixmap stPixmap, const QStyleOption const QWidget *w) const { if ( checkDebugLevel(9) ) { - return QWindowsStyle::standardPixmap( stPixmap, opt, w ); + return QCommonStyle::standardPixmap( stPixmap, opt, w ); } switch ( stPixmap ) @@ -2092,7 +2093,7 @@ QPixmap Style_Salome::standardPixmap(StandardPixmap stPixmap, const QStyleOption case SP_TitleBarMinButton: return QPixmap( minimize_xpm ); default: - return QWindowsStyle::standardPixmap( stPixmap, opt, w ); + return QCommonStyle::standardPixmap( stPixmap, opt, w ); } } @@ -2108,7 +2109,7 @@ QIcon Style_Salome::standardIconImplementation( StandardPixmap standardIcon, const QWidget* w ) const { if ( checkDebugLevel(10) ) { - return QWindowsStyle::standardIconImplementation( standardIcon, opt, w ); + return QCommonStyle::standardIcon( standardIcon, opt, w ); } switch ( standardIcon ) @@ -2124,7 +2125,7 @@ QIcon Style_Salome::standardIconImplementation( StandardPixmap standardIcon, default: break; } - return QWindowsStyle::standardIconImplementation( standardIcon, opt, w ); + return QCommonStyle::standardIcon( standardIcon, opt, w ); } /*! @@ -2140,10 +2141,10 @@ int Style_Salome::styleHint( StyleHint hint, const QStyleOption* opt, const QWid QStyleHintReturn* returnData ) const { if ( checkDebugLevel(11) ) { - return QWindowsStyle::styleHint( hint, opt, w, returnData ); + return QCommonStyle::styleHint( hint, opt, w, returnData ); } - int aRes = QWindowsStyle::styleHint( hint, opt, w, returnData ); + int aRes = QCommonStyle::styleHint( hint, opt, w, returnData ); switch( hint ) { case SH_Table_GridLineColor: { if ( opt ) @@ -2172,15 +2173,15 @@ QRect Style_Salome::subControlRect( ComplexControl cc, const QStyleOptionComplex SubControl sc, const QWidget* wid ) const { if ( checkDebugLevel(12) ) { - return QWindowsStyle::subControlRect( cc, opt, sc, wid ); + return QCommonStyle::subControlRect( cc, opt, sc, wid ); } - QRect res = QWindowsStyle::subControlRect( cc, opt, sc, wid ); + QRect res = QCommonStyle::subControlRect( cc, opt, sc, wid ); switch ( cc ) { case CC_SpinBox: { int x = res.x(), w = res.width(), h = res.height(); if ( sc==SC_SpinBoxUp || sc==SC_SpinBoxDown ) { - QRect frame_r = QWindowsStyle::subControlRect( cc, opt, SC_SpinBoxFrame, wid ); + QRect frame_r = QCommonStyle::subControlRect( cc, opt, SC_SpinBoxFrame, wid ); h = frame_r.height(); res.setX( x+w-h ); res.setWidth( h ); @@ -2216,7 +2217,7 @@ QRect Style_Salome::subControlRect( ComplexControl cc, const QStyleOptionComplex } case CC_ScrollBar: if (const QStyleOptionSlider *scrollbar = qstyleoption_cast(opt)) { - QRect slider_r = QWindowsStyle::subControlRect( cc, opt, SC_ScrollBarSlider, wid ); + QRect slider_r = QCommonStyle::subControlRect( cc, opt, SC_ScrollBarSlider, wid ); 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,15 +2271,15 @@ QRect Style_Salome::subElementRect( SubElement se, const QStyleOption* opt, const QWidget* wid ) const { if ( checkDebugLevel(13) ) { - return QWindowsStyle::subElementRect( se, opt, wid ); + return QCommonStyle::subElementRect( se, opt, wid ); } - QRect res = QWindowsStyle::subElementRect( se, opt, wid ); + QRect res = QCommonStyle::subElementRect( se, opt, wid ); 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: { - QRect old_r = QWindowsStyle::subControlRect( CC_ComboBox, + QRect old_r = QCommonStyle::subControlRect( CC_ComboBox, qstyleoption_cast( opt ), SC_ComboBoxArrow, wid ); int old_w = old_r.width(); diff --git a/src/Style/Style_Salome.h b/src/Style/Style_Salome.h index e81b5bffc..d11a4f6ea 100644 --- a/src/Style/Style_Salome.h +++ b/src/Style/Style_Salome.h @@ -25,7 +25,7 @@ #include "Style.h" -#include +#include class Style_Model; @@ -34,7 +34,7 @@ class QWidget; class QPainter; class QtxResourceMgr; -class STYLE_SALOME_EXPORT Style_Salome : public QWindowsStyle +class STYLE_SALOME_EXPORT Style_Salome : public QCommonStyle { Q_OBJECT diff --git a/src/TOOLSGUI/CMakeLists.txt b/src/TOOLSGUI/CMakeLists.txt index 9fc4d0c5a..b9245e801 100755 --- a/src/TOOLSGUI/CMakeLists.txt +++ b/src/TOOLSGUI/CMakeLists.txt @@ -17,11 +17,11 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) +INCLUDE(UseQtExt) # --- options --- INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${CAS_INCLUDE_DIRS} ${OMNIORB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} @@ -32,7 +32,7 @@ INCLUDE_DIRECTORIES( # additional preprocessor / compiler flags ADD_DEFINITIONS( - ${QT_DEFINITIONS} + ${_QT_DEFINITIONS} ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS} ${OMNIORB_DEFINITIONS} @@ -40,7 +40,7 @@ ADD_DEFINITIONS( # libraries to link to SET(_link_LIBRARIES - ${QT_LIBRARIES} + ${_QT_LIBRARIES} ${CAS_KERNEL} ${KERNEL_SalomeIDLKernel} ${KERNEL_SALOMELocalTrace} @@ -78,7 +78,11 @@ SET(_ts_RESOURCES # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES @@ -97,5 +101,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..32da700d2 100755 --- a/src/TreeData/CMakeLists.txt +++ b/src/TreeData/CMakeLists.txt @@ -19,14 +19,21 @@ ADD_SUBDIRECTORY(Test) -INCLUDE(UseQt4Ext) - # --- options --- +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # additional include directories INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} - ${QT_INCLUDES} + ${_QT_INCLUDES} ${OMNIORB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIR} @@ -43,7 +50,7 @@ INCLUDE_DIRECTORIES( # additional preprocessor / compiler flags ADD_DEFINITIONS( ${CAS_DEFINITIONS} - ${QT_DEFINITIONS} + ${_QT_DEFINITIONS} ${BOOST_DEFINITIONS} ${OMNIORB_DEFINITIONS} ) @@ -51,7 +58,7 @@ ADD_DEFINITIONS( # libraries to link to SET(_link_LIBRARIES ${OMNIORB_LIBRARIES} - ${QT_LIBRARIES} + ${_QT_LIBRARIES} ${KERNEL_SalomeLifeCycleCORBA} ${KERNEL_SalomeKernelHelpers} qtx suit std CAM ObjBrowser LightApp SalomeApp ) @@ -82,7 +89,11 @@ SET(SalomeTreeData_HEADERS ${_moc_HEADERS} ${_other_HEADERS}) # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES diff --git a/src/TreeData/Test/CMakeLists.txt b/src/TreeData/Test/CMakeLists.txt index cb05061e5..1557afeda 100755 --- a/src/TreeData/Test/CMakeLists.txt +++ b/src/TreeData/Test/CMakeLists.txt @@ -17,26 +17,33 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - # --- options --- +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # additional include directories INCLUDE_DIRECTORIES( ${OMNIORB_INCLUDE_DIR} - ${QT_INCLUDES} + ${_QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/src/GuiHelpers ${PROJECT_SOURCE_DIR}/src/TreeData ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${OMNIORB_DEFINITIONS} ${QT_DEFINITIONS}) +ADD_DEFINITIONS(${OMNIORB_DEFINITIONS} ${_QT_DEFINITIONS}) # libraries to link to SET(_link_LIBRARIES ${CORBA_LIBS} - ${QT_LIBRARIES} + ${_QT_LIBRARIES} SalomeTreeData SalomeGuiHelpers ${KERNEL_SalomeLifeCycleCORBA} ${KERNEL_SalomeKernelHelpers} ) @@ -51,14 +58,20 @@ SET(_uic_files mainwindow.ui) # header files / to be processed by moc SET(_moc_HEADERS mainwindow.hxx) -# header files / uic wrappings -QT4_WRAP_UI(_uic_HEADERS ${_uic_files}) +IF (NOT SALOME_BUILD_WITH_QT5) + # header files / uic wrappings + QT4_WRAP_UI(_uic_HEADERS ${_uic_files}) + # sources / moc wrappings + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + # header files / uic wrappings + QT5_WRAP_UI(_uic_HEADERS ${_uic_files}) + # sources / moc wrappings + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # --- sources --- -# sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) - # sources / to compile SET(TreeData_guitester_SOURCES MyDataModel.cxx guitester.cxx mainwindow.cxx testhelper.cxx ${_moc_SOURCES} ${_uic_HEADERS}) SET(TreeData_tester_SOURCES MyDataModel.cxx tester.cxx) 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..75b0f8e51 100755 --- a/src/VTKViewer/CMakeLists.txt +++ b/src/VTKViewer/CMakeLists.txt @@ -17,25 +17,34 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) INCLUDE(${VTK_USE_FILE}) +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PTHREAD_INCLUDE_DIR} ${PROJECT_SOURCE_DIR}/src/Qtx ${PROJECT_SOURCE_DIR}/src/SUIT ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${CAS_DEFINITIONS} ${QT_DEFINITIONS}) +ADD_DEFINITIONS(${CAS_DEFINITIONS} ${_QT_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${VTK_LIBRARIES} ${CAS_KERNEL} qtx suit ${KERNEL_SALOMELocalTrace}) +SET(_link_LIBRARIES ${_QT_LIBRARIES} ${OPENGL_LIBRARIES} ${VTK_LIBRARIES} ${CAS_KERNEL} qtx suit ${KERNEL_SALOMELocalTrace}) # --- headers --- @@ -127,12 +136,17 @@ SET(_other_RESOURCES ) # --- sources --- - -# sources / rcc wrappings -QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) - -# sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + # sources / moc wrappings + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) + # sources / rcc wrappings + QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +ELSE() + # sources / moc wrappings + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) + # sources / rcc wrappings + QT5_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) +ENDIF() # sources / static SET(_other_SOURCES @@ -177,7 +191,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") @@ -187,7 +201,4 @@ FILE(GLOB GUIVTI_DATA "${CMAKE_CURRENT_SOURCE_DIR}/resources/*.vti") 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}) - - - +INSTALL(FILES ${GUITXT_DATA} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA}) \ No newline at end of file diff --git a/src/VTKViewer/VTKViewer_RenderWindow.cxx b/src/VTKViewer/VTKViewer_RenderWindow.cxx index d4dd5f76e..18debd586 100755 --- a/src/VTKViewer/VTKViewer_RenderWindow.cxx +++ b/src/VTKViewer/VTKViewer_RenderWindow.cxx @@ -32,7 +32,7 @@ #include #include #ifndef WIN32 -#include +#include #include //#include //#include 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..4391107a5 100755 --- a/src/ViewerTools/CMakeLists.txt +++ b/src/ViewerTools/CMakeLists.txt @@ -17,21 +17,29 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) - +INCLUDE(UseQtExt) +IF (NOT SALOME_BUILD_WITH_QT5) + SET(_QT_INCLUDES ${QT_INCLUDES}) + SET(_QT_DEFINITIONS ${QT_DEFINITIONS}) + SET(_QT_LIBRARIES ${QT_LIBRARIES}) +ELSE() + SET(_QT_INCLUDES ${Qt5Widgets_INCLUDES}) + SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS}) + SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +ENDIF() # --- options --- # additional include directories INCLUDE_DIRECTORIES( - ${QT_INCLUDES} + ${_QT_INCLUDES} ${PROJECT_SOURCE_DIR}/src/Qtx ) # additional preprocessor / compiler flags -ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(${_QT_DEFINITIONS}) # libraries to link to -SET(_link_LIBRARIES ${QT_LIBRARIES} qtx) +SET(_link_LIBRARIES ${_QT_LIBRARIES} qtx) # --- headers --- @@ -60,7 +68,11 @@ SET(_ts_RESOURCES # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +IF (NOT SALOME_BUILD_WITH_QT5) + QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ELSE() + QT5_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +ENDIF() # sources / static SET(_other_SOURCES @@ -79,4 +91,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..be4da2b34 100755 --- a/tools/dlgfactory/CMakeLists.txt +++ b/tools/dlgfactory/CMakeLists.txt @@ -56,7 +56,7 @@ SET(GenericDialog_FORMS GenericDialog.ui ) -ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(${Qt5Widgets_DEFINITIONS}) ADD_CUSTOM_COMMAND( OUTPUT QDialogTest.cxx QDialogTest.h QDialogTest.ui COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dlgfactory.py -s -n QDialogTest -t qdialog @@ -66,22 +66,22 @@ 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}) +QT5_WRAP_UI(qtester_FORMS_HEADERS ${qtester_FORMS} ) +QT5_WRAP_CPP(qtester_HEADERS_MOC ${qtester_HEADERS}) -QT4_WRAP_UI(gtester_FORMS_HEADERS ${gtester_FORMS} ) -QT4_WRAP_CPP(gtester_HEADERS_MOC ${gtester_HEADERS}) +QT5_WRAP_UI(gtester_FORMS_HEADERS ${gtester_FORMS} ) +QT5_WRAP_CPP(gtester_HEADERS_MOC ${gtester_HEADERS}) -QT4_WRAP_UI(GenericDialog_FORMS_HEADERS ${GenericDialog_FORMS} ) -QT4_WRAP_CPP(GenericDialog_HEADERS_MOC ${GenericDialog_HEADERS}) +QT5_WRAP_UI(GenericDialog_FORMS_HEADERS ${GenericDialog_FORMS} ) +QT5_WRAP_CPP(GenericDialog_HEADERS_MOC ${GenericDialog_HEADERS}) ADD_EXECUTABLE(qtester ${qtester_SOURCES} ${qtester_HEADERS_MOC} ${qtester_FORMS_HEADERS} QDialogTest.cxx ) -TARGET_LINK_LIBRARIES(qtester ${QT_LIBRARIES}) +TARGET_LINK_LIBRARIES(qtester ${Qt5Widgets_LIBRARIES}) ADD_EXECUTABLE(gtester ${gtester_SOURCES} ${gtester_HEADERS_MOC} @@ -90,6 +90,6 @@ ADD_EXECUTABLE(gtester ${gtester_SOURCES} ${GenericDialog_FORMS_HEADERS} GDialogTest.cxx ) -TARGET_LINK_LIBRARIES(gtester ${QT_LIBRARIES}) +TARGET_LINK_LIBRARIES(gtester ${Qt5Widgets_LIBRARIES}) INSTALL(TARGETS qtester gtester DESTINATION ${SALOME_INSTALL_BINS}) -- 2.39.2