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