From 1461d549819e67ef7c47a40ce3ab9d657c18b51d Mon Sep 17 00:00:00 2001 From: imn Date: Thu, 26 Nov 2015 17:36:23 +0300 Subject: [PATCH] Migrate to Qt 5 --- CMakeLists.txt | 18 ++++++++++++----- src/SMESHGUI/CMakeLists.txt | 6 +++--- src/SMESHGUI/SMESHGUI_ComputeDlg.cxx | 6 +++++- src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx | 4 ++-- src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx | 8 ++++---- src/SMESHGUI/SMESHGUI_MergeDlg.cxx | 2 +- src/SMESHGUI/SMESHGUI_MeshInfo.cxx | 12 +++++++++-- src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx | 8 ++++---- src/StdMeshersGUI/CMakeLists.txt | 6 +++--- .../StdMeshersGUI_CartesianParamCreator.cxx | 8 ++++---- .../StdMeshersGUI_NbSegmentsCreator.cxx | 20 +++++++++---------- src/Tools/MGCleanerPlug/CMakeLists.txt | 4 ++-- src/Tools/MeshCut/CMakeLists.txt | 4 ++-- src/Tools/Verima/Gui/CMakeLists.txt | 4 ++-- src/Tools/YamsPlug/CMakeLists.txt | 4 ++-- src/Tools/blocFissure/ihm/CMakeLists.txt | 4 ++-- src/Tools/padder/spadderpy/gui/CMakeLists.txt | 4 ++-- 17 files changed, 71 insertions(+), 51 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 03e0f5357..d76b4cfe0 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,12 +127,20 @@ IF(SALOME_BUILD_GUI) ## ## Prerequisites From GUI: ## - # Qt4 - FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml) + # Qt + IF(NOT SALOME_GUI_BUILD_WITH_QT5) + FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml) + ELSE() + FIND_PACKAGE(SalomeQt5 REQUIRED) + ENDIF() # SIP - FIND_PACKAGE(SalomeSIP REQUIRED) # should come after Python and before PyQt4 - # PyQt4 - FIND_PACKAGE(SalomePyQt4 REQUIRED) + FIND_PACKAGE(SalomeSIP REQUIRED) # should come after Python and before PyQt5 + # PyQt + IF (NOT SALOME_GUI_BUILD_WITH_QT5) + FIND_PACKAGE(SalomePyQt4 REQUIRED) + ELSE() + FIND_PACKAGE(SalomePyQt5 REQUIRED) + ENDIF() # Qwt FIND_PACKAGE(SalomeQwt REQUIRED) ELSE(EXISTS ${GUI_ROOT_DIR}) diff --git a/src/SMESHGUI/CMakeLists.txt b/src/SMESHGUI/CMakeLists.txt index c62f185e4..c996fc99f 100644 --- a/src/SMESHGUI/CMakeLists.txt +++ b/src/SMESHGUI/CMakeLists.txt @@ -17,7 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) +INCLUDE(UseQtExt) # --- options --- # additional include directories @@ -173,7 +173,7 @@ SET(SMESH_HEADERS ${_moc_HEADERS} ${_other_HEADERS}) # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS}) # sources / static SET(_other_SOURCES @@ -278,4 +278,4 @@ INSTALL(TARGETS SMESH EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INS INSTALL(FILES ${SMESH_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) -QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_SMESH_INSTALL_RES_DATA}") +QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_SMESH_INSTALL_RES_DATA}") diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx index 429531fd2..c884db93d 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx @@ -569,7 +569,11 @@ QFrame* SMESHGUI_ComputeDlg::createMainFrame (QWidget* theParent, bool ForEval) myTable->hideColumn( COL_PUBLISHED ); myTable->hideColumn( COL_SHAPEID ); myTable->hideColumn( COL_BAD_MESH ); +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) myTable->horizontalHeader()->setResizeMode( COL_ERROR, QHeaderView::Interactive ); +#else + myTable->horizontalHeader()->setSectionResizeMode( COL_ERROR, QHeaderView::Interactive ); +#endif myTable->setWordWrap( true ); myTable->horizontalHeader()->setStretchLastSection( true ); myTable->setMinimumWidth( 500 ); @@ -1710,7 +1714,7 @@ void SMESHGUI_PrecomputeOp::initDialog() myOrderMgr = new SMESHGUI_MeshOrderMgr( myDlg->getMeshOrderBox() ); myOrderMgr->SetMesh( myMesh ); bool isOrder = myOrderMgr->GetMeshOrder(myPrevOrder); - myDlg->getMeshOrderBox()->setShown(isOrder); + myDlg->getMeshOrderBox()->setVisible(isOrder); if ( !isOrder ) { delete myOrderMgr; myOrderMgr = 0; diff --git a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx index 47c2f8eec..da805271a 100755 --- a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx @@ -378,7 +378,7 @@ void SMESHGUI_CreatePatternDlg::onSave() SUIT_FileDlg* aDlg = new SUIT_FileDlg( this, false ); aDlg->setWindowTitle( tr( "SAVE_PATTERN" ) ); aDlg->setFileMode( QFileDialog::AnyFile ); - aDlg->setFilter( tr( "PATTERN_FILT" ) ); + aDlg->setNameFilter( tr( "PATTERN_FILT" ) ); if ( myName->text() != "" ) aDlg->selectFile( myName->text() ); @@ -392,7 +392,7 @@ void SMESHGUI_CreatePatternDlg::onSave() if ( QFileInfo( fName ).suffix().isEmpty() ) fName = autoExtension( fName ); - fName = QDir::convertSeparators( fName ); + fName = QDir::toNativeSeparators( fName ); QString aData( myPattern->GetString() ); long aLen = aData.length(); diff --git a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx index c4b0465de..e7a519e03 100644 --- a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx @@ -611,7 +611,7 @@ void SMESHGUI_FilterLibraryDlg::onBrowse() //aDlg->setMode(myMode == COPY_FROM ? QFileDialogP::ExistingFile : QFileDialogP::AnyFile); aDlg->setFileMode(myMode == COPY_FROM ? QFileDialog::ExistingFile : QFileDialog::AnyFile); - aDlg->setFilters(prepareFilters()); + aDlg->setNameFilters(prepareFilters()); aDlg->selectFile(getFileName()); QPushButton* anOkBtn = (QPushButton*)aDlg->findChild("OK"); @@ -629,8 +629,8 @@ void SMESHGUI_FilterLibraryDlg::onBrowse() if (QFileInfo(fName).suffix().isEmpty()) fName = autoExtension(fName); - fName = QDir::convertSeparators(fName); - QString prev = QDir::convertSeparators(getFileName()); + fName = QDir::toNativeSeparators(fName); + QString prev = QDir::toNativeSeparators(getFileName()); if (prev == fName) return; @@ -756,7 +756,7 @@ bool SMESHGUI_FilterLibraryDlg::isPermissionValid(const bool theIsExistingOnly) if (QFileInfo(fName).suffix().isEmpty()) fName = autoExtension(fName); - fName = QDir::convertSeparators(fName); + fName = QDir::toNativeSeparators(fName); if (QFileInfo(fName).exists()) { isWritable = QFileInfo(fName).isWritable(); diff --git a/src/SMESHGUI/SMESHGUI_MergeDlg.cxx b/src/SMESHGUI/SMESHGUI_MergeDlg.cxx index 46e68d346..e1df393fa 100644 --- a/src/SMESHGUI/SMESHGUI_MergeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MergeDlg.cxx @@ -102,7 +102,7 @@ QPixmap SMESHGUI_MergeDlg::IconFirst() " .. ... ... ", " .. .. .. ", " . . "}; - return iconFirst; + return QPixmap( iconFirst ); } //================================================================================= diff --git a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx index 7957b4fdd..01109621e 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx @@ -1650,7 +1650,11 @@ SMESHGUI_TreeElemInfo::SMESHGUI_TreeElemInfo( QWidget* parent ) myInfo->setColumnCount( 2 ); myInfo->setHeaderLabels( QStringList() << tr( "PROPERTY" ) << tr( "VALUE" ) ); myInfo->header()->setStretchLastSection( true ); +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) myInfo->header()->setResizeMode( 0, QHeaderView::ResizeToContents ); +#else + myInfo->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents ); +#endif myInfo->setItemDelegate( new ItemDelegate( myInfo ) ); QVBoxLayout* l = new QVBoxLayout( frame() ); l->setMargin( 0 ); @@ -2342,7 +2346,11 @@ SMESHGUI_AddInfo::SMESHGUI_AddInfo( QWidget* parent ) { setColumnCount( 2 ); header()->setStretchLastSection( true ); +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) header()->setResizeMode( 0, QHeaderView::ResizeToContents ); +#else + header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents ); +#endif header()->hide(); } @@ -3147,7 +3155,7 @@ void SMESHGUI_MeshInfoDlg::dump() DumpFileDlg fd( this ); fd.setWindowTitle( tr( "SAVE_INFO" ) ); - fd.setFilters( aFilters ); + fd.setNameFilters( aFilters ); fd.myBaseChk->setChecked( anIsBase ); fd.myElemChk->setChecked( anIsElem ); fd.myAddChk ->setChecked( anIsAdd ); @@ -3858,7 +3866,7 @@ void SMESHGUI_CtrlInfoDlg::dump() DumpFileDlg fd( this ); fd.setWindowTitle( tr( "SAVE_INFO" ) ); - fd.setFilters( aFilters ); + fd.setNameFilters( aFilters ); fd.myBaseChk->hide(); fd.myElemChk->hide(); fd.myAddChk ->hide(); diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx index dd4d75337..654e6d6ce 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx @@ -809,10 +809,10 @@ void SMESHGUI_MeshPatternDlg::onOpen() SUIT_FileDlg* aDlg = new SUIT_FileDlg (this, true); aDlg->setWindowTitle(tr("LOAD_PATTERN")); aDlg->setFileMode(QFileDialog::ExistingFile); - aDlg->setFilters(prepareFilters()); + aDlg->setNameFilters(prepareFilters()); if (!myName->text().isEmpty()) aDlg->selectFile(myName->text() + ".smp"); - QPushButton* anOkBtn = qFindChild( aDlg, "OK" ); + QPushButton* anOkBtn = aDlg->findChild( "OK" ); if (anOkBtn != 0) anOkBtn->setText(tr("SMESH_BUT_OK")); @@ -826,9 +826,9 @@ void SMESHGUI_MeshPatternDlg::onOpen() if (QFileInfo(fName).suffix().isEmpty()) fName = autoExtension(fName); - fName = QDir::convertSeparators(fName); + fName = QDir::toNativeSeparators(fName); - QString prev = QDir::convertSeparators(myName->text()); + QString prev = QDir::toNativeSeparators(myName->text()); if (prev == fName) return; diff --git a/src/StdMeshersGUI/CMakeLists.txt b/src/StdMeshersGUI/CMakeLists.txt index 9db3c64c0..e922c84b0 100644 --- a/src/StdMeshersGUI/CMakeLists.txt +++ b/src/StdMeshersGUI/CMakeLists.txt @@ -17,7 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UseQt4Ext) +INCLUDE(UseQtExt) # --- options --- # additional include directories @@ -101,7 +101,7 @@ SET(StdMeshersGUI_HEADERS ${_moc_HEADERS} ${_other_HEADERS}) # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) +QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS}) # sources / static SET(_other_SOURCES @@ -145,4 +145,4 @@ TARGET_LINK_LIBRARIES(StdMeshersGUI ${_link_LIBRARIES} ) INSTALL(TARGETS StdMeshersGUI EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) INSTALL(FILES ${StdMeshersGUI_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) -QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_SMESH_INSTALL_RES_DATA}") +QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_SMESH_INSTALL_RES_DATA}") diff --git a/src/StdMeshersGUI/StdMeshersGUI_CartesianParamCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_CartesianParamCreator.cxx index 762bccdec..21f64ed4f 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_CartesianParamCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_CartesianParamCreator.cxx @@ -319,10 +319,10 @@ namespace StdMeshersGUI void GridAxisTab::onMode(int isSpacing) { - mySpacingTreeWdg->setShown( isSpacing ); - myCoordList->setShown( !isSpacing ); - myStepSpin->setShown( !isSpacing ); - myStepLabel->setShown( !isSpacing ); + mySpacingTreeWdg->setVisible( isSpacing ); + myCoordList->setVisible( !isSpacing ); + myStepSpin->setVisible( !isSpacing ); + myStepLabel->setVisible( !isSpacing ); if ( isSpacing ) { if ( mySpacingTreeWdg->topLevelItemCount() == 0 ) diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx index 6749e0b9c..567e08f9c 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx @@ -447,25 +447,25 @@ void StdMeshersGUI_NbSegmentsCreator::onValueChanged() myTable->setData( arr ); //update data in table } - myScale->setShown( distr==1 ); - myLScale->setShown( distr==1 ); - myReversedEdgesBox->setShown( distr!=0 ); + myScale->setVisible( distr==1 ); + myLScale->setVisible( distr==1 ); + myReversedEdgesBox->setVisible( distr!=0 ); if ( myReversedEdgesHelper ) { myReversedEdgesHelper->Clear(); - myReversedEdgesHelper->setShown( distr!=0 ); + myReversedEdgesHelper->setVisible( distr!=0 ); } myDirectionWidget->ShowPreview( distr!=0 ); bool isFunc = distr==2 || distr==3; #ifndef DISABLE_PLOT2DVIEWER - myPreview->setShown( isFunc ); + myPreview->setVisible( isFunc ); #endif - myConvBox->setShown( isFunc ); + myConvBox->setVisible( isFunc ); - myTable->setShown( distr==2 ); - myExpr->setShown( distr==3 ); - myLExpr->setShown( distr==3 ); - myInfo->setShown( distr==3); + myTable->setVisible( distr==2 ); + myExpr->setVisible( distr==3 ); + myLExpr->setVisible( distr==3 ); + myInfo->setVisible( distr==3); #ifndef DISABLE_PLOT2DVIEWER //change of preview diff --git a/src/Tools/MGCleanerPlug/CMakeLists.txt b/src/Tools/MGCleanerPlug/CMakeLists.txt index f0900c811..319d8425d 100644 --- a/src/Tools/MGCleanerPlug/CMakeLists.txt +++ b/src/Tools/MGCleanerPlug/CMakeLists.txt @@ -20,7 +20,7 @@ IF(SALOME_BUILD_DOC) ADD_SUBDIRECTORY(doc) ENDIF(SALOME_BUILD_DOC) -INCLUDE(UsePyQt4) +INCLUDE(UsePyQt) # --- scripts --- @@ -40,7 +40,7 @@ SET(_pyuic_files ) # scripts / pyuic wrappings -PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) +PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) # --- rules --- diff --git a/src/Tools/MeshCut/CMakeLists.txt b/src/Tools/MeshCut/CMakeLists.txt index 139b61f30..aede4aa29 100644 --- a/src/Tools/MeshCut/CMakeLists.txt +++ b/src/Tools/MeshCut/CMakeLists.txt @@ -18,7 +18,7 @@ # IF(SALOME_BUILD_GUI) - INCLUDE(UsePyQt4) + INCLUDE(UsePyQt) ENDIF(SALOME_BUILD_GUI) # --- options --- @@ -69,7 +69,7 @@ IF(SALOME_BUILD_GUI) ) # scripts / pyuic wrappings - PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) + PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) ENDIF(SALOME_BUILD_GUI) diff --git a/src/Tools/Verima/Gui/CMakeLists.txt b/src/Tools/Verima/Gui/CMakeLists.txt index c8e155732..1e1dde46b 100644 --- a/src/Tools/Verima/Gui/CMakeLists.txt +++ b/src/Tools/Verima/Gui/CMakeLists.txt @@ -17,7 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UsePyQt4) +INCLUDE(UsePyQt) # --- scripts --- @@ -44,7 +44,7 @@ SET(_pyuic_files ) # scripts / pyuic wrappings -PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) +PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) # --- rules --- diff --git a/src/Tools/YamsPlug/CMakeLists.txt b/src/Tools/YamsPlug/CMakeLists.txt index 3228f4d59..76dbc842b 100644 --- a/src/Tools/YamsPlug/CMakeLists.txt +++ b/src/Tools/YamsPlug/CMakeLists.txt @@ -21,7 +21,7 @@ IF(SALOME_BUILD_DOC) ADD_SUBDIRECTORY(doc) ENDIF(SALOME_BUILD_DOC) -INCLUDE(UsePyQt4) +INCLUDE(UsePyQt) # --- scripts --- @@ -41,7 +41,7 @@ SET(_pyuic_files ) # scripts / pyuic wrappings -PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) +PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) # --- rules --- diff --git a/src/Tools/blocFissure/ihm/CMakeLists.txt b/src/Tools/blocFissure/ihm/CMakeLists.txt index f8187ef72..195dd3418 100644 --- a/src/Tools/blocFissure/ihm/CMakeLists.txt +++ b/src/Tools/blocFissure/ihm/CMakeLists.txt @@ -17,7 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UsePyQt4) +INCLUDE(UsePyQt) # --- scripts --- @@ -37,7 +37,7 @@ SET(_pyuic_files ) # scripts / pyuic wrappings -PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) +PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) # --- rules --- diff --git a/src/Tools/padder/spadderpy/gui/CMakeLists.txt b/src/Tools/padder/spadderpy/gui/CMakeLists.txt index 5730c4830..15c812f96 100644 --- a/src/Tools/padder/spadderpy/gui/CMakeLists.txt +++ b/src/Tools/padder/spadderpy/gui/CMakeLists.txt @@ -17,7 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -INCLUDE(UsePyQt4) +INCLUDE(UsePyQt) # --- scripts --- @@ -52,7 +52,7 @@ SET(_pyuic_files ) # scripts / pyuic wrappings -PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) +PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) # --- rules --- SALOME_INSTALL_SCRIPTS("${_pyuic_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/smesh/spadder/gui)