# 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})
OPTION(SALOME_BUILD_DOC "Generate SALOME GUI documentation" ON)
OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
OPTION(SALOME_GUI_USE_OBSERVERS "Use study observers in GUI (advanced)" ON)
+OPTION(SALOME_BUILD_WITH_QT5 "Build SALOME with Qt 5" ON)
# Advanced options:
CMAKE_DEPENDENT_OPTION(SALOME_LIGHT_ONLY "Build SALOME Light only (no CORBA)" OFF
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)
## 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)
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
# - 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")
# 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")
LIST(APPEND _${PROJECT_NAME}_exposed_targets PVViewer PVServerService)
ENDIF()
-
# Python-based packages specific targets:
IF(SALOME_USE_PYCONSOLE)
LIST(APPEND _${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}")
SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
# Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
-SALOME_CONFIGURE_PREPARE(CAS OpenGL PyQt4 Qt4 Qwt SIP VTK)
+IF(NOT SALOME_BUILD_WITH_QT5)
+ SALOME_CONFIGURE_PREPARE(CAS OpenGL Qt4 PyQt4 Qwt SIP VTK)
+ELSE()
+ SALOME_CONFIGURE_PREPARE(CAS OpenGL Qt5 PyQt5 Qwt SIP VTK)
+ENDIF()
CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
- KERNEL_ROOT_DIR SIP_ROOT_DIR QT4_ROOT_DIR PYQT4_ROOT_DIR CAS_ROOT_DIR
+ KERNEL_ROOT_DIR SIP_ROOT_DIR QT_ROOT_DIR PYQT_ROOT_DIR CAS_ROOT_DIR
OPENGL_ROOT_DIR VTK_ROOT_DIR QWT_ROOT_DIR)
# - in the install tree (VSR 16/08/2013: TEMPORARILY COMMENT THIS - TO REMOVE?):
# ${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
#### 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@)
# 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:
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})
--- /dev/null
+# Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+# - Find PyQt5 installation
+# Sets the following variables:
+# PYQT_PYUIC_EXECUTABLE - path to the pyuic executable
+# PYQT_PYRCC_EXECUTABLE - path to the pyrcc executable
+# PYQT_PYUIC_PATH - command to launch pyuic with the correct PYTHONPATH
+# PYQT_PYRCC_PATH - command to launch pyrcc with the correct PYTHONPATH
+# PYQT_PYTHONPATH - path to the PyQt Python modules
+# PYQT_SIPS_DIR - path to main include directory (which contains several sub folders)
+# PYQT_SIPFLAGS - compilation flags extracted from PyQt
+#
+# The executables
+# pyuic5 (pyuic5.bat)
+# are searched.
+# The Python command
+# pyqtconfig.Configuration().pyqt_sip_flags
+# is called to get the compilation flags.
+# Headers are located by looking for the header file
+# qobject.sip
+
+IF(NOT PyQt5_FIND_QUIETLY)
+ MESSAGE(STATUS "Looking for PyQt5 ...")
+ENDIF()
+
+IF(NOT SIP_FOUND AND NOT PyQt5_FIND_QUIETLY)
+ MESSAGE(WARNING "PyQt5 needs SIP to be detected correctly!")
+ENDIF()
+
+FIND_PROGRAM(PYQT_PYUIC_EXECUTABLE NAMES pyuic5 pyuic5.bat)
+FIND_PROGRAM(PYQT_PYRCC_EXECUTABLE NAMES pyrcc5 pyrcc5.bat)
+
+# Get root dir locally, going up two levels from the exec:
+GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${PYQT_PYUIC_EXECUTABLE}" PATH)
+GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH)
+
+
+# Typical locations of qobject.sip are:
+# - /usr/share/sip/PyQt5/QtCore, for a system install
+# - or <xyz>/sip/QtCore, for a custom install
+# - or <xyz>/share/sip/QtCore, for a custom install
+FIND_FILE(PYQT_SIP_MAIN_FILE qobject.sip PATH_SUFFIXES share/sip/QtCore sip/QtCore share/sip/PyQt5/QtCore)
+
+IF(PYQT_SIP_MAIN_FILE)
+ GET_FILENAME_COMPONENT(PYQT_SIPS_DIR "${PYQT_SIP_MAIN_FILE}" PATH)
+ GET_FILENAME_COMPONENT(PYQT_SIPS_DIR "${PYQT_SIPS_DIR}" PATH)
+ENDIF()
+MARK_AS_ADVANCED(PYQT_SIP_MAIN_FILE)
+
+# Get PyQt compilation flags:
+SET(PYQT_PYTHONPATH ${_tmp_ROOT_DIR}/PyQt5)
+SET(PYQT_SIPFLAGS)
+
+EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import sys;
+sys.path[:0] = '${PYQT_PYTHONPATH}'.split(';');
+sys.path[:0] = '${SIP_PYTHONPATH}'.split(';');
+from PyQt5.QtCore import PYQT_CONFIGURATION;
+sys.stdout.write(PYQT_CONFIGURATION['sip_flags'])"
+ OUTPUT_VARIABLE PYQT_SIPFLAGS)
+SEPARATE_ARGUMENTS(PYQT_SIPFLAGS)
+
+SET(PYQT_SIPFLAGS ${PYQT_SIPFLAGS} -I "${PYQT_SIPS_DIR}")
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PyQt5 REQUIRED_VARS PYQT_PYUIC_EXECUTABLE PYQT_PYRCC_EXECUTABLE PYQT_SIPS_DIR PYQT_SIPFLAGS )
+
+# Wrap the final executables so that they always use the proper environment (PYTHONPATH):
+# The results are put to variables:
+# PYQT_PYUIC_PATH - command to launch pyuic with the correct PYTHONPATH
+# PYQT_PYRCC_PATH - command to launch pyrcc with the correct PYTHONPATH
+# TODO: should be done like Sphinx in KERNEL (i.e. generating a shell script)?
+
+IF(WIN32 AND NOT CYGWIN)
+ SET(PYQT_PYUIC_PATH set PYTHONPATH=${PYQT_PYTHONPATH};${SIP_PYTHONPATH};%PYTHONPATH% && ${PYQT_PYUIC_EXECUTABLE})
+ SET(PYQT_PYRCC_PATH set PYTHONPATH=${PYQT_PYTHONPATH};${SIP_PYTHONPATH};%PYTHONPATH% && ${PYQT_PYRCC_EXECUTABLE})
+ELSE()
+ STRING(REPLACE ";" ":" PYQT_PYTHONPATH "${PYQT_PYTHONPATH}")
+ SET(PYQT_PYUIC_PATH /usr/bin/env PYTHONPATH="${PYQT_PYTHONPATH}:${SIP_PYTHONPATH}:$$PYTHONPATH" ${PYQT_PYUIC_EXECUTABLE})
+ SET(PYQT_PYRCC_PATH /usr/bin/env PYTHONPATH="${PYQT_PYTHONPATH}:${SIP_PYTHONPATH}:$$PYTHONPATH" ${PYQT_PYRCC_EXECUTABLE})
+ENDIF()
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})
--- /dev/null
+# 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()
--- /dev/null
+# 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()
--- /dev/null
+# 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)
+++ /dev/null
-# 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)
+++ /dev/null
-# 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)
--- /dev/null
+# 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)
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
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}")
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 );
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() );
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
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}")
INSTALL(TARGETS DDS EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
INSTALL(FILES ${DDS_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
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})
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
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 );
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;
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
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;
}
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
#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 );
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 );
}
}
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 );
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UsePyQt4)
+INCLUDE(UsePyQt)
# --- resources ---
# --- scripts ---
# scripts / pyuic wrappings
-
-PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files})
+PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files})
# scripts / static
SET(_other_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})
# 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
"""
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
__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
#
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()
__author__="gboulant"
__date__ ="$31 mars 2010 17:09:53$"
-
+from qtsalome import *
from mytestdialog_ui import Ui_MyTestDialog
from genericdialog import 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)
# has been validated so that it can process the event
MyTestDialog.accept(self)
if self.wasOk():
- self.emit(SIGNAL('inputValidated()'))
+ self.inputValidated.emit()
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")
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
# 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
--- /dev/null
+# -*- 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
#
import os
-from PyQt4 import QtGui, QtCore
-from PyQt4.QtCore import Qt
+
+from qtsalome import *
import salome
from salome.kernel.studyedit import getStudyEditor
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):
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)
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
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);
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:
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
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)))
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
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})
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# additional include directories
INCLUDE_DIRECTORIES(
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
# 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
)
# --- 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
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- 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
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})
#include <SALOME_Event.h>
+#ifdef USE_SALOME_STYLE
#include <Style_Salome.h>
#include <Style_PrefDlg.h>
+#endif // USE_SALOME_STYLE
#include <CAM_Module.h>
#include <CAM_DataModel.h>
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() ) );
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)
// 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" ) );
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(){
<!-- Splash screen settings -->
<parameter name="image" value="${GUI_ROOT_DIR}/share/salome/resources/gui/icon_about.png" />
<parameter name="constant_info" value="%A [ %V ]" />
- <parameter name="text_colors" value="#ffffff|#777777" />
+ <parameter name="text_colors" value="#ffffff" />
<parameter name="hide_on_click" value="yes" />
<parameter name="show_progress" value="yes" />
<parameter name="show_message" value="yes" />
<parameter name="show_percents" value="yes" />
- <parameter name="margin" value="50" />
+ <parameter name="margin" value="30" />
<parameter name="progress_width" value="20" />
<parameter name="progress_flags" value="bottom,left_to_right" />
<parameter name="opacity" value="0.85" />
<parameter name="font" value="Tahoma,12,normal" />
<parameter name="alignment" value="top,left" />
- <parameter name="progress_colors" value="#929ca7|#aebac7|v" />
+ <parameter name="progress_colors" value="#ffffff,#ff0000,v" />
</section>
<section name="resources">
<!-- Resource directories (resource manager)-->
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- 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)
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}")
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- 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
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})
//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
#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 );
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 );
}
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() );
*/
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();
}
if ( state == Fin )
{
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QApplication::syncX(); /* force rectangle redrawing */
+#endif
mypViewWindow->activateSketching( OCCViewer_ViewWindow::NoSketching );
}
}
mypPolyRB->clearGeometry();
mypPolyRB->hide();
}
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QApplication::syncX();
+#endif
mypViewWindow->activateSketching( OCCViewer_ViewWindow::NoSketching );
}
}
static QEvent* l_mbPressEvent = 0;
-#ifdef WIN32
-# include <QWindowsStyle>
-#endif
+//#ifdef WIN32
+//# include <QWindowsStyle>
+//#endif
#include <GL/gl.h>
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- 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)
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}")
# 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(
# --- 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
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})
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
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})
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
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}")
# Author : Maxim GLIBIN, Open CASCADE S.A.S. (maxim.glibin@opencascade.com)
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
)
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
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}")
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
# Author : Maxim GLIBIN, Open CASCADE S.A.S. (maxim.glibin@opencascade.com)
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# additional include directories
INCLUDE_DIRECTORIES(
# 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
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}")
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
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}")
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- 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
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}")
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.
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.
*/
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* );
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;
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 )
#include "QtxPopupMgr.h"
#include "QtxAction.h"
#include "QtxEvalExpr.h"
+#include <QList>
#include <QMenu>
+#include <QVariant>
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+
/*!
\brief Used for comparing of two QVariant values.
\param v1 first argument for comparison
for ( ; anIt1 != aLast1 && anIt2 != aLast2; anIt1++, anIt2++ )
{
if ( (*anIt1) != (*anIt2) )
- return (*anIt1)<(*anIt2);
+ return (*anIt1) < (*anIt2);
}
return anIt1 == aLast1 && anIt2 != aLast2;
}
return t1 < t2;
}
+#else
+
+bool operator<( const QList<QVariant>& v1, const QList<QVariant>& v2 )
+{
+ QList<QVariant>::const_iterator anIt1 = v1.begin(), aLast1 = v1.end(),
+ anIt2 = v2.begin(), aLast2 = v2.end();
+ for ( ; anIt1 != aLast1 && anIt2 != aLast2; anIt1++, anIt2++ )
+ {
+ if ( (*anIt1) != (*anIt2) )
+ return (*anIt1) < (*anIt2);
+ }
+ return anIt1 == aLast1 && anIt2 != aLast2;
+}
+
+#endif // QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+
/*!
\class QtxPopupMgr::PopupCreator
\internal
{
}
+#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)
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
QVariant appropriate = model()->headerData( i, orientation(), Qtx::AppropriateRole );
QIcon icon;
if ( iconData.isValid() ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
if ( iconData.canConvert( QVariant::Icon ) )
icon = iconData.value<QIcon>();
else if ( iconData.canConvert( QVariant::Pixmap ) )
icon = iconData.value<QPixmap>();
+#else
+ if ( iconData.canConvert( QMetaType::QIcon ) )
+ icon = iconData.value<QIcon>();
+ else if ( iconData.canConvert( QMetaType::QPixmap ) )
+ icon = iconData.value<QPixmap>();
+#endif
}
if( ( !lab.isEmpty() || !icon.isNull() ) &&
appropriate.isValid() ? appropriate.toInt()==Qtx::Toggled : true )
}
else if ( a && a == sortAction ) {
setSortIndicatorShown( a->isChecked() );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
setClickable( a->isChecked() );
+#else
+ setSectionsClickable( a->isChecked() );
+#endif
QtxTreeView* view = qobject_cast<QtxTreeView*>( parent() );
if ( view ) {
view->emitSortingEnabled( a->isChecked() );
: QTreeView( parent )
{
setHeader( new Header( false, this ) );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
header()->setMovable( true );
+#else
+ header()->setSectionsMovable( true );
+#endif
}
/*!
: QTreeView( parent )
{
setHeader( new Header( enableSortMenu, this ) );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
header()->setMovable( true );
+#else
+ header()->setSectionsMovable( true );
+#endif
}
/*!
{
int a = 0;
if ( action( id ) )
- a = action( id )->shortcut();
+ a = action( id )->shortcut()[0];
return a;
}
{
int res = 0;
if ( myActionsMap.contains( id ) )
- res = myActionsMap[id]->shortcut();
+ res = myActionsMap[id]->shortcut()[0];
return res;
}
{
int a = 0;
if ( action( id ) )
- a = action( id )->shortcut();
+ a = action( id )->shortcut()[0];
return a;
}
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
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})
# 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()
# --- 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)
# 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()
# --- 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
%Import QtCore/QtCoremod.sip
%Import QtGui/QtGuimod.sip
+%If (Qt_5_0_0 -)
+%Import QtWidgets/QtWidgetsmod.sip
+%End
%Import QtXml/QtXmlmod.sip
# 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()
# --- 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)
%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)
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
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})
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
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})
* 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 ) );
* 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 ) );
}
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 );
class QString;
class QAction;
class QWidget;
+class QKeySequence;
class SUIT_Desktop;
class SUIT_ViewManager;
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();
*/
int SUIT_DataBrowser::shortcutKey(const int id) const
{
- return myShortcutMap.value(id)->key();
+ return myShortcutMap.value(id)->key()[0];
}
/*!
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
void SUIT_TreeModel::registerColumn( const int group_id, const QString& name, const int custom_id )
{
bool found = false;
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ beginResetModel();
+#endif
for ( int i=0, n=myColumns.size(); i<n && !found; i++ ) {
if ( name == myColumns[i].myName ) {
myColumns[i].myIds.insert( group_id, custom_id );
int n = myColumns.size();
myColumns.resize( n+1 );
myColumns[n] = inf;
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ endResetModel();
+#else
reset();
+#endif
}
}
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;
}
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* ) ) );
myRoot = r;
//initialize();
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ endResetModel();
+#else
reset();
+#endif
emit modelUpdated();
}
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
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}")
#include "SUIT_LicenseDlg.h"
#include "SUIT_ResourceMgr.h"
#include "SUIT_Session.h"
+#ifdef USE_SALOME_STYLE
#include "Style_Salome.h"
+#endif // USE_SALOME_STYLE
#include "QtxSplash.h"
#include <QDir>
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() );
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() );
#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() ),
/*!
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 ),
myExceptHandler( hand )
{
}
-
+#endif
/*!
Sends event to receiver
\return the value that is returned from the receiver's event handler
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;
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
INCLUDE(${VTK_USE_FILE})
# --- options ---
# 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
# --- 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
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})
-
// Put Qt includes before the X11 includes which #define the symbol None
// (see SVTK_SpaceMouse.h) to avoid the compilation error.
#ifndef WIN32
-# include <QX11Info>
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+#include <xcb/xcb.h>
+#endif
+#include <QX11Info>
#endif
#include <QMouseEvent>
::~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
}
#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() )
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
}
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
/*!
/*!
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 )
{
#endif
+#else // QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+
+bool QVTK_RenderWindowInteractor
+::nativeEvent(const QByteArray& eventType, void* message, long* result)
+{
+#ifdef WIN32
+ // TODO: WIN32-related implementation
+#else
+ if ( eventType == "xcb_generic_event_t" )
+ {
+ xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message);
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ // TODO: this code is never called
+ if ( SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance() )
+#else
+ if ( SVTK_SpaceMouseXCB* aSpaceMouse = SVTK_SpaceMouseXCB::getInstance() )
+#endif
+ {
+ if ( aSpaceMouse->isSpaceMouseOn() && ev->response_type == XCB_CLIENT_MESSAGE )
+ {
+ SVTK_SpaceMouse::MoveEvent anEvent;
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ // TODO: this code is never called
+ int type = aSpaceMouse->translateEvent( QX11Info::display(), xEvent, &anEvent, 1.0, 1.0 );
+#else
+ int type = aSpaceMouse->translateEvent( QX11Info::connection(), (xcb_client_message_event_t*)ev, &anEvent, 1.0, 1.0 );
+#endif
+ switch ( type )
+ {
+ case SVTK_SpaceMouse::SpaceMouseMove:
+ GetDevice()->InvokeEvent( SVTK::SpaceMouseMoveEvent, anEvent.data );
+ break;
+ case SVTK_SpaceMouse::SpaceButtonPress:
+ GetDevice()->InvokeEvent( SVTK::SpaceMouseButtonEvent, &anEvent.button );
+ break;
+ case SVTK_SpaceMouse::SpaceButtonRelease:
+ break;
+ }
+ return true; // stop handling the event
+ }
+ }
+ }
+#endif
+ return QWidget::nativeEvent( eventType, message, result );
+}
+#endif
/*!
Constructor
*/
virtual void focusOutEvent( QFocusEvent* );
//! To handle native events (from such devices as SpaceMouse)
+// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#ifdef WIN32
virtual bool winEvent( MSG*, long* );
#else
virtual bool x11Event( XEvent *e );
#endif
-
+#else
+ virtual bool nativeEvent( const QByteArray&, void*, long* );
+#endif
vtkSmartPointer<vtkRenderWindow> myRenderWindow;
vtkSmartPointer<vtkGenericRenderWindowInteractor> myDevice;
};
#include <math.h>
#include <stdio.h>
+#include <QtGlobal>
+
#ifndef WIN32
#include <X11/X.h>
-#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/keysym.h>
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#include <X11/Xlib.h>
+#else
+#include <xcb/xcb.h>
+#endif
#endif
#include "SVTK_SpaceMouse.h"
-SVTK_SpaceMouse* SVTK_SpaceMouse::myInstance = 0;
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+SVTK_SpaceMouseX* SVTK_SpaceMouseX::myInstance = 0;
+#else
+SVTK_SpaceMouseXCB* SVTK_SpaceMouseXCB::myInstance = 0;
+#endif
/*!
- \return shared instance of object (creates if there is no one)
+ Constructor
*/
-SVTK_SpaceMouse* SVTK_SpaceMouse::getInstance()
+SVTK_SpaceMouse::SVTK_SpaceMouse()
{
- if ( !myInstance )
- myInstance = new SVTK_SpaceMouse();
- return myInstance;
+ spaceMouseOn = 0;
}
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
/*!
Constructor
*/
-SVTK_SpaceMouse::SVTK_SpaceMouse()
+SVTK_SpaceMouseX::SVTK_SpaceMouseX()
+: SVTK_SpaceMouse()
{
#ifndef WIN32
win = InputFocus;
#endif
- spaceMouseOn = 0;
}
-#ifndef WIN32
-
/*!
- Initialization
+ \return shared instance of object (creates if there is no one)
*/
-int SVTK_SpaceMouse::initialize( Display *display, Window window )
+SVTK_SpaceMouseX* SVTK_SpaceMouseX::getInstance()
{
- XMotionEvent = XInternAtom( display, "MotionEvent", 1 );
- XButtonPressEvent = XInternAtom( display, "ButtonPressEvent", 1 );
- XButtonReleaseEvent = XInternAtom( display, "ButtonReleaseEvent", 1 );
- XCommandEvent = XInternAtom( display, "CommandEvent", 1 );
-
- spaceMouseOn = (XMotionEvent != 0) &&
- (XButtonPressEvent != 0) &&
- (XButtonReleaseEvent != 0) &&
- (XCommandEvent != 0);
- if ( !spaceMouseOn )
- return 0;
-
- spaceMouseOn = setWindow( display, window );
- if ( !spaceMouseOn )
- return 0;
-
- return spaceMouseOn;
+ if ( !myInstance )
+ myInstance = new SVTK_SpaceMouseX();
+ return myInstance;
}
+#ifndef WIN32
+
static int errorCallback( Display *display, XErrorEvent *Error )
{
char msg[ 128 ];
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;
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) );
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;
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;
/*!
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 )
}
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
#ifndef SVTK_SpaceMouse_h
#define SVTK_SpaceMouse_h
+#include <QtGlobal>
+
#ifndef WIN32
extern "C"
{
#include <X11/X.h>
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include <X11/Xlib.h>
+#else
+#include <xcb/xcb.h>
+#endif
}
+
#endif
class SVTK_SpaceMouse
{
public:
- // access to SpaceMouse utility class
- static SVTK_SpaceMouse* getInstance();
-
enum MoveData { x, y, z, a, b, c };
enum EventType { SpaceMouseMove = 1, SpaceButtonPress, SpaceButtonRelease };
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
ADD_SUBDIRECTORY(Test)
ENDIF()
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
IF(SALOME_USE_VTKVIEWER)
INCLUDE(${VTK_USE_FILE})
ENDIF()
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
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})
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;
# variable *_ROOT_DIR).
#
-INCLUDE(UsePyQt4)
+INCLUDE(UseQtExt)
+INCLUDE(UsePyQt)
# --- resources ---
)
# 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
#
# 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
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()
pass
def OnCancel(self):
- self.disconnect(sg.getObjectBrowser(), SIGNAL("selectionChanged()"), self.select)
+ sg.getObjectBrowser().selectionChanged.disconnect(self.select)
self.reject()
pass
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("")
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):
# Author : Guillaume Boulant (EDF)
import sys
-from PyQt4 import QtGui
-from PyQt4 import QtCore
+from qtsalome import *
from tubedialog_ui import 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
"""
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)
#
def main( args ):
- a = QtGui.QApplication(sys.argv)
+ a = QApplication(sys.argv)
TEST_getData_synchrone()
sys.exit(0)
if __name__=="__main__":
main(sys.argv)
-
# 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)
# ======================================================================
#
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)
-
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)
"""
import os,sys,traceback
-from PyQt4 import QtGui
-from PyQt4 import QtCore
+from qtsalome import *
import salome
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:
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={}
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):
"""
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
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
#include <Qtx.h>
#include <QtxSplash.h>
+#ifdef USE_SALOME_STYLE
#include <Style_Salome.h>
+#endif // USE_SALOME_STYLE
#include "GUI_version.h"
#include <SUIT_Tools.h>
* - stop Session ( must be idle )
* - get session state
*/
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
void MessageOutput( QtMsgType type, const char* msg )
+#else
+void MessageOutput( QtMsgType type, const QMessageLogContext &context, const QString &msg )
+#endif
{
switch ( type )
{
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() ),
int main( int argc, char **argv )
{
// Install Qt debug messages handler
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
qInstallMsgHandler( MessageOutput );
+#else
+ qInstallMessageHandler( MessageOutput );
+#endif
+// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
//Set a "native" graphic system in case if application runs on the remote host
QString remote(getenv("REMOTEHOST"));
QString client(getenv("SSH_CLIENT"));
if(remote.length() > 0 || client.length() > 0 ) {
QApplication::setGraphicsSystem(QLatin1String("native"));
}
-
+#endif
+
// add <qtdir>/plugins dir to the pluins search path for image plugins
QString qtdir = Qtx::qtDir( "plugins" );
if ( !qtdir.isEmpty() )
QApplication::addLibraryPath( qtdir );
-
+
// set "C" locale if requested via preferences
{
SALOME_Session stmp( argc, argv );
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
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- 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
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})
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 );
*/
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;
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;
}
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
}
/*!
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;
}
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
}
/*!
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;
}
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;
if (w && ( qobject_cast<QToolBar *>(w->parentWidget() ) ||
( toolbutton->state & State_AutoRaise && !( toolbutton->state & State_MouseOver ) ) )
) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QWindowsStyle::drawComplexControl( cc, opt, p, w );
+#else
+ QCommonStyle::drawComplexControl( cc, opt, p, w );
+#endif
return;
}
int aMinDelta = (int)model()->widgetRounding( Style_Model::ButtonRadius );
}
}
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:
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
}
}
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;
}
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();
aBrdTopCol, aBrdBotCol, isSelected, isLast, isHover );
p->restore();
} else
- QCommonStyle::drawControl(ce, opt, p, w);
+ QCommonStyle::drawControl( ce, opt, p, w );
break;
}
case CE_TabBarTabLabel:
}
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:
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;
}
}
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;
}
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: {
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;
}
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;
break;
}
case PE_Widget: {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QWindowsStyle::drawPrimitive( pe, opt, p, w );
+#else
+ QCommonStyle::drawPrimitive( pe, opt, p, w );
+#endif
if ( !w )
break;
if( w->parent() && !qobject_cast<QMenuBar*>((QWidget*)w) )
= qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) {
if (tbb->shape != QTabBar::RoundedNorth && tbb->shape != QTabBar::RoundedEast &&
tbb->shape != QTabBar::RoundedSouth && tbb->shape != QTabBar::RoundedWest) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QWindowsStyle::drawPrimitive( pe, opt, p, w );
+#else
+ QCommonStyle::drawPrimitive( pe, opt, p, w );
+#endif
break;
}
QRect aSelRect = tbb->selectedTabRect;
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
}
}
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);
const QSize& contentsSize, const QWidget* w ) const
{
if ( checkDebugLevel(8) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
return QWindowsStyle::sizeFromContents( ct, opt,contentsSize, w );
+#else
+ return QCommonStyle::sizeFromContents( ct, opt,contentsSize, w );
+#endif
}
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QSize sz = QWindowsStyle::sizeFromContents( ct, opt, contentsSize, w );
+#else
+ QSize sz = QCommonStyle::sizeFromContents( ct, opt, contentsSize, w );
+#endif
switch (ct) {
case CT_TabBarTab:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
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
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 )
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
}
}
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 )
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
}
/*!
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 )
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 );
}
case CC_ScrollBar:
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QRect slider_r = QWindowsStyle::subControlRect( cc, opt, SC_ScrollBarSlider, wid );
+#else
+ QRect slider_r = QCommonStyle::subControlRect( cc, opt, SC_ScrollBarSlider, wid );
+#endif
int aRect = Style_Tools::getMaxRect( slider_r, (int)model()->widgetRounding( Style_Model::ButtonRadius ) );
switch( sc ) {
case SC_ScrollBarSubPage: // between top/left button and slider
const QWidget* wid ) const
{
if ( checkDebugLevel(13) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
return QWindowsStyle::subElementRect( se, opt, wid );
+#else
+ return QCommonStyle::subElementRect( se, opt, wid );
+#endif
}
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QRect res = QWindowsStyle::subElementRect( se, opt, wid );
+#else
+ QRect res = QCommonStyle::subElementRect( se, opt, wid );
+#endif
int aHalfRect = (int)Style_Tools::getMaxRect( res, (int)model()->widgetRounding( Style_Model::EditRadius )/2 );
int w = res.width(), h = res.height();
switch ( se ) {
case SE_ComboBoxFocusRect: {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QRect old_r = QWindowsStyle::subControlRect( CC_ComboBox,
qstyleoption_cast<const QStyleOptionComplex*>( opt ),
SC_ComboBoxArrow, wid );
+#else
+ QRect old_r = QCommonStyle::subControlRect( CC_ComboBox,
+ qstyleoption_cast<const QStyleOptionComplex*>( opt ),
+ SC_ComboBoxArrow, wid );
+#endif
int old_w = old_r.width();
res.setWidth( w-h+old_w-2 );
break;
#define STYLE_SALOME_H
#include "Style.h"
-
+#include <QtGlobal>
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include <QWindowsStyle>
-
+#else
+#include <QCommonStyle>
+#endif
class Style_Model;
class QApplication;
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
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
INCLUDE_DIRECTORIES(
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
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}")
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-ADD_SUBDIRECTORY(Test)
+INCLUDE(UseQtExt)
-INCLUDE(UseQt4Ext)
+ADD_SUBDIRECTORY(Test)
# --- options ---
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
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})
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
INCLUDE(${VTK_USE_FILE})
+INCLUDE(UseQtExt)
# --- options ---
# --- 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
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")
FILE(GLOB GUITXT_DATA "${CMAKE_CURRENT_SOURCE_DIR}/resources/*.txt")
INSTALL(FILES ${GUITXT_DATA} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
-
-
-
#ifndef WIN32
#include <QX11Info>
#include <vtkXOpenGLRenderWindow.h>
-//#include <GL/gl.h>
-//#include <GL/glu.h>
-//#include <qgl.h>
#endif
/*!Constructor. Create render window with parant \a parent and name \a name.
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static
SET(_other_SOURCES
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}")
#
# 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
)
SET(GenericDialog_FORMS
GenericDialog.ui
)
-
+
ADD_DEFINITIONS(${QT_DEFINITIONS})
ADD_CUSTOM_COMMAND( OUTPUT QDialogTest.cxx QDialogTest.h QDialogTest.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}