OPTION(SALOME_BUILD_DOC "Generate SALOME GUI documentation" ON)
OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
OPTION(SALOME_GUI_USE_OBSERVERS "Use study observers in GUI (advanced)" ON)
+OPTION(SALOME_BUILD_WITH_QT5 "Build SALOME with Qt 5" OFF)
# Advanced options:
CMAKE_DEPENDENT_OPTION(SALOME_LIGHT_ONLY "Build SALOME Light only (no CORBA)" OFF
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)
-INCLUDE(${QT_USE_FILE})
+# Qt
+IF(NOT SALOME_BUILD_WITH_QT5)
+ FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtWebKit QtOpenGL QtNetwork)
+ ADD_DEFINITIONS("-DUSE_SALOME_STYLE")
+ELSE()
+ FIND_PACKAGE(SalomeQt5 REQUIRED)
+ENDIF()
-# PyQt4
-FIND_PACKAGE(SalomePyQt4 REQUIRED)
+# PyQt
+IF (NOT SALOME_BUILD_WITH_QT5)
+ FIND_PACKAGE(SalomePyQt4 REQUIRED)
+ELSE()
+ FIND_PACKAGE(SalomePyQt5 REQUIRED)
+ENDIF()
# Optional prerequisites for GUI
IF(NOT SALOME_USE_GLVIEWER)
ADD_DEFINITIONS("-DDISABLE_VTKVIEWER")
ENDIF()
IF(SALOME_USE_PLOT2DVIEWER)
- FIND_PACKAGE(SalomeQwt)
+ FIND_PACKAGE(SalomeQwt)
SALOME_LOG_OPTIONAL_PACKAGE(Qwt SALOME_USE_PLOT2DVIEWER)
ELSE()
ADD_DEFINITIONS("-DDISABLE_PLOT2DVIEWER")
IF (SALOME_USE_PVVIEWER)
FIND_PACKAGE(SalomeParaView)
SALOME_LOG_OPTIONAL_PACKAGE(ParaView SALOME_USE_PVVIEWER)
+ IF(SALOME_BUILD_WITH_QT5)
+ # RNV: Temporary solution: because ParaView CMake procedure
+ # defines Qt5_DIR variable, which is used in the SALOME_CONFIGURE_PREPARE
+ # macro, and as a result leads to the broken SALOME<module>Config.cmake file.
+ # TODO: investigate this !!!
+ UNSET(Qt5_DIR CACHE)
+ ENDIF()
ELSE()
ADD_DEFINITIONS("-DDISABLE_PVVIEWER")
ENDIF()
# 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
- 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_INCLUDE_DIRS - list of paths to include when compiling (all rooted on PYQT_SIP_DIRS)
+# PYQT_SIPFLAGS - compilation flags extracted from PyQt
+#
+# The executables
+# pyuic5 (pyuic5.bat)
+# are searched.
+# The Python command
+# pyqtconfig.Configuration().pyqt_sip_flags
+# is called to get the compilation flags.
+# Headers are located by looking for the header file
+# qobject.sip
+
+IF(NOT PyQt5_FIND_QUIETLY)
+ MESSAGE(STATUS "Looking for PyQt5 ...")
+ENDIF()
+
+IF(NOT SIP_FOUND AND NOT PyQt5_FIND_QUIETLY)
+ MESSAGE(WARNING "PyQt5 needs SIP to be detected correctly!")
+ENDIF()
+
+FIND_PROGRAM(PYQT_PYUIC_EXECUTABLE NAMES pyuic5 pyuic5.bat)
+FIND_PROGRAM(PYQT_PYRCC_EXECUTABLE NAMES pyrcc5 pyrcc5.bat)
+
+# Get root dir locally, going up two levels from the exec:
+GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${PYQT_PYUIC_EXECUTABLE}" PATH)
+GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH)
+
+
+# Typical locations of qobject.sip are:
+# - /usr/share/sip/PyQt5/QtCore, for a system install
+# - or <xyz>/sip/QtCore, for a custom install
+# - or <xyz>/share/sip/QtCore, for a custom install
+FIND_FILE(PYQT_SIP_MAIN_FILE qobject.sip PATH_SUFFIXES share/sip/QtCore sip/QtCore share/sip/PyQt5/QtCore)
+
+IF(PYQT_SIP_MAIN_FILE)
+ GET_FILENAME_COMPONENT(PYQT_SIPS_DIR "${PYQT_SIP_MAIN_FILE}" PATH)
+ GET_FILENAME_COMPONENT(PYQT_SIPS_DIR "${PYQT_SIPS_DIR}" PATH)
+ENDIF()
+MARK_AS_ADVANCED(PYQT_SIP_MAIN_FILE)
+
+# Get PyQt compilation flags:
+SET(PYQT_PYTHONPATH ${_tmp_ROOT_DIR}/PyQt5)
+SET(PYQT_SIPFLAGS)
+
+EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import sys;
+sys.path[:0] = '${PYQT_PYTHONPATH}'.split(';');
+sys.path[:0] = '${SIP_PYTHONPATH}'.split(';');
+from PyQt5.QtCore import PYQT_CONFIGURATION;
+sys.stdout.write(PYQT_CONFIGURATION['sip_flags'])"
+ OUTPUT_VARIABLE PYQT_SIPFLAGS)
+SEPARATE_ARGUMENTS(PYQT_SIPFLAGS)
+
+SET(PYQT_INCLUDE_DIRS
+ "${PYQT_SIPS_DIR}"
+ "${PYQT_SIPS_DIR}/QtCore"
+ "${PYQT_SIPS_DIR}/QtGui"
+ "${PYQT_SIPS_DIR}/QtXml"
+ "${PYQT_SIPS_DIR}/QtOpenGL"
+ "${PYQT_SIPS_DIR}/QtAssistant"
+ "${PYQT_SIPS_DIR}/QtDesigner"
+ "${PYQT_SIPS_DIR}/QtNetwork"
+ "${PYQT_SIPS_DIR}/QtSql"
+ "${PYQT_SIPS_DIR}/QtSvg"
+ "${PYQT_SIPS_DIR}/QtTest"
+)
+
+SET(PYQT_CXX_EXT ".cc")
+SET(PYQT_SIPFLAGS ${PYQT_SIPFLAGS} -s ${PYQT_CXX_EXT} -c .)
+FOREACH(_dir ${PYQT_INCLUDE_DIRS})
+ LIST(APPEND PYQT_SIPFLAGS -I ${_dir})
+ENDFOREACH()
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PyQt5 REQUIRED_VARS PYQT_PYUIC_EXECUTABLE PYQT_PYRCC_EXECUTABLE PYQT_SIPS_DIR PYQT_SIPFLAGS )
+
+# Wrap the final executables so that they always use the proper environment (PYTHONPATH):
+# The results are put to variables:
+# PYQT_PYUIC_PATH - command to launch pyuic with the correct PYTHONPATH
+# PYQT_PYRCC_PATH - command to launch pyrcc with the correct PYTHONPATH
+# TODO: should be done like Sphinx in KERNEL (i.e. generating a shell script)?
+
+IF(WIN32 AND NOT CYGWIN)
+ SET(PYQT_PYUIC_PATH set PYTHONPATH=${PYQT_PYTHONPATH};${SIP_PYTHONPATH};%PYTHONPATH% && ${PYQT_PYUIC_EXECUTABLE})
+ SET(PYQT_PYRCC_PATH set PYTHONPATH=${PYQT_PYTHONPATH};${SIP_PYTHONPATH};%PYTHONPATH% && ${PYQT_PYRCC_EXECUTABLE})
+ELSE()
+ STRING(REPLACE ";" ":" PYQT_PYTHONPATH "${PYQT_PYTHONPATH}")
+ SET(PYQT_PYUIC_PATH /usr/bin/env PYTHONPATH="${PYQT_PYTHONPATH}:${SIP_PYTHONPATH}:$$PYTHONPATH" ${PYQT_PYUIC_EXECUTABLE})
+ SET(PYQT_PYRCC_PATH /usr/bin/env PYTHONPATH="${PYQT_PYTHONPATH}:${SIP_PYTHONPATH}:$$PYTHONPATH" ${PYQT_PYRCC_EXECUTABLE})
+ENDIF()
# Author: Adrien Bruneton
#
-# Graphviz detection for salome
+# ParaView detection for salome
#
# !! Please read the generic detection procedure in SalomeMacros.cmake !!
#
+IF(NOT QT_VERSION)
+ MESSAGE(FATAL_ERROR "Detection of ParaView requires Qt to be detected first!")
+ENDIF()
+
+IF (QT_VERSION VERSION_LESS "5.0")
+ SET(PARAVIEW_QT_VERSION "4")
+ELSE()
+ SET(PARAVIEW_QT_VERSION "5")
+ENDIF()
+
SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(ParaView PARAVIEW_USE_FILE 4)
-#MARK_AS_ADVANCED()
INCLUDE(${PARAVIEW_USE_FILE})
--- /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()
#
# !! Please read the generic detection procedure in SalomeMacros.cmake !!
#
+
SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Qt4 QT_INCLUDES 2)
MARK_AS_ADVANCED(QT_QMAKE_EXECUTABLE)
+# This is only needed to correctly detect Qt help generator tool, to workaround an error
+# coming from ParaView detection procedure
+FIND_PROGRAM(QT_HELP_GENERATOR qhelpgenerator
+ PATHS "${QT_BINARY_DIR}" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ DOC "qhelpgenerator used to compile Qt help project files"
+ )
+MARK_AS_ADVANCED(QT_HELP_GENERATOR)
+
IF(QT4_FOUND)
SALOME_ACCUMULATE_HEADERS(QT_INCLUDES)
SALOME_ACCUMULATE_ENVIRONMENT(PATH ${QT_QMAKE_EXECUTABLE})
SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${QT_QTCORE_LIBRARY})
+ SET(QT_VERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}")
+ MESSAGE(STATUS "Qt version is ${QT_VERSION}")
ENDIF()
--- /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_EXECUTABLE} LOCATION)
+MARK_AS_ADVANCED(QT_LRELEASE_EXECUTABLE)
+
+GET_FILENAME_COMPONENT(QT_BINARY_DIR ${QT_LRELEASE_EXECUTABLE} DIRECTORY)
+MARK_AS_ADVANCED(QT_BINARY_DIR)
+
+# This is only needed to correctly detect Qt help generator tool, to workaround an error
+# coming from ParaView detection procedure
+FIND_PROGRAM(QT_HELP_GENERATOR
+ qhelpgenerator
+ PATHS "${QT_BINARY_DIR}"
+ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+ DOC "qhelpgenerator used to compile Qt help project files")
+MARK_AS_ADVANCED(QT_HELP_GENERATOR)
+
+IF(Qt5Core_FOUND)
+ SALOME_ACCUMULATE_HEADERS(QT_INCLUDES)
+ SALOME_ACCUMULATE_ENVIRONMENT(PATH ${LINGUIST_PATH})
+ SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${Qt5Core_LIBRARIES})
+ SET(QT_VERSION "${Qt5Core_VERSION}")
+ MESSAGE(STATUS "Qt version is ${QT_VERSION}")
+ENDIF()
--- /dev/null
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# Author: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+####################################################################
+#
+# _PYQT_WRAP_GET_UNIQUE_TARGET_NAME: internal function
+#
+# Used to generate unique custom target name for usage in
+# PYQT_WRAP_UIC macro.
+#
+# USAGE: _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(prefix unique_name)
+#
+# ARGUMENTS:
+# prefix [in] prefix for the name
+# unique_name [out] unique name generated by function
+#
+####################################################################
+FUNCTION(_PYQT_WRAP_GET_UNIQUE_TARGET_NAME name unique_name)
+ SET(_propertyName "_PYQT_WRAP_UNIQUE_COUNTER_${name}")
+ GET_PROPERTY(_currentCounter GLOBAL PROPERTY "${_propertyName}")
+ IF(NOT _currentCounter)
+ SET(_currentCounter 1)
+ ENDIF()
+ SET(${unique_name} "${name}_${_currentCounter}" PARENT_SCOPE)
+ MATH(EXPR _currentCounter "${_currentCounter} + 1")
+ SET_PROPERTY(GLOBAL PROPERTY ${_propertyName} ${_currentCounter} )
+ENDFUNCTION()
+
+####################################################################
+#
+# PYQT_WRAP_UIC macro
+#
+# Create Python modules by processing input *.ui (Qt designer) files with
+# PyQt pyuic tool.
+#
+# USAGE: PYQT_WRAP_UIC(output_files pyuic_files)
+#
+# ARGUMENTS:
+# output_files [out] variable where output file names are listed to
+# pyuic_files [in] list of *.ui files
+#
+# NOTES:
+# - Input files are considered relative to the current source directory.
+# - Output files are generated in the current build directory.
+# - Macro automatically adds custom build target to generate output files
+#
+####################################################################
+MACRO(PYQT_WRAP_UIC outfiles)
+
+ IF(NOT WIN32)
+
+ FOREACH(_input ${ARGN})
+ GET_FILENAME_COMPONENT(_input_name ${_input} NAME)
+ STRING(REPLACE ".ui" "_ui.py" _input_name ${_input_name})
+ SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name})
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${_output}
+ COMMAND ${PYQT_PYUIC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
+ MAIN_DEPENDENCY ${_input}
+ )
+ SET(${outfiles} ${${outfiles}} ${_output})
+ ENDFOREACH()
+ _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _uniqueTargetName)
+ ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL DEPENDS ${${outfiles}})
+
+ ELSE(NOT WIN32)
+####
+# ANA: Workaround for the Microsoft Visual Studio 2010. Seems there is a bug in
+# the Microsoft Visual Studio 2010 or CMake 2.8.10.2: custom target doesn't work
+# for the list of the dependencies. It works only for the first dependency in the
+# list. So generate separate target for the each input file. This problem will be
+#investigated in the future.
+####
+
+ SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
+ _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _uniqueTargetName)
+ ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL)
+ FOREACH(_input ${ARGN})
+ GET_FILENAME_COMPONENT(_input_name ${_input} NAME)
+ STRING(REPLACE ".ui" "_ui.py" _input_name ${_input_name})
+ SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name})
+ _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _TgName)
+ ADD_CUSTOM_TARGET(${_TgName} ${PYQT_PYUIC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
+ DEPENDS ${_input}
+ )
+ SET_TARGET_PROPERTIES(${_TgName} PROPERTIES FOLDER PYQT_WRAP_UIC_TARGETS)
+ ADD_DEPENDENCIES(${_uniqueTargetName} DEPEND ${_TgName})
+ SET(${outfiles} ${${outfiles}} ${_output})
+ ENDFOREACH()
+ ENDIF(NOT WIN32)
+ENDMACRO(PYQT_WRAP_UIC)
+
+####################################################################
+#
+# PYQT_WRAP_SIP macro
+#
+# Generate C++ wrappings for *.sip files by processing them with sip.
+#
+# USAGE: PYQT_WRAP_SIP(output_files sip_files)
+#
+# ARGUMENTS:
+# output_files [out] variable where output file names are listed to
+# sip_files [in] list of *.sip files
+#
+# NOTES:
+# - Input files are considered relative to the current source directory.
+# - Output files are generated in the current build directory.
+# - This version of macro requires class(es) definition in the
+# *.sip file to be started on a new line without any preceeding characters.
+#
+# WARNING:
+# - The macro does not properly processes sip features which are wrapped
+# with sip conditionals.
+# - The macro works only if one single sip module is processed
+# (there's only one %Module directive within all input sip files).
+#
+# TODO:
+# - Check if dependency of static sources on generated headers works properly:
+# if header is changed, dependant sources should be recompiled.
+# - Think how to properly process sip conditionals.
+# - Process several sip modules.
+#
+####################################################################
+MACRO(PYQT_WRAP_SIP outfiles)
+ SET(_output)
+ SET(_module_input)
+ FOREACH(_input ${ARGN})
+ FILE(STRINGS ${_input} _sip_modules REGEX "%Module")
+ FILE(STRINGS ${_input} _sip_classes REGEX "^class ")
+ FOREACH(_sip_module ${_sip_modules})
+ STRING(REGEX MATCH ".*%Module *\\( *name=.*\\).*" _mod_name "${_sip_module}")
+ IF (_mod_name)
+ STRING(REGEX REPLACE ".*%Module *\\( *name=(.*).*\\).*" "\\1" _mod_name ${_sip_module})
+ ELSE()
+ STRING(REGEX REPLACE ".*%Module *(.*)" "\\1" _mod_name ${_sip_module})
+ ENDIF()
+ SET(_mod_header "sipAPI${_mod_name}.h")
+ SET(_mod_source "sip${_mod_name}cmodule${PYQT_CXX_EXT}")
+ LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/${_mod_source})
+ SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/${_mod_source})
+ SET(_module_input ${_input})
+ ENDFOREACH()
+ FOREACH(_sip_class ${_sip_classes})
+ STRING(REGEX MATCH ".*class +.* *:" _class_name "${_sip_class}")
+ IF (_class_name)
+ STRING(REGEX REPLACE ".*class +(.*) *:.*" "\\1" _class_name ${_sip_class})
+ ELSE()
+ STRING(REGEX REPLACE ".*class *(.*)" "\\1" _class_name ${_sip_class})
+ ENDIF()
+ STRING(STRIP ${_class_name} _class_name)
+ SET(_class_source "sip${_mod_name}${_class_name}${PYQT_CXX_EXT}")
+ LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/${_class_source})
+ SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/${_class_source})
+ ENDFOREACH()
+ ENDFOREACH()
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${_output}
+ COMMAND ${SIP_EXECUTABLE} ${PYQT_SIPFLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${_module_input}
+ MAIN_DEPENDENCY ${_module_input}
+ )
+ENDMACRO(PYQT_WRAP_SIP)
+
+
+####################################################################
+#
+# PYQT_WRAP_QRC macro
+#
+# Generate Python wrappings for *.qrc files by processing them with pyrcc5.
+#
+# USAGE: PYQT_WRAP_QRC(output_files qrc_files)
+#
+# ARGUMENTS:
+# output_files [out] variable where output file names are listed to
+# qrc_files [in] list of *.qrc files
+#
+# NOTES:
+# - Input files are considered relative to the current source directory.
+# - Output files are generated in the current build directory.
+# - Macro automatically adds custom build target to generate output files
+#
+####################################################################
+
+MACRO(PYQT_WRAP_QRC outfiles)
+ FOREACH(_input ${ARGN})
+ GET_FILENAME_COMPONENT(_input_name ${_input} NAME)
+ STRING(REPLACE ".qrc" "_qrc.py" _input_name ${_input_name})
+ SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name})
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${_output}
+ COMMAND ${PYQT_PYRCC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
+ MAIN_DEPENDENCY ${_input}
+ )
+ SET(${outfiles} ${${outfiles}} ${_output})
+ ENDFOREACH()
+ _PYQT_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_QRC_PY_FILES _uniqueTargetName)
+ ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL DEPENDS ${${outfiles}})
+ENDMACRO(PYQT_WRAP_QRC)
+++ /dev/null
-# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-# Author: Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
-
-####################################################################
-#
-# _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME: internal function
-#
-# Used to generate unique custom target name for usage in
-# PYQT4_WRAP_UIC macro.
-#
-# USAGE: _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(prefix unique_name)
-#
-# ARGUMENTS:
-# prefix [in] prefix for the name
-# unique_name [out] unique name generated by function
-#
-####################################################################
-FUNCTION(_PYQT4_WRAP_GET_UNIQUE_TARGET_NAME name unique_name)
- SET(_propertyName "_PYQT4_WRAP_UNIQUE_COUNTER_${name}")
- GET_PROPERTY(_currentCounter GLOBAL PROPERTY "${_propertyName}")
- IF(NOT _currentCounter)
- SET(_currentCounter 1)
- ENDIF()
- SET(${unique_name} "${name}_${_currentCounter}" PARENT_SCOPE)
- MATH(EXPR _currentCounter "${_currentCounter} + 1")
- SET_PROPERTY(GLOBAL PROPERTY ${_propertyName} ${_currentCounter} )
-ENDFUNCTION()
-
-####################################################################
-#
-# PYQT4_WRAP_UIC macro
-#
-# Create Python modules by processing input *.ui (Qt designer) files with
-# PyQt4 pyuic4 tool.
-#
-# USAGE: PYQT4_WRAP_UIC(output_files pyuic_files)
-#
-# ARGUMENTS:
-# output_files [out] variable where output file names are listed to
-# pyuic_files [in] list of *.ui files
-#
-# NOTES:
-# - Input files are considered relative to the current source directory.
-# - Output files are generated in the current build directory.
-# - Macro automatically adds custom build target to generate output files
-#
-####################################################################
-MACRO(PYQT4_WRAP_UIC outfiles)
-
- IF(NOT WIN32)
-
- FOREACH(_input ${ARGN})
- GET_FILENAME_COMPONENT(_input_name ${_input} NAME)
- STRING(REPLACE ".ui" "_ui.py" _input_name ${_input_name})
- SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name})
- ADD_CUSTOM_COMMAND(
- OUTPUT ${_output}
- COMMAND ${PYQT_PYUIC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
- MAIN_DEPENDENCY ${_input}
- )
- SET(${outfiles} ${${outfiles}} ${_output})
- ENDFOREACH()
- _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _uniqueTargetName)
- ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL DEPENDS ${${outfiles}})
-
- ELSE(NOT WIN32)
-####
-# ANA: Workaround for the Microsoft Visual Studio 2010. Seems there is a bug in
-# the Microsoft Visual Studio 2010 or CMake 2.8.10.2: custom target doesn't work
-# for the list of the dependencies. It works only for the first dependency in the
-# list. So generate separate target for the each input file. This problem will be
-#investigated in the future.
-####
-
- SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
- _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _uniqueTargetName)
- ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL)
- FOREACH(_input ${ARGN})
- GET_FILENAME_COMPONENT(_input_name ${_input} NAME)
- STRING(REPLACE ".ui" "_ui.py" _input_name ${_input_name})
- SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name})
- _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_UI_PY_FILES _TgName)
- ADD_CUSTOM_TARGET(${_TgName} ${PYQT_PYUIC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
- DEPENDS ${_input}
- )
- SET_TARGET_PROPERTIES(${_TgName} PROPERTIES FOLDER PYQT4_WRAP_UIC_TARGETS)
- ADD_DEPENDENCIES(${_uniqueTargetName} DEPEND ${_TgName})
- SET(${outfiles} ${${outfiles}} ${_output})
- ENDFOREACH()
- ENDIF(NOT WIN32)
-ENDMACRO(PYQT4_WRAP_UIC)
-
-####################################################################
-#
-# PYQT4_WRAP_SIP macro
-#
-# Generate C++ wrappings for *.sip files by processing them with sip.
-#
-# USAGE: PYQT4_WRAP_SIP(output_files sip_files)
-#
-# ARGUMENTS:
-# output_files [out] variable where output file names are listed to
-# sip_files [in] list of *.sip files
-#
-# NOTES:
-# - Input files are considered relative to the current source directory.
-# - Output files are generated in the current build directory.
-# - This version of macro requires class(es) definition in the
-# *.sip file to be started on a new line without any preceeding characters.
-#
-# WARNING:
-# - The macro does not properly processes sip features which are wrapped
-# with sip conditionals.
-# - The macro works only if one single sip module is processed
-# (there's only one %Module directive within all input sip files).
-#
-# TODO:
-# - Check if dependency of static sources on generated headers works properly:
-# if header is changed, dependant sources should be recompiled.
-# - Think how to properly process sip conditionals.
-# - Process several sip modules.
-#
-####################################################################
-MACRO(PYQT4_WRAP_SIP outfiles)
- SET(_output)
- SET(_module_input)
- FOREACH(_input ${ARGN})
- FILE(STRINGS ${_input} _sip_modules REGEX "%Module")
- FILE(STRINGS ${_input} _sip_classes REGEX "^class ")
- FOREACH(_sip_module ${_sip_modules})
- STRING(REGEX MATCH ".*%Module *\\( *name=.*\\).*" _mod_name "${_sip_module}")
- IF (_mod_name)
- STRING(REGEX REPLACE ".*%Module *\\( *name=(.*).*\\).*" "\\1" _mod_name ${_sip_module})
- ELSE()
- STRING(REGEX REPLACE ".*%Module *(.*)" "\\1" _mod_name ${_sip_module})
- ENDIF()
- SET(_mod_header "sipAPI${_mod_name}.h")
- SET(_mod_source "sip${_mod_name}cmodule${PYQT_CXX_EXT}")
- LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/${_mod_source})
- SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/${_mod_source})
- SET(_module_input ${_input})
- ENDFOREACH()
- FOREACH(_sip_class ${_sip_classes})
- STRING(REGEX MATCH ".*class +.* *:" _class_name "${_sip_class}")
- IF (_class_name)
- STRING(REGEX REPLACE ".*class +(.*) *:.*" "\\1" _class_name ${_sip_class})
- ELSE()
- STRING(REGEX REPLACE ".*class *(.*)" "\\1" _class_name ${_sip_class})
- ENDIF()
- STRING(STRIP ${_class_name} _class_name)
- SET(_class_source "sip${_mod_name}${_class_name}${PYQT_CXX_EXT}")
- LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/${_class_source})
- SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/${_class_source})
- ENDFOREACH()
- ENDFOREACH()
- ADD_CUSTOM_COMMAND(
- OUTPUT ${_output}
- COMMAND ${SIP_EXECUTABLE} ${PYQT_SIPFLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${_module_input}
- MAIN_DEPENDENCY ${_module_input}
- )
-ENDMACRO(PYQT4_WRAP_SIP)
-
-
-####################################################################
-#
-# PYQT4_WRAP_QRC macro
-#
-# Generate Python wrappings for *.qrc files by processing them with pyrcc4.
-#
-# USAGE: PYQT4_WRAP_QRC(output_files qrc_files)
-#
-# ARGUMENTS:
-# output_files [out] variable where output file names are listed to
-# qrc_files [in] list of *.qrc files
-#
-# NOTES:
-# - Input files are considered relative to the current source directory.
-# - Output files are generated in the current build directory.
-# - Macro automatically adds custom build target to generate output files
-#
-####################################################################
-
-MACRO(PYQT4_WRAP_QRC outfiles)
- FOREACH(_input ${ARGN})
- GET_FILENAME_COMPONENT(_input_name ${_input} NAME)
- STRING(REPLACE ".qrc" "_qrc.py" _input_name ${_input_name})
- SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_input_name})
- ADD_CUSTOM_COMMAND(
- OUTPUT ${_output}
- COMMAND ${PYQT_PYRCC_PATH} -o ${_output} ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
- MAIN_DEPENDENCY ${_input}
- )
- SET(${outfiles} ${${outfiles}} ${_output})
- ENDFOREACH()
- _PYQT4_WRAP_GET_UNIQUE_TARGET_NAME(BUILD_QRC_PY_FILES _uniqueTargetName)
- ADD_CUSTOM_TARGET(${_uniqueTargetName} ALL DEPENDS ${${outfiles}})
-ENDMACRO(PYQT4_WRAP_QRC)
+++ /dev/null
-# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-INSTALL(CODE "MACRO(QT4_COMPILE_TS_ON_INSTALL MYLRELEASE MYTSFILE MYFULLDIR MYOUTQMFILE)
- FILE(MAKE_DIRECTORY \${MYFULLDIR})
- MESSAGE(STATUS \"Compiling \${MYTSFILE}\")
- EXECUTE_PROCESS(COMMAND \${MYLRELEASE} \${MYTSFILE} -qm \${MYFULLDIR}/\${MYOUTQMFILE})
-ENDMACRO(QT4_COMPILE_TS_ON_INSTALL)")
-
-# This MACRO uses the following vars
-# - QT_LRELEASE_EXECUTABLE : (given by default by FindQT.cmake)
-#
-# MYTSFILES containing all ts files to be compiled.
-# WHERETOINSTALL contains directory (relative to install_prefix) where to install files after compilation of ts files too qm.
-MACRO(QT4_INSTALL_TS_RESOURCES MYTSFILES WHERETOINSTALL)
- INSTALL(CODE "SET(INSTALL_TS_DIR ${WHERETOINSTALL})")
- SET(MYSOURCES)
- FOREACH(input ${MYTSFILES})
- GET_FILENAME_COMPONENT(input2 ${input} NAME)
- STRING(REGEX REPLACE ".ts" "" base ${input2})
- SET(output "${base}.qm")
- INSTALL(CODE "QT4_COMPILE_TS_ON_INSTALL( \"${QT_LRELEASE_EXECUTABLE}\" \"${CMAKE_CURRENT_SOURCE_DIR}/${input}\" \"${CMAKE_INSTALL_PREFIX}/\${INSTALL_TS_DIR}\" ${output})")
- ENDFOREACH(input ${MYIDLFILES})
-ENDMACRO(QT4_INSTALL_TS_RESOURCES)
--- /dev/null
+# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+IF (QT_VERSION VERSION_LESS "5.0")
+ INCLUDE(${QT_USE_FILE})
+ENDIF()
+
+INSTALL(CODE "MACRO(QT_COMPILE_TS_ON_INSTALL MYLRELEASE MYTSFILE MYFULLDIR MYOUTQMFILE)
+ FILE(MAKE_DIRECTORY \${MYFULLDIR})
+ MESSAGE(STATUS \"Compiling \${MYTSFILE}\")
+ EXECUTE_PROCESS(COMMAND \${MYLRELEASE} \${MYTSFILE} -qm \${MYFULLDIR}/\${MYOUTQMFILE})
+ENDMACRO(QT_COMPILE_TS_ON_INSTALL)")
+
+# This MACRO uses the following vars
+# - QT_LRELEASE_EXECUTABLE : (given by default by FindQT.cmake)
+#
+# MYTSFILES containing all ts files to be compiled.
+# WHERETOINSTALL contains directory (relative to install_prefix) where to install files after compilation of ts files too qm.
+MACRO(QT_INSTALL_TS_RESOURCES MYTSFILES WHERETOINSTALL)
+ INSTALL(CODE "SET(INSTALL_TS_DIR ${WHERETOINSTALL})")
+ SET(MYSOURCES)
+ FOREACH(input ${MYTSFILES})
+ GET_FILENAME_COMPONENT(input2 ${input} NAME)
+ STRING(REGEX REPLACE ".ts" "" base ${input2})
+ SET(output "${base}.qm")
+ INSTALL(CODE "QT_COMPILE_TS_ON_INSTALL( \"${QT_LRELEASE_EXECUTABLE}\" \"${CMAKE_CURRENT_SOURCE_DIR}/${input}\" \"${CMAKE_INSTALL_PREFIX}/\${INSTALL_TS_DIR}\" ${output})")
+ ENDFOREACH(input ${MYIDLFILES})
+ENDMACRO(QT_INSTALL_TS_RESOURCES)
+
+MACRO(QT_WRAP_MOC)
+IF (QT_VERSION VERSION_LESS "5.0")
+ QT4_WRAP_CPP(${ARGN})
+ELSE()
+ QT5_WRAP_CPP(${ARGN})
+ENDIF()
+ENDMACRO(QT_WRAP_MOC)
+
+MACRO(QT_WRAP_UIC)
+IF (QT_VERSION VERSION_LESS "5.0")
+ QT4_WRAP_UI(${ARGN})
+ELSE()
+ QT5_WRAP_UI(${ARGN})
+ENDIF()
+ENDMACRO(QT_WRAP_UIC)
+
+MACRO(QT_ADD_RESOURCES)
+IF (QT_VERSION VERSION_LESS "5.0")
+ QT4_ADD_RESOURCES(${ARGN})
+ELSE()
+ QT5_ADD_RESOURCES(${ARGN})
+ENDIF()
+ENDMACRO(QT_ADD_RESOURCES)
bool save = false;
if ( !stdDoc().IsNull() && stdDoc()->IsSaved() )
{
- QString path = QDir::convertSeparators( CAF_Tools::toQString( stdDoc()->GetPath() ) );
- save = path == QDir::convertSeparators( fname );
+ QString path = QDir::toNativeSeparators( CAF_Tools::toQString( stdDoc()->GetPath() ) );
+ save = path == QDir::toNativeSeparators( fname );
}
bool status = false;
# 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}")
\ No newline at end of file
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}")
\ No newline at end of file
INSTALL(TARGETS DDS EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
INSTALL(FILES ${DDS_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-
# --- options ---
+# additional include directories
+INCLUDE_DIRECTORIES(${QT_INCLUDES})
+
# additional preprocessor / compiler flags
ADD_DEFINITIONS(${QT_DEFINITIONS})
# 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})
}
aBuffer+="closepath\nstroke\n";
- hFile.write( aBuffer.toAscii() );
+ hFile.write( aBuffer.toLatin1() );
return true;
}
}
aBuffer+="PU;\n";
- hFile.write( aBuffer.toAscii() );
+ hFile.write( aBuffer.toLatin1() );
}
return true;
if ( ( isCircle && ( xdist * xdist + ydist * ydist <= myMarkerSize * myMarkerSize ) ) ||
( !isCircle && ( fabs( xdist ) <= radius && fabs( ydist ) <= radius ) ) )
{
- isFound = FALSE;
+ isFound = false;
count++;
for ( it = myCurSelNumbers.begin(); it != myCurSelNumbers.end(); ++it )
if( i == *it )
{
- isFound = TRUE;
+ isFound = true;
curHNumbers.append( i );
}
count++;
if ( isShift )
{
- bool isFound = FALSE;
+ bool isFound = false;
for( it = mySelNumbers.begin(); it != mySelNumbers.end(); ++it )
if ( *it == i )
{
myUSelNumbers.append( *it );
remIt = it;
- isFound = TRUE;
+ isFound = true;
break;
}
bool GLViewer_MarkerSet::addOrRemoveSelected( int index )
{
if( index < 0 || index > myNumber )
- return FALSE;
+ return false;
int n = mySelNumbers.indexOf( index );
if( n == -1 )
mySelNumbers.removeAt(n);
myUSelNumbers.append( index );
}
- return TRUE;
+ return true;
}
/*!
aBuffer+="closepath\nstroke\n";
- hFile.write( aBuffer.toAscii() );
+ hFile.write( aBuffer.toLatin1() );
return true;
}
aBuffer+="PU;\n";
- hFile.write( aBuffer.toAscii() );
+ hFile.write( aBuffer.toLatin1() );
return true;
}
AddCoordsToPS( aBuffer, "moveto", aViewerCS, aPSCS, double(xPos), double(yPos) );
aBuffer += "(" + aText + ") show\n";
- hFile.write( aBuffer.toAscii() );
+ hFile.write( aBuffer.toLatin1() );
return true;
}
aBuffer = "LB" + aText + "#;";
- hFile.write( aBuffer.toAscii() );
+ hFile.write( aBuffer.toLatin1() );
return true;
}
QRegion circle( (int)(theX - theTol), (int)(theY - theTol),
(int)(2 * theTol), (int)(2 * theTol), QRegion::Ellipse );
if( isCircle )
- intersection = obj.intersect( circle );
+ intersection = obj.intersected( circle );
else
- intersection = obj.intersect( region );
+ intersection = obj.intersected( region );
if( intersection.isEmpty() )
myIsHigh = false;
QRegion circle( (int)(theX - theTol), (int)(theY - theTol),
(int)(2 * theTol), (int)(2 * theTol), QRegion::Ellipse );
if( isCircle )
- intersection = obj.intersect( circle );
+ intersection = obj.intersected( circle );
else
- intersection = obj.intersect( region );
+ intersection = obj.intersected( region );
if( intersection.isEmpty() )
myIsSel = false;
if( myLastPickedChanged || myUpdateAll )
myGLViewer2d->updateAll();
else
- myGLViewer2d->activateDrawers( anUpdatedObjects, TRUE, TRUE );
+ myGLViewer2d->activateDrawers( anUpdatedObjects, true, true );
return 0;
}
if( updateAll || myUpdateAll )
myGLViewer2d->updateAll();
else
- myGLViewer2d->activateDrawers( aList, TRUE, TRUE );
+ myGLViewer2d->activateDrawers( aList, true, true );
if( mySelectedObjects.count() != 0 && status == SS_Invalid )
status = SS_GlobalChanged;
&& mySelectedObjects.indexOf( myLastPicked ) == -1 )
{
mySelectedObjects.append( myLastPicked );
- myGLViewer2d->activateDrawer( myLastPicked, TRUE, TRUE );
+ myGLViewer2d->activateDrawer( myLastPicked, true, true );
if( status == SS_Invalid )
status = SS_GlobalChanged;
if( updateAll || myUpdateAll )
myGLViewer2d->updateAll();
else
- myGLViewer2d->activateDrawers( aList, TRUE, TRUE );
+ myGLViewer2d->activateDrawers( aList, true, true );
if( mySelectedObjects.count() != 0 )
status = SS_GlobalChanged;
if( updateAll || myUpdateAll )
myGLViewer2d->updateAll();
else
- myGLViewer2d->activateDrawers( aList, TRUE, TRUE );
+ myGLViewer2d->activateDrawers( aList, true, true );
if( mySelectedObjects.count() != 0 )
status = SS_GlobalChanged;
{
myLastPicked = *oit;
mySelectedObjects.append( myLastPicked );
- myGLViewer2d->activateDrawer( myLastPicked, TRUE, TRUE );
+ myGLViewer2d->activateDrawer( myLastPicked, true, true );
status = SS_GlobalChanged;
return status;
}
if( updateAll || myUpdateAll )
myGLViewer2d->updateAll();
else
- myGLViewer2d->activateDrawers( aList, TRUE, TRUE );
+ myGLViewer2d->activateDrawers( aList, true, true );
return status;
}
if ( mySelCurIndex >= 0 && mySelCurIndex < NbSelected() )
{
mySelCurIndex++;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
/*!
{
//QRect* rect = object->getRect()->toQRect();
//myGLViewer2d->updateBorders( *rect );
- myGLViewer2d->activateDrawer( object, FALSE );
+ myGLViewer2d->activateDrawer( object, false );
}
}
else
}
if( updateViewer )
- myGLViewer2d->activateDrawers( aList, TRUE );
+ myGLViewer2d->activateDrawers( aList, true );
mySelectedObjects.clear();
}
if( myActiveObjects.contains( object ) && !mySelectedObjects.contains( object ) )
{
- object->setSelected( TRUE );
+ object->setSelected( true );
mySelectedObjects.append( object );
}
if( updateViewer )
- myGLViewer2d->activateDrawer( object, TRUE, TRUE );
+ myGLViewer2d->activateDrawer( object, true, true );
}
/*!
object->unselect();
if( updateViewer )
- myGLViewer2d->activateDrawer( object, TRUE, TRUE );
+ myGLViewer2d->activateDrawer( object, true, true );
}
/*!
*\paran byCircle - true if needs round sensitive area around mouse cursor, else rectangle
*function search object rectangle which intersect with sensitive area and call object highlight method
*/
- int MoveTo( int x, int y, bool byCircle = FALSE );
+ int MoveTo( int x, int y, bool byCircle = false );
/*! A function selecting already highlighting object by calling object method select
*\param Append - true if new selection will be append to existing selection, false - another
*\param byCircle - true if needs round selection area in complex object
*/
- int Select( bool Append = FALSE, bool byCircle = FALSE );
+ int Select( bool Append = false, bool byCircle = false );
/*! A function selecting objects on scene by rectangle
*\param theRect - rectangle of selection
*\param Append - true if new selection will be append to existing selection, false - another
*function search object rectangle which intersect with theRect and call object select method
*/
- int SelectByRect( const QRect& theRect, bool Append = FALSE );
+ int SelectByRect( const QRect& theRect, bool Append = false );
//! A function installing highlight color for all presentation (does not work)
void SetHighlightColor( Quantity_NameOfColor aCol );
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;
}
{
glDeleteLists( myGridList, 1 );
if ( glGetError() != GL_NO_ERROR )
- return FALSE;
+ return false;
}
float xLoc = (int)(myXPan / myXSize) * myXSize;
glEndList();
}
- return TRUE;
+ return true;
}
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 );
myGLWidget = new GLViewer_Widget( this, 0 ) ;
qbl->addWidget( myGLWidget );
myGLWidget->setFocusProxy( this );
- setMouseTracking( TRUE );
+ setMouseTracking( true );
myIsDragProcess = noDrag;
//myCurDragMousePos = QPoint();
GLfloat zoom, xzoom, yzoom;
GLfloat w = x;
GLfloat h = y;
- bool max = FALSE;
+ bool max = false;
xzoom = (GLfloat)x / myWidth;
yzoom = (GLfloat)y / myHeight;
zoom = yzoom;
else
{
- max = TRUE;
+ max = true;
zoom = xzoom > yzoom ? xzoom : yzoom;
}
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 );
}
}
*/
- activateAllDrawers( TRUE );
+ activateAllDrawers( true );
}
/*!
header += "%%Pages: 1\n";
header += "%%Page: 1\n\n";
- hFile.write( header.toAscii() );
+ hFile.write( header.toLatin1() );
}
else if( aType == HPGL )
{
header += "LT;\n";
header += "VS36;\n";
- hFile.write( header.toAscii() );
+ hFile.write( header.toLatin1() );
}
}
if( aType == POST_SCRIPT )
{
QString ending = "showpage\n\n%%EOF";
- hFile.write( ending.toAscii() );
+ hFile.write( ending.toLatin1() );
}
else if( aType == HPGL )
{
QString ending = "PU;PA0,0;SP;EC;PG1;EC1;OE\n";
- hFile.write( ending.toAscii() );
+ hFile.write( ending.toLatin1() );
}
}
if ( !getActiveView() )
return false;
- QFile hFile( FileName.toAscii() );
+ QFile hFile( FileName.toLatin1() );
#ifdef WIN32
HDC hMetaFileDC;
arg( AW-mmLeft-mmRight ).arg( AH-mmBottom-mmTop );
//It is set clipping path
- hFile.write( aBuffer.toAscii() );
+ hFile.write( aBuffer.toLatin1() );
aCurVP->getGLWidget()->translateBackgroundToPS( hFile, &aViewerCS, &aPaperCS );
}
aBuffer += "> false 3 colorimage\n\n";
- hFile.write( aBuffer.toAscii() );
+ hFile.write( aBuffer.toLatin1() );
}
}
# 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
# 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})
//=======================================================================
GraphicsView_Object::~GraphicsView_Object()
{
- QListIterator<QGraphicsItem*> aChildIter( children() );
+ QListIterator<QGraphicsItem*> aChildIter( childItems() );
while( aChildIter.hasNext() )
{
if( QGraphicsItem* aChild = aChildIter.next() )
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+INCLUDE(UseQtExt)
+
# additional include directories
INCLUDE_DIRECTORIES(
${CAS_INCLUDE_DIRS}
# --- 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(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
ADD_EXECUTABLE(HelpBrowser ${HelpBrowser_SOURCES})
TARGET_LINK_LIBRARIES(HelpBrowser ${_link_LIBRARIES})
-INSTALL(TARGETS HelpBrowser EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS})
+INSTALL(TARGETS HelpBrowser EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS})
\ No newline at end of file
#include "qtlocalpeer.h"
#include <QCoreApplication>
#include <QTime>
+#include <QDataStream>
#if defined(Q_OS_WIN)
#include <QLibrary>
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
-
# additional include directories
INCLUDE_DIRECTORIES(
${QT_INCLUDES}
# 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" ) );
QMap<QString, bool> tbMap, dwMap;
dockWindowsState( visArr, tbMap, dwMap );
- QList<QToolBar*> tbList = qFindChildren<QToolBar*>( desktop() );
+ QList<QToolBar*> tbList = desktop()->findChildren<QToolBar*>();
for ( QList<QToolBar*>::iterator it = tbList.begin(); it != tbList.end(); ++it )
{
QToolBar* tb = *it;
tbMap.insert( tb->objectName(), tb->toggleViewAction()->isChecked() );
}
- QList<QDockWidget*> dwList = qFindChildren<QDockWidget*>( desktop() );
+ QList<QDockWidget*> dwList = desktop()->findChildren<QDockWidget*>();
for ( QList<QDockWidget*>::iterator it = dwList.begin(); it != dwList.end(); ++it )
{
QDockWidget* wid = *it;
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(){
QList<QToolBar*> LightApp_Application::findToolBars( const QStringList& names )
{
QList<QToolBar*> aResult;
- QList<QToolBar*> tbList = qFindChildren<QToolBar*>( desktop() );
+ QList<QToolBar*> tbList = desktop()->findChildren<QToolBar*>();
for ( QList<QToolBar*>::iterator tit = tbList.begin(); tit != tbList.end(); ++tit ) {
QToolBar* tb = *tit;
QObject* po = Qtx::findParent( tb, "QMainWindow" );
if( myObjects.contains( id ) && isObjectShown( id )!=shown )
{
Object& obj = myObjects[ id ];
- obj.myEdit->setShown( shown );
- obj.myBtn->setShown( shown );
- obj.myLabel->setShown( shown );
+ obj.myEdit->setVisible( shown );
+ obj.myBtn->setVisible( shown );
+ obj.myLabel->setVisible( shown );
if( !shown )
( ( QToolButton* )obj.myBtn )->setChecked( false );
}
if(aFileBuffer == NULL)
return false;
- myTmpDir = QDir::convertSeparators( QFileInfo( theFileName ).absolutePath() + "/" ).toLatin1().constData() ;
+ myTmpDir = QDir::toNativeSeparators( QFileInfo( theFileName ).absolutePath() + "/" ).toLatin1().constData() ;
int aCurrentPos = 0;
ifstream aFile(theFileName);
#endif
- myTmpDir = QDir::convertSeparators( QFileInfo( theFileName ).absolutePath() + "/" ).toLatin1().constData() ;
+ myTmpDir = QDir::toNativeSeparators( QFileInfo( theFileName ).absolutePath() + "/" ).toLatin1().constData() ;
aFile.seekg(0, ios::end);
int aFileBufferSize = aFile.tellg();
QList<QWidget*> wlist = createdWidgets();
for ( QList<QWidget*>::const_iterator wit = wlist.begin(); wit != wlist.end(); ++wit )
- lst += qFindChildren<QtxComboBox *>(*wit);
+ lst += (*wit)->findChildren<QtxComboBox *>();
return lst;
}
setModal( true );
setWindowTitle( tr("TLT_RENAME") );
- setSizeGripEnabled( TRUE );
+ setSizeGripEnabled( true );
QVBoxLayout* topLayout = new QVBoxLayout( this );
topLayout->setMargin( 11 ); topLayout->setSpacing( 6 );
myButtonOk = new QPushButton( GroupButtons );
myButtonOk->setObjectName( "buttonOk" );
myButtonOk->setText( tr( "BUT_OK" ) );
- myButtonOk->setAutoDefault( TRUE ); myButtonOk->setDefault( TRUE );
+ myButtonOk->setAutoDefault( true ); myButtonOk->setDefault( true );
GroupButtonsLayout->addWidget( myButtonOk );
GroupButtonsLayout->addStretch();
myButtonCancel = new QPushButton( GroupButtons );
myButtonCancel->setObjectName( "buttonCancel" );
myButtonCancel->setText( tr( "BUT_CANCEL" ) );
- myButtonCancel->setAutoDefault( TRUE );
+ myButtonCancel->setAutoDefault( true );
GroupButtonsLayout->addWidget( myButtonCancel );
/***************************************************************/
# 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}")
)
# additional preprocessor / compiler flags
-ADD_DEFINITIONS(${QT_DEFINITIONS} ${CAS_DEFINITIONS})
+ADD_DEFINITIONS(${CAS_DEFINITIONS})
# libraries to link to
-SET(_link_LIBRARIES ${QT_LIBRARIES} ${CAS_LDPATH} ${CAS_KERNEL} ${CAS_TKV3d} ViewerData)
+SET(_link_LIBRARIES ${CAS_LDPATH} ${CAS_KERNEL} ${CAS_TKV3d} ViewerData)
# --- headers ---
# 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})
buttonOk = new QPushButton( GroupButtons );
buttonOk->setObjectName( "buttonOk" );
buttonOk->setText( tr( "BUT_APPLY_AND_CLOSE" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
+ buttonOk->setAutoDefault( true );
+ buttonOk->setDefault( true );
GroupButtonsLayout->addWidget( buttonOk );
buttonApply = new QPushButton( GroupButtons );
buttonApply->setObjectName( "buttonApply" );
buttonApply->setText( tr( "BUT_APPLY" ) );
- buttonApply->setAutoDefault( TRUE );
- buttonApply->setDefault( TRUE );
+ buttonApply->setAutoDefault( true );
+ buttonApply->setDefault( true );
GroupButtonsLayout->addWidget( buttonApply );
GroupButtonsLayout->addStretch();
buttonClose = new QPushButton( GroupButtons );
buttonClose->setObjectName( "buttonClose" );
buttonClose->setText( tr( "BUT_CLOSE" ) );
- buttonClose->setAutoDefault( TRUE );
+ buttonClose->setAutoDefault( true );
GroupButtonsLayout->addWidget( buttonClose );
QPushButton* buttonHelp = new QPushButton( tr( "HELP" ), GroupButtons );
- buttonHelp->setAutoDefault( TRUE );
+ buttonHelp->setAutoDefault( true );
GroupButtonsLayout->addWidget( buttonHelp );
/***************************************************************/
highLevel = index;
}
for( int j = lowLevel; j <= highLevel; j++ )
- myListBox->item( j )->setSelected( TRUE );
+ myListBox->item( j )->setSelected( true );
break;
}
if( myListBox->item( i )->isSelected() && i == index )
- myListBox->item( i )->setSelected( TRUE );
+ myListBox->item( i )->setSelected( true );
}
}
setModal( modal );
setWindowTitle(tr("CAPTION"));
- setSizeGripEnabled(TRUE);
+ setSizeGripEnabled(true);
// Create layout for this dialog
QGridLayout* layoutDlg = new QGridLayout (this);
QPushButton* m_bClose = new QPushButton(tr("&Close"), aGroupBox );
m_bClose->setObjectName("m_bClose");
- m_bClose->setAutoDefault(TRUE);
+ m_bClose->setAutoDefault(true);
m_bClose->setFixedSize(m_bClose->sizeHint());
connect(m_bClose, SIGNAL(clicked()), this, SLOT(onClickClose()));
public:
OCCViewer_SetRotationPointDlg(OCCViewer_ViewWindow* ,
- const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
+ const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0);
~OCCViewer_SetRotationPointDlg();
void SetAction( QtxAction* theAction ) { myAction = theAction; }
{
bool isFound = false;
OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( theView->parent()->parent() );
- QList<QDialog*> allDialogs = qFindChildren<QDialog*>( aViewFrame );
+ QList<QDialog*> allDialogs = aViewFrame->findChildren<QDialog*>();
foreach ( QDialog* d, allDialogs )
if ( d->objectName() == theName )
isFound = true;
OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView());
//Support of several toolbars in the popup menu
- QList<QToolBar*> lst = qFindChildren<QToolBar*>( aView );
+ QList<QToolBar*> lst = aView->findChildren<QToolBar*>();
QList<QToolBar*>::const_iterator it = lst.begin(), last = lst.end();
for ( ; it!=last; it++ ) {
if ( (*it)->parentWidget()->isVisible() )
//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 );
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 );
}
}
# 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})
setObjectName( "Plot2d_FitDataDlg" );
setModal( true );
setWindowTitle( tr( "FIT_DATA_TLT" ) );
- setSizeGripEnabled( TRUE );
+ setSizeGripEnabled( true );
QGridLayout* topLayout = new QGridLayout( this );
topLayout->setSpacing( SPACING_SIZE );
topLayout->setMargin( MARGIN_SIZE );
// OK/Cancel buttons
myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
myOkBtn->setObjectName( "buttonOk" );
- myOkBtn->setAutoDefault( TRUE );
- myOkBtn->setDefault( TRUE );
+ myOkBtn->setAutoDefault( true );
+ myOkBtn->setDefault( true );
myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
myCancelBtn->setObjectName( "buttonCancel" );
- myCancelBtn->setAutoDefault( TRUE );
+ myCancelBtn->setAutoDefault( true );
topLayout->addWidget( myRangeGrp, 0, 0, 1, 3 );
topLayout->addWidget( myOkBtn, 1, 0 );
#include <QVariant>
#include <QStyleOption>
#include <QPaintEvent>
+#include <QTileRules>
+
#include <qwt_plot.h>
#include <qwt_painter.h>
#include <qwt_scale_map.h>
mySymbolType(0),
myPen( QPen() )
{
- myYAxisLeftIcon = yAxisLeft;
- myYAxisRightIcon = yAxisRight;
+ myYAxisLeftIcon = QPixmap(yAxisLeft);
+ myYAxisRightIcon = QPixmap(yAxisRight);
int anIconWidth = qMax( myYAxisLeftIcon.width(), myYAxisRightIcon.width() );
setSpacing( SPACING );
if(hasDeviationData()) {
painter->save();
int lineW = deviationMarkerLineWidth();
- int tickSz = deviationMarkerTickSize() + qRound(lineW/2);
+ int tickSz = deviationMarkerTickSize() + qRound(double(lineW)/2);
double min, max, xi, yi;
int xp, ytop, ybtm, tickl, tickr;
QColor c = isSelected() ? Plot2d_Object::selectionColor() : deviationMarkerColor();
{
setModal( true );
setWindowTitle( tr("TLT_SETUP_PLOT2D_VIEW") );
- setSizeGripEnabled( TRUE );
+ setSizeGripEnabled( true );
QGridLayout* topLayout = new QGridLayout( this );
topLayout->setSpacing( SPACING_SIZE );
/* OK/Cancel buttons */
myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
- myOkBtn->setAutoDefault( TRUE );
- myOkBtn->setDefault( TRUE );
+ myOkBtn->setAutoDefault( true );
+ myOkBtn->setDefault( true );
myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
- myCancelBtn->setAutoDefault( TRUE );
+ myCancelBtn->setAutoDefault( true );
myHelpBtn = new QPushButton( tr( "BUT_HELP" ), this );
- myHelpBtn->setAutoDefault( TRUE );
+ myHelpBtn->setAutoDefault( true );
QHBoxLayout* btnLayout = new QHBoxLayout;
btnLayout->addWidget( myOkBtn );
btnLayout->addStretch();
#include <qwt_plot_zoomer.h>
#include <qwt_curve_fitter.h>
#include <qwt_plot_renderer.h>
+#include <qwt_legend.h>
+#include <qwt_scale_widget.h>
#include <stdlib.h>
#include <limits>
-#include <qprinter.h>
-
-#include <qwt_legend.h>
-#include <qwt_scale_widget.h>
#define DEFAULT_LINE_WIDTH 0 // (default) line width
#define DEFAULT_MARKER_SIZE 9 // default marker size
*/
int Plot2d_ViewFrame::testOperation( const QMouseEvent& me )
{
- int btn = me.button() | me.modifiers();
- const int zoomBtn = Qt::ControlModifier | Qt::LeftButton;
- const int panBtn = Qt::ControlModifier | Qt::MidButton;
- const int fitBtn = Qt::ControlModifier | Qt::RightButton;
+ int btn = (int)me.button() | (int)me.modifiers();
+ const int zoomBtn = (int)Qt::ControlModifier | (int)Qt::LeftButton;
+ const int panBtn = (int)Qt::ControlModifier | (int)Qt::MidButton;
+ const int fitBtn = (int)Qt::ControlModifier | (int)Qt::RightButton;
int op = NoOpId;
if ( btn == zoomBtn ) {
}
}
else {
- int btn = me.button() | me.modifiers();
+ int btn = (int)me.button() | (int)me.modifiers();
if (btn == Qt::RightButton) {
QMouseEvent* aEvent = new QMouseEvent(QEvent::MouseButtonPress,
me.pos(), me.button(), me.buttons(), me.modifiers() );
# 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}")
#include <QTextCursor>
#include <QTextCharFormat>
#include <QRegExp>
+#include <QMimeData>
#include "PyConsole_EnhEditor.h"
#include "PyConsole_EnhInterp.h"
* If the pasted text doesn't contain a line return, no special treatment is done.
* @param source
*/
-void PyConsole_EnhEditor::insertFromMimeData(const QMimeData * source)
+void PyConsole_EnhEditor::insertFromMimeData(const QMimeData* source)
{
if (_multi_line_paste)
return;
virtual void keyPressEvent ( QKeyEvent* event);
virtual void customEvent( QEvent* event);
virtual void mousePressEvent( QMouseEvent* event );
- virtual void insertFromMimeData(const QMimeData * source);
+ virtual void insertFromMimeData(const QMimeData* source);
virtual PyInterp_Request* createTabRequest( const QString& input );
virtual void handleTab();
# 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}")
aMainLayout->addStretch( 1 );
myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
- myOkBtn->setAutoDefault( TRUE );
- myOkBtn->setDefault( TRUE );
+ myOkBtn->setAutoDefault( true );
+ myOkBtn->setDefault( true );
myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
- myCancelBtn->setAutoDefault( TRUE );
+ myCancelBtn->setAutoDefault( true );
myHelpBtn = new QPushButton( tr( "BUT_HELP" ), this );
- myHelpBtn->setAutoDefault( TRUE );
+ myHelpBtn->setAutoDefault( true );
QHBoxLayout* aButtonLayout = new QHBoxLayout;
aButtonLayout->addWidget( myOkBtn );
aButtonLayout->addStretch();
# 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_internal_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_internal_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}")
#include <QtGui>
#include <QLocale>
+#include <QFileDialog>
+#include <QMessageBox>
+#include <QApplication>
+#include <QStatusBar>
/*!
\class PyViewer_ViewWindow
# 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}")
while ( flag )
{
if ( flags & flag && widget( flag ) )
- widget( flag )->setShown( visible );
+ widget( flag )->setVisible( visible );
flag = flag >> 1;
}
}
# 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}")
if ( pos != -1 )
{
int i = 1;
- while ( i <= rx.numCaptures() && varName.isEmpty() )
+ while ( i <= rx.captureCount() && varName.isEmpty() )
{
QString capStr = rx.cap( i );
if ( !capStr.contains( "%" ) && !capStr.contains( "$" ) )
int end = start + varName.length();
if ( capIdx > 1 && rx.cap( capIdx - 1 ).contains( QRegExp( "\\$|%" ) ) )
start = rx.pos( capIdx - 1 ) + rx.cap( capIdx - 1 ).indexOf( QRegExp( "\\$|%" ) );
- if ( capIdx < rx.numCaptures() && !rx.cap( capIdx - 1 ).isEmpty() )
+ if ( capIdx < rx.captureCount() && !rx.cap( capIdx - 1 ).isEmpty() )
end++;
len = end - start;
}
{
QImage res = img;
- int colNum = res.numColors();
+ int colNum = res.colorCount();
if ( colNum )
{
for ( int i = 0; i < colNum; i++ )
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* );
QString pattern = title.toLower();
QToolBar* res = 0;
- QList<QToolBar*> toolbars = qFindChildren<QToolBar*>( mw );
+ QList<QToolBar*> toolbars = mw->findChildren<QToolBar*>( );
for ( QList<QToolBar*>::iterator it = toolbars.begin(); it != toolbars.end() && !res; ++it )
{
if ( (*it)->windowTitle().toLower() == pattern )
*/
void QtxColorButton::updateState()
{
- QList<QToolButton*> bList = qFindChildren<QToolButton*>( menu() );
+ QList<QToolButton*> bList = menu()->findChildren<QToolButton*>();
for ( QList<QToolButton*>::iterator cit = bList.begin(); cit != bList.end(); ++cit )
updateButton( *cit );
}
if ( e->key() == Qt::Key_Tab && e->modifiers() & Qt::ControlModifier )
{
- QObject* tab = qFindChild<QTabWidget*>( this );
+ QObject* tab = this->findChild<QTabWidget*>( );
if ( tab && !property( "in_tab_event" ).toBool() ) {
setProperty( "in_tab_event", true );
QApplication::sendEvent( tab, e );
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 ( !mw )
return;
- QList<QToolBar*> toolbars = qFindChildren<QToolBar*>( mw );
+ QList<QToolBar*> toolbars = mw->findChildren<QToolBar*>( );
for ( QList<QToolBar*>::iterator it = toolbars.begin(); it != toolbars.end(); ++it )
{
QToolBar* tb = *it;
if ( !mw )
return;
- QList<QDockWidget*> dockwidgets = qFindChildren<QDockWidget*>( mw );
+ QList<QDockWidget*> dockwidgets = mw->findChildren<QDockWidget*>( );
for ( QList<QDockWidget*>::iterator it = dockwidgets.begin(); it != dockwidgets.end(); ++it )
{
QDockWidget* dw = *it;
myMode = mode;
- myFamily->setShown( myMode == Native );
- myCustomFams->setShown( myMode == Custom );
+ myFamily->setVisible( myMode == Native );
+ myCustomFams->setVisible( myMode == Custom );
updateGeometry();
}
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 )
myMain->layout()->removeEventFilter( this );
}
- QTimer* t = qFindChild<QTimer*>( myMain->layout() );
+ QTimer* t = myMain->layout()->findChild<QTimer*>( );
if ( t ) {
if ( on )
t->installEventFilter( this );
{
QStringList fList = prepareFilters( entry.filter );
if ( !fList.isEmpty() )
- entry.dlg->setFilters( fList );
+ entry.dlg->setNameFilters( fList );
}
entry.dlg->selectFile( fileName( id ) );
return;
if ( Qtx::extension( fName ).isEmpty() && !isDir )
- fName = autoExtension( fName, entry.dlg->selectedFilter() );
+ fName = autoExtension( fName, entry.dlg->selectedNameFilter() );
- fName = QDir::convertSeparators( fName );
- QString prev = QDir::convertSeparators( fileName( id ) );
+ fName = QDir::toNativeSeparators( fName );
+ QString prev = QDir::toNativeSeparators( fileName( id ) );
if ( isDir )
{
while ( prev.length() && prev.at( prev.length() - 1 ) == QDir::separator() )
ext = ext.mid( ext.indexOf( "." ) + 1 );
if ( !ext.isEmpty() && !ext.contains( "*" ) )
- fName = QDir::convertSeparators( fName ) + QString( "." ) + ext;
+ fName = QDir::toNativeSeparators( fName ) + QString( "." ) + ext;
}
return fName;
}
if ( !path.isEmpty() )
- myPath->setText( QDir::convertSeparators( path ) );
+ myPath->setText( QDir::toNativeSeparators( path ) );
myPath->setFocus();
#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
*/
void QtxPreferenceItem::setIcon( const QIcon& ico )
{
- if ( myIcon.serialNumber() == ico.serialNumber() )
+ if ( myIcon.cacheKey() == ico.cacheKey() )
return;
myIcon = ico;
}
if( !path.isEmpty() )
{
- QString fname = QDir::convertSeparators( path );
+ QString fname = QDir::toNativeSeparators( path );
QFileInfo inf( fname );
fname = inf.absoluteFilePath();
return fname;
QTranslator* QtxResourceMgr::Resources::loadTranslator( const QString& sect, const QString& prefix, const QString& name ) const
{
QTranslator* trans = new QtxTranslator( 0 );
- QString fname = QDir::convertSeparators( fileName( sect, prefix, name ) );
+ QString fname = QDir::toNativeSeparators( fileName( sect, prefix, name ) );
if ( !trans->load( Qtx::file( fname, false ), Qtx::dir( fname ) ) )
{
delete trans;
}
else if ( section == "import" )
{
- QString impFile = QDir::convertSeparators( Qtx::makeEnvVarSubst( data, Qtx::Always ) );
+ QString impFile = QDir::toNativeSeparators( Qtx::makeEnvVarSubst( data, Qtx::Always ) );
QFileInfo impFInfo( impFile );
if ( impFInfo.isRelative() )
impFInfo.setFile( aFinfo.absoluteDir(), impFile );
}
else if ( sectElem.tagName() == importTag() && sectElem.hasAttribute( nameAttribute() ) )
{
- QString impFile = QDir::convertSeparators( Qtx::makeEnvVarSubst( sectElem.attribute( nameAttribute() ), Qtx::Always ) );
+ QString impFile = QDir::toNativeSeparators( Qtx::makeEnvVarSubst( sectElem.attribute( nameAttribute() ), Qtx::Always ) );
QFileInfo impFInfo( impFile );
if ( impFInfo.isRelative() )
impFInfo.setFile( aFinfo.absoluteDir(), impFile );
myModWidget_layout->setMargin( 0 );
myClose = new QToolButton( myBtnWidget );
- myClose->setIcon( QIcon( close_xpm ) );
+ myClose->setIcon( QIcon( QPixmap( close_xpm ) ) );
myClose->setAutoRaise( true );
myBtnWidget_layout->addWidget( wrapWidget( myBtnWidget, myClose ) );
connect( myClose, SIGNAL( clicked() ), this, SLOT( hide() ) );
myData->installEventFilter( this );
myToFirst = new QToolButton( myBtnWidget );
- myToFirst->setIcon( QIcon( first_xpm ) );
+ myToFirst->setIcon( QIcon( QPixmap( first_xpm ) ) );
myToFirst->setAutoRaise( true );
myBtnWidget_layout->addWidget( wrapWidget( myBtnWidget, myToFirst ), 0 );
connect( myToFirst, SIGNAL( clicked() ), this, SLOT( findFirst() ) );
myToFirst->installEventFilter( this );
myPrev = new QToolButton( myBtnWidget );
- myPrev->setIcon( QIcon( prev_xpm ) );
+ myPrev->setIcon( QIcon( QPixmap( prev_xpm ) ) );
myPrev->setAutoRaise( true );
myBtnWidget_layout->addWidget( wrapWidget( myBtnWidget, myPrev ), 0 );
connect( myPrev, SIGNAL( clicked() ), this, SLOT( findPrevious() ) );
myPrev->installEventFilter( this );
myNext = new QToolButton( myBtnWidget );
- myNext->setIcon( QIcon( next_xpm ) );
+ myNext->setIcon( QIcon( QPixmap( next_xpm ) ) );
myNext->setAutoRaise( true );
myBtnWidget_layout->addWidget( wrapWidget( myBtnWidget, myNext ), 0 );
connect( myNext, SIGNAL( clicked() ), this, SLOT( findNext() ) );
myNext->installEventFilter( this );
myToLast = new QToolButton( myBtnWidget );
- myToLast->setIcon( QIcon( last_xpm ) );
+ myToLast->setIcon( QIcon( QPixmap( last_xpm ) ) );
myToLast->setAutoRaise( true );
myBtnWidget_layout->addWidget( wrapWidget( myBtnWidget, myToLast ), 0 );
connect( myToLast, SIGNAL( clicked() ), this, SLOT( findLast() ) );
{
}
+#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 ( qVariantCanConvert<QIcon>( iconData ) )
- icon = qVariantValue<QIcon>( iconData );
- else if ( qVariantCanConvert<QPixmap>( iconData ) )
- icon = qVariantValue<QPixmap>( iconData );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ if ( iconData.canConvert( QVariant::Icon ) )
+ icon = iconData.value<QIcon>();
+ else if ( iconData.canConvert( QVariant::Pixmap ) )
+ icon = iconData.value<QPixmap>();
+#else
+ if ( iconData.canConvert( QMetaType::QIcon ) )
+ icon = iconData.value<QIcon>();
+ else if ( iconData.canConvert( QMetaType::QPixmap ) )
+ icon = iconData.value<QPixmap>();
+#endif
}
if( ( !lab.isEmpty() || !icon.isNull() ) &&
appropriate.isValid() ? appropriate.toInt()==Qtx::Toggled : true )
}
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
}
/*!
//
#include "QtxWorkspace.h"
-#include <QWidgetList>
+#include <QMdiSubWindow>
/*!
\class QtxWorkspace
\param parent parent widget
*/
QtxWorkspace::QtxWorkspace( QWidget* parent )
-: QWorkspace( parent )
+: QMdiArea( parent )
{
}
*/
void QtxWorkspace::tileVertical()
{
- QWidgetList winList = windowList();
+ QList<QMdiSubWindow *> winList = subWindowList();
if ( winList.isEmpty() )
return;
int count = 0;
- for ( QWidgetList::const_iterator itr = winList.begin(); itr != winList.end(); ++itr )
+ for ( QList<QMdiSubWindow *>::const_iterator itr = winList.begin(); itr != winList.end(); ++itr )
if ( !( (*itr)->windowState() & Qt::WindowMinimized ) )
count++;
if ( !count )
return;
- if ( activeWindow() && ( activeWindow()->windowState() & Qt::WindowMaximized ) )
- activeWindow()->showNormal();
+ if ( activeSubWindow() && ( activeSubWindow()->windowState() & Qt::WindowMaximized ) )
+ activeSubWindow()->showNormal();
int y = 0;
int heightForEach = height() / count;
- for ( QWidgetList::iterator it = winList.begin(); it != winList.end(); ++it )
+ for ( QList<QMdiSubWindow *>::iterator it = winList.begin(); it != winList.end(); ++it )
{
QWidget* win = *it;
if ( win->windowState() & Qt::WindowMinimized )
*/
void QtxWorkspace::tileHorizontal()
{
- QWidgetList winList = windowList();
+ QList<QMdiSubWindow *> winList = subWindowList();
if ( winList.isEmpty() )
return;
int count = 0;
- for ( QWidgetList::const_iterator itr = winList.begin(); itr != winList.end(); ++itr )
+ for ( QList<QMdiSubWindow *>::const_iterator itr = winList.begin(); itr != winList.end(); ++itr )
if ( !( (*itr)->windowState() & Qt::WindowMinimized ) )
count++;
if ( !count )
return;
- if ( activeWindow() && activeWindow()->windowState() & Qt::WindowMaximized )
- activeWindow()->showNormal();
+ if ( activeSubWindow() && activeSubWindow()->windowState() & Qt::WindowMaximized )
+ activeSubWindow()->showNormal();
int x = 0;
int widthForEach = width() / count;
- for ( QWidgetList::iterator it = winList.begin(); it != winList.end(); ++it )
+ for ( QList<QMdiSubWindow *>::iterator it = winList.begin(); it != winList.end(); ++it )
{
QWidget* win = *it;
if ( win->windowState() & Qt::WindowMinimized )
#include "Qtx.h"
-#include <QWorkspace>
+#include <QMdiArea>
#ifdef WIN32
#pragma warning( disable:4251 )
#endif
-class QTX_EXPORT QtxWorkspace : public QWorkspace
+class QTX_EXPORT QtxWorkspace : public QMdiArea
{
Q_OBJECT
#include "QtxWorkspace.h"
#include <QMenu>
-#include <QWidgetList>
+#include <QMdiSubWindow>
/*!
\class QtxWorkspaceAction
{
int a = 0;
if ( action( id ) )
- a = action( id )->shortcut();
+ a = action( id )->shortcut()[0];
return a;
}
{
QtxWorkspace* ws = workspace();
if ( ws )
- ws->tile();
+ ws->tileSubWindows();
}
/*!
if ( !ws )
return;
- ws->cascade();
+ ws->cascadeSubWindows();
int w = ws->width();
int h = ws->height();
- QWidgetList winList = ws->windowList();
- for ( QWidgetList::iterator it = winList.begin(); it != winList.end(); ++it )
+ QList<QMdiSubWindow *> winList = ws->subWindowList();
+ for ( QList<QMdiSubWindow *>::iterator it = winList.begin(); it != winList.end(); ++it )
(*it)->resize( int( w * 0.8 ), int( h * 0.8 ) );
}
*/
void QtxWorkspaceAction::updateContent()
{
- bool count = workspace() ? workspace()->windowList().count() : 0;
- action( Cascade )->setEnabled( count );
- action( Tile )->setEnabled( count );
- action( HTile )->setEnabled( count );
- action( VTile )->setEnabled( count );
+ bool hasWindows = workspace() && workspace()->subWindowList().count() > 0;
+ action( Cascade )->setEnabled( hasWindows );
+ action( Tile )->setEnabled( hasWindows );
+ action( HTile )->setEnabled( hasWindows );
+ action( VTile )->setEnabled( hasWindows );
updateWindows();
}
if ( menuActions() & Windows )
{
int index = 1;
- QWidgetList wList = ws->windowList();
- for ( QWidgetList::iterator it = wList.begin(); it != wList.end(); ++it, index++ )
+ QList<QMdiSubWindow *> wList = ws->subWindowList();
+ for ( QList<QMdiSubWindow *>::iterator it = wList.begin(); it != wList.end(); ++it, index++ )
{
QWidget* wid = *it;
QAction* a = new QtxAction( wid->windowTitle(), wid->windowTitle(), 0, this, true );
- a->setChecked( wid == ws->activeWindow() );
+ a->setChecked( wid == ws->activeSubWindow() );
items.append( a );
map.insert( a, Windows + index );
}
if ( !ws )
return;
- QWidgetList wList = ws->windowList();
+ QList<QMdiSubWindow *> wList = ws->subWindowList();
if ( idx >= 0 && idx < (int)wList.count() )
wList.at( idx )->setFocus();
}
{
int res = 0;
if ( myActionsMap.contains( id ) )
- res = myActionsMap[id]->shortcut();
+ res = myActionsMap[id]->shortcut()[0];
return res;
}
for ( QWidgetList::iterator itr = moveList.begin(); itr != moveList.end(); ++itr )
{
(*itr)->setParent( pWid );
- (*itr)->setShown( map.contains( *itr ) ? map[*itr] : false );
+ (*itr)->setVisible( map.contains( *itr ) ? map[*itr] : false );
}
}
{
int a = 0;
if ( action( id ) )
- a = action( id )->shortcut();
+ a = action( id )->shortcut()[0];
return a;
}
// Buttons for possibility of switching the variants of split
myButtonPrevious = new QPushButton( this );
- myButtonPrevious->setIcon( QIcon( prev_xpm ) );
+ myButtonPrevious->setIcon( QIcon( QPixmap( prev_xpm ) ) );
myButtonPrevious->setAutoDefault(true);
myButtonPrevious->setEnabled( false );
myButtonNext = new QPushButton( this );
- myButtonNext->setIcon( QIcon( next_xpm ) );
+ myButtonNext->setIcon( QIcon( QPixmap( next_xpm ) ) );
myButtonNext->setAutoDefault(true);
myButtonNext->setEnabled( false );
# 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(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(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
%Module SalomePyQtGUILight
-%Import QtGuimod.sip
+%Import QtGui/QtGuimod.sip
+%Import QtCore/QtCoremod.sip
+%If (Qt_5_0_0 -)
+%Import QtWidgets/QtWidgetsmod.sip
+%End
%Import QtXmlmod.sip
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UsePyQt4)
+INCLUDE(UseQtExt)
+INCLUDE(UsePyQt)
IF(SALOME_USE_VTKVIEWER)
INCLUDE(${VTK_USE_FILE})
ENDIF()
# --- 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)
PyModuleHelper* getPythonHelper()
{
LightApp_Module* module = getActiveModule();
- PyModuleHelper* helper = module ? qFindChild<PyModuleHelper*>( module, "python_module_helper" ) : 0;
+ PyModuleHelper* helper = module ? module->findChild<PyModuleHelper*>( "python_module_helper" ) : 0;
return helper;
}
myResult = (QAction*)module->createAction( myId, myTipText, icon, myMenuText, myStatusText, myKey, module, myToggle );
}
// for Python module, automatically connect action to callback slot
- PyModuleHelper* helper = qFindChild<PyModuleHelper*>( module, "python_module_helper" );
+ PyModuleHelper* helper = module->findChild<PyModuleHelper*>( "python_module_helper" );
if ( helper ) helper->connectAction( myResult );
}
}
// specific processing for ParaView viewer:
// hierarchy of ParaView viewer is much complex than for usual view;
// we look for sub-widget named "Viewport"
- QList<QWidget*> lst = qFindChildren<QWidget*>( wnd, "Viewport" );
+ QList<QWidget*> lst = wnd->findChildren<QWidget*>( "Viewport" );
if ( !lst.isEmpty() ) {
lst[0]->resize( myWndWidth, myWndHeight );
myResult = true;
QWidget* wnd = viewMgr->getActiveView();
myResult = viewMgr->getActiveView()->getId();
if ( wnd ) {
- wnd->setShown(myVisible);
+ wnd->setVisible(myVisible);
if ( !myVisible && myWidth == 0 && myHeight == 0 ) {
myWidth = 1024;
myHeight = 768;
%Feature ENABLE_CORBA
%Feature ENABLE_PLOT2D
-%Import QtGuimod.sip
+%Import QtGui/QtGuimod.sip
+%Import QtCore/QtCoremod.sip
+%If (Qt_5_0_0 -)
+%Import QtWidgets/QtWidgetsmod.sip
+%End
%Import QtXmlmod.sip
%If (ENABLE_PLOT2D)
# 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})
#include <QFrame>
#include <QVBoxLayout>
+#include <QMdiSubWindow>
#include <stdarg.h>
*/
SUIT_ViewWindow* STD_MDIDesktop::activeWindow() const
{
- SUIT_ViewWindow* wnd = 0;
-
- QWidget* wid = myWorkspace->activeWindow();
- if ( wid && wid->inherits( "SUIT_ViewWindow" ) )
- wnd = (SUIT_ViewWindow*)wid;
-
- return wnd;
+ return qobject_cast<SUIT_ViewWindow*>( myWorkspace->activeSubWindow()->widget() );
}
/*!
{
QList<SUIT_ViewWindow*> winList;
- QWidgetList children = myWorkspace->windowList();
- for ( QWidgetList::iterator it = children.begin(); it != children.end(); ++it )
+ QList<QMdiSubWindow *> children = myWorkspace->subWindowList();
+ for ( QList<QMdiSubWindow *>::iterator it = children.begin(); it != children.end(); ++it )
{
- SUIT_ViewWindow* vw = ::qobject_cast<SUIT_ViewWindow*>( *it );
+ SUIT_ViewWindow* vw = ::qobject_cast<SUIT_ViewWindow*>( (*it)->widget() );
if ( vw )
winList.append( vw );
}
if ( !w || !workspace() )
return;
- workspace()->addWindow( w );
+ workspace()->addSubWindow( w );
}
/*!Call method perform for operation \a type.*/
# 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];
}
/*!
wid->testAttribute( Qt::WA_WState_Hidden );
addWindow( wid );
- wid->setShown( !invis );
+ wid->setVisible( !invis );
}
}
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
return fileName;
QRegExp r( QString::fromLatin1("\\(?[a-zA-Z0-9.*? +;#|]*\\)?$") );
- int index = r.indexIn( selectedFilter().trimmed() );
+ int index = r.indexIn( selectedNameFilter().trimmed() );
if ( QFileInfo( fileName ).exists() )
return fileName; // if file exists return as is
// Due to transformations from the filter list (*.txt *.*xx *.c++ SUIT*.* ) we
// will have the pattern (\.txt|\..*xx|\.c\+\+|\..*) (as we validate extension only,
// we remove everything except extension mask from the pattern
- QString wildcard = selectedFilter().mid( index, r.matchedLength() ).trimmed();
+ QString wildcard = selectedNameFilter().mid( index, r.matchedLength() ).trimmed();
// replace '|' and ';' separators by space symbol and also brackets if there are some
wildcard.replace( QRegExp( "[\\|;|(|)]" )," " );
*/
void SUIT_FileDlg::addFilter( const QString& filter )
{
- QStringList flist = filters();
+ QStringList flist = nameFilters();
if ( !flist.contains( filter ) ) {
flist << filter;
- setFilters( flist );
+ setNameFilters( flist );
}
- selectFilter( filter );
+ selectNameFilter( filter );
}
/*!
tmpfilename = tmpfilename.replace(QRegExp("\\*"), "" ).replace(QRegExp("\\?"), "" );
if ( filters.isEmpty() )
- fd.setFilter( tr( "ALL_FILES_FILTER" ) ); // All files (*)
+ fd.setNameFilter( tr( "ALL_FILES_FILTER" ) ); // All files (*)
else
- fd.setFilters( filters );
+ fd.setNameFilters( filters );
if ( !caption.isEmpty() )
fd.setWindowTitle( caption );
fd.setFileMode( ExistingFiles );
if ( filters.isEmpty() )
- fd.setFilter( tr( "ALL_FILES_FILTER" ) ); // All files (*)
+ fd.setNameFilter( tr( "ALL_FILES_FILTER" ) ); // All files (*)
else
- fd.setFilters( filters );
+ fd.setNameFilters( filters );
if ( !caption.isEmpty() )
fd.setWindowTitle( caption );
// Try config file, given in arguments
for (int i = 1; i < arguments.count(); i++) {
QRegExp rx ("--resources=(.+)");
- if ( rx.indexIn( arguments[i] ) >= 0 && rx.numCaptures() > 0 ) {
+ if ( rx.indexIn( arguments[i] ) >= 0 && rx.captureCount() > 0 ) {
QString file = rx.cap(1);
QFileInfo fi (file);
pathName = fi.absoluteFilePath();
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();
}
void SUIT_ViewManager::setShown( const bool on )
{
for ( int i = 0; i < myViews.count(); i++ )
- myViews.at( i )->setShown( on );
+ myViews.at( i )->setVisible( on );
}
/*!Emit on \a theEvent mouse pressed in \a theView.*/
SUIT_Application* app = SUIT_Session::session()->activeApplication();
if ( app ) {
SUIT_Desktop* d = app->desktop();
- QList<SUIT_ViewWindow*> allViews = qFindChildren<SUIT_ViewWindow*>( d );
+ QList<SUIT_ViewWindow*> allViews = d->findChildren<SUIT_ViewWindow*>();
foreach( SUIT_ViewWindow* vw, allViews ) {
if ( !vw || vw == this ) continue; // skip invalid views and this one
SUIT_CameraProperties otherProps = vw->cameraProperties();
SUIT_Desktop* d = app->desktop();
if ( !d ) return;
- QList<SUIT_ViewWindow*> allViews = qFindChildren<SUIT_ViewWindow*>( d );
+ QList<SUIT_ViewWindow*> allViews = d->findChildren<SUIT_ViewWindow*>();
foreach( SUIT_ViewWindow* vw, allViews ) {
if ( !vw->cameraProperties().isValid() )
continue; // omit views not supporting camera properties
# 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}")
-
-INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}")
+INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA})
\ No newline at end of file
{
QList<QWidget*> aList = createdWidgets();
for ( QList<QWidget*>::const_iterator it = aList.begin(); it != aList.end(); ++it )
- updateCombo( qFindChild<QComboBox*>(*it) );
+ updateCombo( (*it)->findChild<QComboBox*>() );
}
void SVTK_ComboAction::updateCombo( QComboBox* combo )
// Start a one-shot timer for <DELAY> ms.
//
static int DELAY = 1;
- myTimer->setSingleShot(TRUE);
+ myTimer->setSingleShot(true);
myTimer->start(DELAY);
return 1;
}
m_MainWindow(theParent)
{
setWindowTitle(tr("DLG_TITLE"));
- setSizeGripEnabled(TRUE);
+ setSizeGripEnabled(true);
// Create layout for this dialog
QGridLayout* layoutDlg = new QGridLayout (this);
// Create <OK> button
QPushButton* m_bOk = new QPushButton(tr("O&K"), aGroupBox2);
m_bOk->setObjectName("m_bOk");
- m_bOk->setDefault(TRUE);
- m_bOk->setAutoDefault(TRUE);
+ m_bOk->setDefault(true);
+ m_bOk->setAutoDefault(true);
// Create <Apply> button
QPushButton* m_bApply = new QPushButton(tr("&Apply"), aGroupBox2);
m_bApply->setObjectName("m_bApply");
- m_bApply->setAutoDefault(TRUE);
+ m_bApply->setAutoDefault(true);
// Create <Cancel> button
QPushButton* m_bCancel = new QPushButton(tr("&Cancel"), aGroupBox2);
m_bCancel->setObjectName("m_bCancel");
- m_bCancel->setAutoDefault(TRUE);
+ m_bCancel->setAutoDefault(true);
// Layout buttons
aHBoxLayout2->addWidget(m_bOk);
// 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
+bool QVTK_RenderWindowInteractor
+::nativeEvent(const QByteArray& eventType, void* message, long* result)
+{
+ if ( eventType == "xcb_generic_event_t" )
+ {
+ xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message);
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ if ( SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance() )
+#else
+ if ( SVTK_SpaceMouseXCB* aSpaceMouse = SVTK_SpaceMouseXCB::getInstance() )
+#endif
+ {
+ if ( aSpaceMouse->isSpaceMouseOn() && ev->response_type == XCB_CLIENT_MESSAGE )
+ {
+ SVTK_SpaceMouse::MoveEvent anEvent;
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ int type = aSpaceMouse->translateEvent( QX11Info::display(), xEvent, &anEvent, 1.0, 1.0 );
+#else
+ int type = aSpaceMouse->translateEvent( QX11Info::connection(), (xcb_client_message_event_t*)ev, &anEvent, 1.0, 1.0 );
+#endif
+ switch ( type )
+ {
+ case SVTK_SpaceMouse::SpaceMouseMove:
+ GetDevice()->InvokeEvent( SVTK::SpaceMouseMoveEvent, anEvent.data );
+ break;
+ case SVTK_SpaceMouse::SpaceButtonPress:
+ GetDevice()->InvokeEvent( SVTK::SpaceMouseButtonEvent, &anEvent.button );
+ break;
+ case SVTK_SpaceMouse::SpaceButtonRelease:
+ break;
+ }
+ return true; // stop handling the event
+ }
+ }
+ }
+ return QWidget::nativeEvent( eventType, message, result );
+}
+#endif
/*!
Constructor
*/
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;
};
myRWInteractor(theParent->GetInteractor())
{
setWindowTitle(tr("DLG_TITLE"));
- setSizeGripEnabled(TRUE);
+ setSizeGripEnabled(true);
// Create layout for this dialog
QGridLayout* layoutDlg = new QGridLayout (this);
QPushButton* m_bClose = new QPushButton(tr("&Close"), aGroupBox );
m_bClose->setObjectName("m_bClose");
- m_bClose->setAutoDefault(TRUE);
+ m_bClose->setAutoDefault(true);
m_bClose->setFixedSize(m_bClose->sizeHint());
connect(m_bClose, SIGNAL(clicked()), this, SLOT(onClickClose()));
#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
aGridLayout->addWidget(aLabel, 0, 0);
QLineEdit* aLineEdit = new QLineEdit( aGroupBox );
- aLineEdit->setReadOnly( TRUE );
+ aLineEdit->setReadOnly( true );
aGridLayout->addWidget(aLineEdit, 0, 1);
myCurrentUpdateRateLineEdit = aLineEdit;
aGridLayout->addWidget(aLabel, 1, 0);
QLineEdit* aLineEdit = new QLineEdit( aGroupBox );
- aLineEdit->setReadOnly( TRUE );
+ aLineEdit->setReadOnly( true );
aGridLayout->addWidget(aLineEdit, 1, 1);
myNumberOfCellsLineEdit = aLineEdit;
aHBoxLayout->setSpacing(6);
{
QPushButton* aPushButton = new QPushButton(tr("OK"), aGroupBox);
- aPushButton->setDefault(TRUE);
- aPushButton->setAutoDefault(TRUE);
+ aPushButton->setDefault(true);
+ aPushButton->setAutoDefault(true);
aHBoxLayout->addWidget(aPushButton);
connect(aPushButton, SIGNAL(clicked()), this, SLOT(onClickOk()));
}
{
QPushButton* aPushButton = new QPushButton(tr("Apply"), aGroupBox);
- aPushButton->setDefault(TRUE);
- aPushButton->setAutoDefault(TRUE);
+ aPushButton->setDefault(true);
+ aPushButton->setAutoDefault(true);
aHBoxLayout->addWidget(aPushButton);
connect(aPushButton, SIGNAL(clicked()), this, SLOT(onClickApply()));
}
aHBoxLayout->addStretch();
{
QPushButton* aPushButton = new QPushButton(tr("Close"), aGroupBox);
- aPushButton->setDefault(TRUE);
- aPushButton->setAutoDefault(TRUE);
+ aPushButton->setDefault(true);
+ aPushButton->setAutoDefault(true);
aHBoxLayout->addWidget(aPushButton);
connect(aPushButton, SIGNAL(clicked()), this, SLOT(onClickClose()));
}
if(TViewWindow* aView = dynamic_cast<TViewWindow*>(myViewManager->getActiveView())){
//Support of several toolbars in the popup menu
- QList<QToolBar*> lst = qFindChildren<QToolBar*>( aView );
+ QList<QToolBar*> lst = aView->findChildren<QToolBar*>();
QList<QToolBar*>::const_iterator it = lst.begin(), last = lst.end();
for( ; it!=last; it++ )
thePopup->addAction( (*it)->toggleViewAction() );
myRWInteractor(theParent->GetInteractor())
{
setWindowTitle(tr("DLG_TITLE"));
- setSizeGripEnabled(TRUE);
+ setSizeGripEnabled(true);
// Top layout
QVBoxLayout* aTopLayout = new QVBoxLayout(this);
QPushButton* m_bClose = new QPushButton(tr("&Close"), aGroupBox );
m_bClose->setObjectName("m_bClose");
- m_bClose->setAutoDefault(TRUE);
+ m_bClose->setAutoDefault(true);
m_bClose->setFixedSize(m_bClose->sizeHint());
connect(m_bClose, SIGNAL(clicked()), this, SLOT(onClickClose()));
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})
#include <SALOME_LifeCycleCORBA.hxx>
#include <QApplication>
+#include <QWidget>
#include <QAction>
#include <QRegExp>
#include <QCheckBox>
QStringList pyfiles;
QString loadStudy;
- for (int i = 1; i < qApp->argc(); i++) {
+ for (int i = 1; i < qApp->arguments().size(); i++) {
QRegExp rxs ("--study-hdf=(.+)");
- if ( rxs.indexIn( QString(qApp->argv()[i]) ) >= 0 && rxs.capturedTexts().count() > 1 ) {
+ if ( rxs.indexIn( QString(qApp->arguments()[i]) ) >= 0 && rxs.capturedTexts().count() > 1 ) {
QString file = rxs.capturedTexts()[1];
QFileInfo fi ( file );
QString extension = fi.suffix().toLower();
}
else {
QRegExp rxp ("--pyscript=\\[(.+)\\]");
- if ( rxp.indexIn( QString(qApp->argv()[i]) ) >= 0 && rxp.capturedTexts().count() > 1 ) {
+ if ( rxp.indexIn( QString(qApp->arguments()[i]) ) >= 0 && rxp.capturedTexts().count() > 1 ) {
// pyscript
QStringList dictList = rxp.capturedTexts()[1].split("},", QString::SkipEmptyParts);
for (int k = 0; k < dictList.count(); ++k) {
DumpStudyFileDlg fd( desktop() );
fd.setValidator( new DumpStudyFileValidator( &fd ) );
fd.setWindowTitle( tr( "TOT_DESK_FILE_DUMP_STUDY" ) );
- fd.setFilters( aFilters );
+ fd.setNameFilters( aFilters );
fd.myPublishChk->setChecked( anIsPublish );
fd.myMultiFileChk->setChecked( anIsMultiFile );
fd.mySaveGUIChk->setChecked( anIsSaveGUI );
/*!Gets CORBA::ORB_var*/
CORBA::ORB_var SalomeApp_Application::orb()
{
- ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
- static CORBA::ORB_var _orb = init( qApp->argc(), qApp->argv() );
+ static CORBA::ORB_var _orb;
+
+ if ( CORBA::is_nil( _orb ) ) {
+ QStringList args = QApplication::arguments();
+ int argc = args.size();
+ std::vector<std::string> args1(argc);
+ char** argv = new char*[argc];
+ for ( int i = 0; i < argc; ++i ) {
+ args1[i] = args[i].toStdString();
+ argv[i] = const_cast<char*>( args1[i].c_str() );
+ }
+
+ ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
+ _orb = init( argc, argv );
+
+ delete [] argv;
+ }
+
return _orb;
}
*/
CORBA::ORB_var SalomeApp_Engine_i::orb()
{
- ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
- // TODO: using QApplication here looks ugly, think how to
- // obtain the ORB reference in a nicer way...
- static CORBA::ORB_var _orb = init( qApp->argc(), qApp->argv() );
+ static CORBA::ORB_var _orb;
+
+ if ( CORBA::is_nil( _orb ) ) {
+ QStringList args = QApplication::arguments();
+ int argc = args.size();
+ std::vector<std::string> args1(argc);
+ char** argv = new char*[argc];
+ for ( int i = 0; i < argc; ++i ) {
+ args1[i] = args[i].toStdString();
+ argv[i] = const_cast<char*>( args1[i].c_str() );
+ }
+
+ ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
+ _orb = init( argc, argv );
+
+ delete [] argv;
+ }
+
return _orb;
}
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;
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
myIsChanged(false)
{
- setModal( TRUE );
+ setModal( true );
setWindowTitle(tr("TLT_STUDY_PROPERTIES"));
setSizeGripEnabled( true );
# --- scripts ---
# scripts / static
-# TODO: process UIC files via PyQt4 pyuic tool, see UsePyQt4.cmake
+# TODO: process UIC files via PyQt pyuic tool, see UsePyQt.cmake
SET(_plugins_SCRIPTS
minmax_dialog.py
minmax_plugin.py
#include <Qtx.h>
#include <QtxSplash.h>
+#ifdef USE_SALOME_STYLE
#include <Style_Salome.h>
+#endif // USE_SALOME_STYLE
#include "GUI_version.h"
#include <SUIT_Tools.h>
* - stop Session ( must be idle )
* - get session state
*/
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
void MessageOutput( QtMsgType type, const char* msg )
+#else
+void MessageOutput( QtMsgType type, const QMessageLogContext &context, const QString &msg )
+#endif
{
switch ( type )
{
case QtDebugMsg:
- //MESSAGE( "Debug: " << msg );
+ //MESSAGE( "Debug: " << qPrintable(msg) );
break;
case QtWarningMsg:
- MESSAGE( "Warning: " << msg );
+ MESSAGE( "Warning: " << qPrintable(msg) );
break;
case QtFatalMsg:
- MESSAGE( "Fatal: " << msg );
+ MESSAGE( "Fatal: " << qPrintable(msg) );
break;
}
}
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 );
_qappl.setApplicationVersion( salomeVersion() );
// Add application library path (to search style plugin etc...)
- QString path = QDir::convertSeparators( SUIT_Tools::addSlash( QString( ::getenv( "GUI_ROOT_DIR" ) ) ) + QString( "bin/salome" ) );
+ QString path = QDir::toNativeSeparators( SUIT_Tools::addSlash( QString( ::getenv( "GUI_ROOT_DIR" ) ) ) + QString( "bin/salome" ) );
_qappl.addLibraryPath( path );
bool isGUI = isFound( "GUI", argc, argv );
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
// start check servers
int current = 0;
QString error;
- int argc = QApplication::instance()->argc();
- char** argv = QApplication::instance()->argv();
+ QStringList args = QApplication::arguments();
+ int argc = args.size();
+ std::vector<std::string> args1(argc);
+ char** argv = new char*[argc];
+ for ( int i = 0; i < argc; ++i ) {
+ args1[i] = args[i].toStdString();
+ argv[i] = const_cast<char*>( args1[i].c_str() );
+ }
+
+ bool OK = true;
+
// 1. Check naming service
- for ( int i = 0; i < myAttempts; i++ ) {
+ for ( int i = 0; (i < myAttempts) && OK; i++ ) {
Locker locker( this );
setStep( current * myAttempts + i );
try {
- CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
+ ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
+ CORBA::ORB_var orb = init( argc, argv );
CORBA::Object_var obj = orb->resolve_initial_references( "NameService" );
CosNaming::NamingContext_var _root_context = CosNaming::NamingContext::_narrow( obj );
if ( !CORBA::is_nil( _root_context ) ) {
if ( i == myAttempts-1 ) {
setError( tr( "Unable to contact the naming service.\n" ) );
- return;
+ OK = false;
+ //return;
}
}
// 2. Check registry server
- for ( int i = 0; i < myAttempts ; i++ ) {
+ for ( int i = 0; (i < myAttempts) && OK ; i++ ) {
Locker locker( this );
setStep( current * myAttempts + i );
if ( i == myAttempts-1 ) {
setError( tr( "Registry server is not found.\n%1" ).arg ( error ) );
- return;
+ OK = false;
+ //return;
}
}
// 3. Check data server
- for ( int i = 0; i < myAttempts ; i++ ) {
+ for ( int i = 0; (i < myAttempts) && OK ; i++ ) {
Locker locker( this );
setStep( current * myAttempts + i );
if ( i == myAttempts-1 ) {
setError( tr( "Study server is not found.\n%1" ).arg ( error ) );
- return;
+ OK = false;
+ //return;
}
}
// 4. Check module catalogue server
- for ( int i = 0; i < myAttempts ; i++ ) {
+ for ( int i = 0; (i < myAttempts) && OK ; i++ ) {
Locker locker( this );
setStep( current * myAttempts + i );
if ( i == myAttempts-1 ) {
setError( tr( "Module catalogue server is not found.\n%1" ).arg ( error ) );
- return;
+ OK = false;
+ //return;
}
}
// 5. Check data server
- for ( int i = 0; i < myAttempts ; i++ ) {
+ for ( int i = 0; (i < myAttempts) && OK ; i++ ) {
Locker locker( this );
setStep( current * myAttempts + i );
if ( i == myAttempts-1 ) {
setError( tr( "Session server is not found.\n%1" ).arg ( error ) );
- return;
+ OK = false;
+ //return;
}
}
// 6. Check C++ container
if ( myCheckCppContainer ) {
- for ( int i = 0; i < myAttempts ; i++ ) {
+ for ( int i = 0; (i < myAttempts) && OK ; i++ ) {
Locker locker( this );
setStep( current * myAttempts + i );
if ( i == myAttempts-1 ) {
setError( tr( "C++ container is not found.\n%1" ).arg ( error ) );
- return;
+ OK = false;
+ //return;
}
}
}
// 7. Check Python container
if ( myCheckPyContainer ) {
- for ( int i = 0; i < myAttempts ; i++ ) {
+ for ( int i = 0; (i < myAttempts) && OK ; i++ ) {
Locker locker( this );
setStep( current * myAttempts + i );
if ( i == myAttempts-1 ) {
setError( tr( "Python container is not found.\n%1" ).arg ( error ) );
- return;
+ OK = false;
+ //return;
}
}
}
// 8. Check supervision container
if ( myCheckSVContainer ) {
- for ( int i = 0; i < myAttempts ; i++ ) {
+ for ( int i = 0; (i < myAttempts) && OK ; i++ ) {
Locker locker( this );
setStep( current * myAttempts + i );
if ( i == myAttempts-1 ) {
setError( tr( "Supervision container is not found.\n%1" ).arg ( error ) );
- return;
+ OK = false;
+ //return;
}
}
}
+
+ delete [] argv;
}
{
_argc = argc ;
_argv = argv ;
- _isGUI = FALSE ;
+ _isGUI = false ;
_runningStudies= 0 ;
_orb = CORBA::ORB::_duplicate(orb) ;
_poa = PortableServer::POA::_duplicate(poa) ;
# 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})
#include <QSlider>
#include <QMainWindow>
#include <QPixmapCache>
-
-#include <limits.h>
+#include <QTileRules>
#define SHADOW 1
#define LINE_GR_MARGIN 10
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}")
\ No newline at end of file
# 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})
//
#include <QtGui>
+#include <QInputDialog>
#include "mainwindow.hxx"
#include "TreeModel.hxx"
# 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.
///
/// Start a one-shot timer for 10ms.
///
- mTimer->setSingleShot(TRUE) ;
+ mTimer->setSingleShot(true) ;
mTimer->start(10) ;
return 1 ;
}
# 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}")
ViewerTools_DialogBase(QtxAction* theAction,
QWidget* theParent,
const char* theName = "",
- bool theModal = FALSE,
+ bool theModal = false,
Qt::WindowFlags theWFalgs = 0);
~ViewerTools_DialogBase();
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+INCLUDE(UseQtExt)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
-
SET(qtester_SOURCES
qtester.cxx
)
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}