From: imn Date: Thu, 26 Nov 2015 14:40:10 +0000 (+0300) Subject: Merge Qt5 porting. X-Git-Tag: V8_0_0a1^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7967a814c9ba1d854666db4959c71120d979e7ed;p=modules%2Fyacs.git Merge Qt5 porting. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index e5d92d840..9ef75654a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -158,8 +158,12 @@ ENDIF() IF(SALOME_BUILD_GUI) # Graphviz FIND_PACKAGE(SalomeGraphviz REQUIRED) - # Qt4 - FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui) + # Qt + IF(NOT SALOME_GUI_BUILD_WITH_QT5) + FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui) + ELSE() + FIND_PACKAGE(SalomeQt5 REQUIRED) + ENDIF() ENDIF(SALOME_BUILD_GUI) ## @@ -308,18 +312,26 @@ EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets} # Ensure the variables are always defined for the configure: SET(KERNEL_ROOT_DIR "${KERNEL_ROOT_DIR}") SET(GUI_ROOT_DIR "${GUI_ROOT_DIR}") -SET(QT4_ROOT_DIR "${QT4_ROOT_DIR}") +IF(NOT SALOME_GUI_BUILD_WITH_QT5) + SET(QT_ROOT_DIR "${QT4_ROOT_DIR}") +ELSE() + SET(QT_ROOT_DIR "${QT5_ROOT_DIR}") +ENDIF() SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include") # Build variables that will be expanded when configuring SalomeConfig.cmake: -SALOME_CONFIGURE_PREPARE(Qt4) +IF(NOT SALOME_GUI_BUILD_WITH_QT5) + SALOME_CONFIGURE_PREPARE(Qt4) +ELSE() + SALOME_CONFIGURE_PREPARE(Qt5) +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 GUI_ROOT_DIR QT4_ROOT_DIR) + KERNEL_ROOT_DIR GUI_ROOT_DIR QT_ROOT_DIR) # - in the install tree (VSR 16/08/2013: TEMPORARILY COMMENT THIS - TO REMOVE?): # Get the relative path of the include directory so @@ -329,7 +341,7 @@ CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in # ${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake # INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}" # PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX -# KERNEL_ROOT_DIR GUI_ROOT_DIR QT4_ROOT_DIR) +# KERNEL_ROOT_DIR GUI_ROOT_DIR QT_ROOT_DIR) WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake VERSION ${${PROJECT_NAME_UC}_VERSION} diff --git a/src/genericgui/CMakeLists.txt b/src/genericgui/CMakeLists.txt index 37095fa76..0dc09a30d 100644 --- a/src/genericgui/CMakeLists.txt +++ b/src/genericgui/CMakeLists.txt @@ -17,6 +17,8 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +INCLUDE(UseQtExt) + # --- options --- # additional include directories @@ -160,12 +162,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}) SET(GenericGui_SOURCES GenericGuiExport.hxx diff --git a/src/genericgui/CatalogWidget.cxx b/src/genericgui/CatalogWidget.cxx index eec1a0c09..793916e23 100644 --- a/src/genericgui/CatalogWidget.cxx +++ b/src/genericgui/CatalogWidget.cxx @@ -241,7 +241,7 @@ void CatalogWidget::startDrag(Qt::DropActions supportedActions) drag = new QDrag(this); mime = new ItemMimeData; drag->setMimeData(mime); - mime->setData(mimeType, mimeInfo.toAscii()); + mime->setData(mimeType, mimeInfo.toLatin1()); drag->setPixmap(pixmap); theMimeInfo = mimeInfo; diff --git a/src/genericgui/GenericGui.cxx b/src/genericgui/GenericGui.cxx index 67d02f581..023a88cfd 100644 --- a/src/genericgui/GenericGui.cxx +++ b/src/genericgui/GenericGui.cxx @@ -1437,11 +1437,11 @@ void GenericGui::onImportSupervSchema() QString aCall = "salomeloader."+ fileExt+ " "+ fn + " " + tmpFileName + " > " + tmpOutput; DEBTRACE(aCall.toStdString()); - int ret = system(aCall.toAscii()); + int ret = system(aCall.toLatin1()); if(ret != 0) { // --- read file with logs - fstream f(tmpOutput.toAscii()); + fstream f(tmpOutput.toLatin1()); stringstream hfile; hfile << f.rdbuf(); f.close(); @@ -1516,8 +1516,8 @@ QString GenericGui::getSaveFileName(const QString& fileName) filters << "XML files (*.xml)" << "Any files (*)"; dialog.setFileMode(QFileDialog::AnyFile); - dialog.setFilters(filters); - dialog.selectFilter("(*.xml)"); + dialog.setNameFilters(filters); + dialog.selectNameFilter("(*.xml)"); dialog.setDefaultSuffix("xml"); dialog.setConfirmOverwrite(true); //dialog.setConfirmOverwrite(false); // bug Qt4.3.3 diff --git a/src/genericgui/GuiEditor.cxx b/src/genericgui/GuiEditor.cxx index ecbe765d4..da78dbb9d 100644 --- a/src/genericgui/GuiEditor.cxx +++ b/src/genericgui/GuiEditor.cxx @@ -716,7 +716,7 @@ void GuiEditor::showRedo(QWidget *parent) QString GuiEditor::asciiFilter(const QString & name) { DEBTRACE(name.toStdString()); - string aName = name.toAscii().data(); + string aName = name.toLatin1().data(); DEBTRACE(aName); for (int i=0; i < aName.size(); i++) { diff --git a/src/genericgui/GuiExecutor.cxx b/src/genericgui/GuiExecutor.cxx index 4bd977c69..e0b30fd19 100644 --- a/src/genericgui/GuiExecutor.cxx +++ b/src/genericgui/GuiExecutor.cxx @@ -116,7 +116,7 @@ void GuiExecutor::startResumeDataflow(bool initialize) if (CORBA::is_nil(_procRef)) { DEBTRACE("init _procRef"); - _procRef = _engineRef->LoadProc(_context->getFileName().toAscii()); + _procRef = _engineRef->LoadProc(_context->getFileName().toLatin1()); registerStatusObservers(); DEBTRACE("_procRef init"); } diff --git a/src/genericgui/ListJobs_GUI.hxx b/src/genericgui/ListJobs_GUI.hxx index 152748387..25b9bd424 100644 --- a/src/genericgui/ListJobs_GUI.hxx +++ b/src/genericgui/ListJobs_GUI.hxx @@ -20,7 +20,11 @@ #ifndef LISTJOBS_GUI_H #define LISTJOBS_GUI_H +#include #include +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#include +#endif #include "SALOME_NamingService.hxx" #include "SALOME_Launcher.hh" diff --git a/src/genericgui/Scene.cxx b/src/genericgui/Scene.cxx index a47305288..5af74493c 100644 --- a/src/genericgui/Scene.cxx +++ b/src/genericgui/Scene.cxx @@ -69,7 +69,7 @@ bool Scene::isZooming() void Scene::helpEvent(QGraphicsSceneHelpEvent *event) { DEBTRACE("Scene::helpEvent"); - QGraphicsItem *qit = itemAt(event->scenePos()); + QGraphicsItem *qit = itemAt(event->scenePos(), QTransform()); SceneItem * item = dynamic_cast(qit); if (item) { diff --git a/src/genericgui/SceneBlocItem.cxx b/src/genericgui/SceneBlocItem.cxx index 329bd38e8..443cde8d8 100644 --- a/src/genericgui/SceneBlocItem.cxx +++ b/src/genericgui/SceneBlocItem.cxx @@ -203,8 +203,8 @@ void SceneBlocItem::getNodesInfo(YACS::ENGINE::ComposedNode *cnode) width = QString(_format.c_str()).arg(lw, 0, 'g', 3); DEBTRACE(agnameof(aNode) << " (" << nh << "," << nw << ") = (" << height.toStdString() << " ; " << width.toStdString() <<")"); - agset(aNode, const_cast("height"), height.toAscii().data()); - agset(aNode, const_cast("width"), width.toAscii().data()); + agset(aNode, const_cast("height"), height.toLatin1().data()); + agset(aNode, const_cast("width"), width.toLatin1().data()); agset(aNode, const_cast("shape"), const_cast("box") ); agset(aNode, const_cast("fixedsize"), const_cast("true") ); } diff --git a/src/genericgui/SceneItem.cxx b/src/genericgui/SceneItem.cxx index 561243f7b..17f316222 100644 --- a/src/genericgui/SceneItem.cxx +++ b/src/genericgui/SceneItem.cxx @@ -197,7 +197,7 @@ SceneItem::SceneItem(QGraphicsScene *scene, SceneItem *parent, setToolTip(_label); DEBTRACE("SceneItem::SceneItem "<