From f7fb99c0b9ed4e02209ca11e9c60bfa85f1337ce Mon Sep 17 00:00:00 2001 From: Ovidiu Mircescu Date: Mon, 4 Jul 2016 17:37:59 +0200 Subject: [PATCH] Qt5 update. --- Examples/cppgui1/cppcomposGUI.cxx | 2 +- Examples/pygui1/pycomposGUI.py | 12 ++++++------ module_generator/gui_tmpl.py | 13 ++++++------- module_generator/mod_tmpl.py | 9 ++++++--- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Examples/cppgui1/cppcomposGUI.cxx b/Examples/cppgui1/cppcomposGUI.cxx index 2e1de65..e7dec69 100644 --- a/Examples/cppgui1/cppcomposGUI.cxx +++ b/Examples/cppgui1/cppcomposGUI.cxx @@ -135,7 +135,7 @@ bool cppcomposGUI::deactivateModule( SUIT_Study* theStudy ) void cppcomposGUI::OnGetBanner() { // Dialog to get the Name - bool ok = FALSE; + bool ok = false; QString myName = QInputDialog::getText( getApp()->desktop(), "label", "name", QLineEdit::Normal, QString::null, &ok ); if ( ok && !myName.isEmpty()) diff --git a/Examples/pygui1/pycomposGUI.py b/Examples/pygui1/pycomposGUI.py index dc720f7..e2e3d61 100644 --- a/Examples/pygui1/pycomposGUI.py +++ b/Examples/pygui1/pycomposGUI.py @@ -19,10 +19,10 @@ import os -from PyQt4.QtCore import * -from PyQt4.QtGui import * -from PyQt4.QtWebKit import * -from PyQt4 import QtCore, QtGui, uic +from PyQt5.QtCore import * +from PyQt5.QtWidgets import * +from PyQt5 import QtCore, uic, QtWidgets +from PyQt5.QtWebKitWidgets import QWebView import salome import pycompos_ORB @@ -101,7 +101,7 @@ def getEngine(): ### def CreateObject(): global __objectid__ - default_name = str( sgPyQt.stringSetting( "pycompos", "def_obj_name", "Object" ).trimmed() ) + default_name = str( sgPyQt.stringSetting( "pycompos", "def_obj_name", "Object" ).lstrip().rstrip() ) # generate object name __objectid__ = __objectid__ + 1 name = "%s_%d" % ( default_name, __objectid__ ) @@ -111,7 +111,7 @@ def CreateObject(): print getEngine().ComponentDataType() sg.updateObjBrowser( True ) -class DemoImpl(QtGui.QDialog): +class DemoImpl(QtWidgets.QDialog): def __init__(self, *args): super(DemoImpl, self).__init__(*args) diff --git a/module_generator/gui_tmpl.py b/module_generator/gui_tmpl.py index 4fef5c4..5b5237c 100644 --- a/module_generator/gui_tmpl.py +++ b/module_generator/gui_tmpl.py @@ -82,7 +82,7 @@ cppsalomeapp=Template(cppsalomeapp) # resources : resource files # ts_resources : .ts files - to be processed by lrelease cmake_cpp_gui = """ -INCLUDE(UseQt4Ext) +INCLUDE(UseQtExt) # --- options --- # additional include directories @@ -125,13 +125,12 @@ SET(_moc_HEADERS ) # header files / uic wrappings -QT4_WRAP_UI(_uic_HEADERS $${_uic_files}) +QT_WRAP_UIC(_uic_HEADERS $${_uic_files}) # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES $${_moc_HEADERS}) - +QT_WRAP_MOC(_moc_SOURCES $${_moc_HEADERS}) # sources / static SET(_other_SOURCES @@ -165,7 +164,7 @@ INSTALL(TARGETS ${module} EXPORT $${PROJECT_NAME}TargetGroup DESTINATION $${SALO INSTALL(FILES $${_moc_HEADERS} DESTINATION $${SALOME_INSTALL_HEADERS}) INSTALL(FILES $${_res_files} DESTINATION "$${SALOME_${module}_INSTALL_RES_DATA}") -QT4_INSTALL_TS_RESOURCES("$${_ts_files}" "$${SALOME_${module}_INSTALL_RES_DATA}") +QT_INSTALL_TS_RESOURCES("$${_ts_files}" "$${SALOME_${module}_INSTALL_RES_DATA}") """ cmake_cpp_gui = Template(cmake_cpp_gui) @@ -176,7 +175,7 @@ cmake_cpp_gui = Template(cmake_cpp_gui) # ts_resources : .ts files - to be processed by lrelease # resources : other resource files cmake_py_gui = """ -INCLUDE(UseQt4Ext) +INCLUDE(UseQtExt) # additional include directories INCLUDE_DIRECTORIES( @@ -206,6 +205,6 @@ SET(_res_files SALOME_INSTALL_SCRIPTS("$${_bin_SCRIPTS}" $${SALOME_INSTALL_SCRIPT_PYTHON}) INSTALL(FILES $${_res_files} DESTINATION "$${SALOME_${module}_INSTALL_RES_DATA}") -QT4_INSTALL_TS_RESOURCES("$${_ts_RESOURCES}" "$${SALOME_${module}_INSTALL_RES_DATA}") +QT_INSTALL_TS_RESOURCES("$${_ts_RESOURCES}" "$${SALOME_${module}_INSTALL_RES_DATA}") """ cmake_py_gui = Template(cmake_py_gui) diff --git a/module_generator/mod_tmpl.py b/module_generator/mod_tmpl.py index 8026d93..0c00a90 100644 --- a/module_generator/mod_tmpl.py +++ b/module_generator/mod_tmpl.py @@ -136,9 +136,12 @@ IF(SALOME_GUI_MODULE) ## From GUI: ## FIND_PACKAGE(SalomeCAS REQUIRED) - # Qt4 - FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui) - INCLUDE($${QT_USE_FILE}) + # Qt4/Qt5 + IF(NOT SALOME_GUI_BUILD_WITH_QT5) + FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui) + ELSE() + FIND_PACKAGE(SalomeQt5 REQUIRED) + ENDIF() ENDIF(SALOME_GUI_MODULE) ${add_modules} -- 2.39.2