From 5edbea6ce87f81cad1ee36c31db77b33477593d3 Mon Sep 17 00:00:00 2001 From: imn Date: Thu, 26 Nov 2015 17:44:01 +0300 Subject: [PATCH] Merge Qt5 porting. --- CMakeLists.txt | 8 ++++++-- src/HEXABLOCKGUI/CMakeLists.txt | 9 +++++---- src/HEXABLOCKGUI/HEXABLOCKGUI.cxx | 2 ++ src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.cxx | 2 +- src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx | 1 + .../HEXABLOCKGUI_DocumentSelectionModel.cxx | 16 ++++++++-------- .../HEXABLOCKGUI_VtkDocumentGraphicView.cxx | 2 ++ src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx | 10 +++++----- src/HEXABLOCKGUI/MyDlgRef/CMakeLists.txt | 6 ++++-- 9 files changed, 34 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe6353f..ecc57ea 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,8 +103,12 @@ IF(SALOME_BUILD_GUI) OPTIONAL SALOME_USE_PYCONSOLE) ADD_DEFINITIONS(${GUI_DEFINITIONS}) # Various - # 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() ELSE(EXISTS ${GUI_ROOT_DIR}) MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR") ENDIF(EXISTS ${GUI_ROOT_DIR}) diff --git a/src/HEXABLOCKGUI/CMakeLists.txt b/src/HEXABLOCKGUI/CMakeLists.txt index 10cd354..68190e3 100644 --- a/src/HEXABLOCKGUI/CMakeLists.txt +++ b/src/HEXABLOCKGUI/CMakeLists.txt @@ -19,7 +19,7 @@ ADD_SUBDIRECTORY(MyDlgRef) -INCLUDE(UseQt4Ext) +INCLUDE(UseQtExt) # --- options --- # additional include directories @@ -91,7 +91,7 @@ SET(HEXABLOCK_HEADERS # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS}) # sources / static SET(_other_SOURCES @@ -170,7 +170,7 @@ SET(_pyuic_files ) # scripts / pyuic wrappings -QT4_WRAP_UI(_uic_HEADERS ${_pyuic_files}) +QT_WRAP_UIC(_uic_HEADERS ${_pyuic_files}) # sources / to compile SET(HEXABLOCK_SOURCES ${_other_SOURCES} ${_moc_SOURCES} ${_uic_HEADERS}) @@ -246,11 +246,12 @@ SET(_other_RESOURCES ADD_LIBRARY(HEXABLOCK ${HEXABLOCK_SOURCES}) TARGET_LINK_LIBRARIES(HEXABLOCK ${_link_LIBRARIES} ) +SET_TARGET_PROPERTIES(HEXABLOCK PROPERTIES COMPILE_DEFINITIONS QT_DISABLE_DEPRECATED_BEFORE=0 ) INSTALL(TARGETS HEXABLOCK EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) INSTALL(FILES ${HEXABLOCK_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) -QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_HEXABLOCK_INSTALL_RES_DATA}") +QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_HEXABLOCK_INSTALL_RES_DATA}") INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_HEXABLOCK_INSTALL_RES_DATA}) diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx index 63692c5..ce168b5 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include #include diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.cxx index 4cd0be4..cb33677 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.cxx @@ -42,7 +42,7 @@ QStandardItem() { setText(m_DocElt->getName()); if ( m_DocElt->isAssociated() ) - setData(Qt::darkGreen, Qt::ForegroundRole); + setData(QColor(Qt::darkGreen), Qt::ForegroundRole); } setData( treeRole, HEXA_TREE_ROLE ); setData( entry, HEXA_DOC_ENTRY_ROLE); diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx index 76cfb96..2b2e984 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.cxx index c8958c6..0b9a14c 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.cxx @@ -326,8 +326,8 @@ void PatternDataSelectionModel::highlightTreeItems(QModelIndexList& indexes, { if (anItemIndex.isValid()) { - theModel->setData(anItemIndex, fgColor, Qt::ForegroundRole); - theModel->setData(anItemIndex, bgColor, Qt::BackgroundRole); + theModel->setData(anItemIndex, QColor(fgColor), Qt::ForegroundRole); + theModel->setData(anItemIndex, QColor(bgColor), Qt::BackgroundRole); currentHighlightedItems << anItemIndex; } } @@ -350,8 +350,8 @@ void PatternDataSelectionModel::unhighlightTreeItems(bool clearSelected) { if (anItemIndex.isValid()) { - theModel->setData(anItemIndex, Qt::darkGreen, Qt::ForegroundRole); - theModel->setData(anItemIndex, Qt::white, Qt::BackgroundRole); + theModel->setData(anItemIndex, QColor(Qt::darkGreen), Qt::ForegroundRole); + theModel->setData(anItemIndex, QColor(Qt::white), Qt::BackgroundRole); } } currentHighlightedItems.clear(); @@ -591,8 +591,8 @@ void PatternGeomSelectionModel::highlightTreeItems(QModelIndexList& indexes, { if (anItemIndex.isValid()) { - theModel->setData(anItemIndex, fgColor, Qt::ForegroundRole); - theModel->setData(anItemIndex, bgColor, Qt::BackgroundRole); + theModel->setData(anItemIndex, QColor(fgColor), Qt::ForegroundRole); + theModel->setData(anItemIndex, QColor(bgColor), Qt::BackgroundRole); currentHighlightedItems << anItemIndex; } } @@ -614,8 +614,8 @@ void PatternGeomSelectionModel::unhighlightTreeItems(bool clearSelected) { if (anItemIndex.isValid()) { - theModel->setData(anItemIndex, Qt::darkGreen, Qt::ForegroundRole); - theModel->setData(anItemIndex, Qt::white, Qt::BackgroundRole); + theModel->setData(anItemIndex, QColor(Qt::darkGreen), Qt::ForegroundRole); + theModel->setData(anItemIndex, QColor(Qt::white), Qt::BackgroundRole); } } currentHighlightedItems.clear(); diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.cxx index 4882a13..66be6ed 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.cxx @@ -33,6 +33,8 @@ #include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx" #include "HEXABLOCKGUI.hxx" +#include + #ifndef M_PI #define M_PI 3.1415927 #endif diff --git a/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx b/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx index eb1e5db..aefa4ff 100644 --- a/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx +++ b/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx @@ -968,13 +968,13 @@ void MyBasicGUI_PointDlg::updateParamCoord(bool theIsUpdate) } } else if (id == GEOM_POINT_SURF) { - GroupOnSurface->TextLabel2->setShown(isParam); - GroupOnSurface->TextLabel3->setShown(isParam); - GroupOnSurface->SpinBox_DX->setShown(isParam); - GroupOnSurface->SpinBox_DY->setShown(isParam); + GroupOnSurface->TextLabel2->setVisible(isParam); + GroupOnSurface->TextLabel3->setVisible(isParam); + GroupOnSurface->SpinBox_DX->setVisible(isParam); + GroupOnSurface->SpinBox_DY->setVisible(isParam); } - GroupXYZ->setShown(!isParam && !isLength); + GroupXYZ->setVisible(!isParam && !isLength); } //================================================================================= diff --git a/src/HEXABLOCKGUI/MyDlgRef/CMakeLists.txt b/src/HEXABLOCKGUI/MyDlgRef/CMakeLists.txt index bfeeb41..25fd40c 100644 --- a/src/HEXABLOCKGUI/MyDlgRef/CMakeLists.txt +++ b/src/HEXABLOCKGUI/MyDlgRef/CMakeLists.txt @@ -17,6 +17,8 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +INCLUDE(UseQtExt) + # --- options --- # additional include directories INCLUDE_DIRECTORIES( @@ -41,7 +43,7 @@ SET(MyDlgRef_HEADERS # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${MyDlgRef_HEADERS}) +QT_WRAP_MOC(_moc_SOURCES ${MyDlgRef_HEADERS}) # sources / static SET(_other_SOURCES @@ -60,7 +62,7 @@ SET(_pyuic_files ) # scripts / pyuic wrappings -QT4_WRAP_UI(_uic_HEADERS ${_pyuic_files}) +QT_WRAP_UIC(_uic_HEADERS ${_pyuic_files}) # sources / to compile SET(MyDlgRef_SOURCES ${_other_SOURCES} ${_moc_SOURCES} ${_uic_HEADERS}) -- 2.39.2