From c1d7b9278ed93d33e551c973d8e2d22d5431a34b Mon Sep 17 00:00:00 2001 From: asl Date: Wed, 27 Jan 2016 10:54:39 +0300 Subject: [PATCH] Porting to Qt 5 --- CMakeLists.txt | 44 ++++++++++++------- src/HYDROData/HYDROData_Entity.cxx | 8 ++-- src/HYDROData/HYDROData_Entity.h | 4 +- src/HYDROData/HYDROData_LandCoverMap.h | 1 + src/HYDROData/HYDROData_ShapeFile.cxx | 26 +++++------ src/HYDROGUI/CMakeLists.txt | 19 ++++++-- src/HYDROGUI/HYDROGUI_DataBrowser.cxx | 3 +- src/HYDROGUI/HYDROGUI_DataModel.cxx | 28 ++++++------ src/HYDROGUI/HYDROGUI_DataObject.cxx | 2 +- src/HYDROGUI/HYDROGUI_GeomObjectDlg.cxx | 8 ++-- .../HYDROGUI_ImportLandCoverMapDlg.cxx | 5 ++- .../HYDROGUI_ImportObstacleFromFileOp.cxx | 8 ++-- src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx | 2 +- src/HYDROGUI/HYDROGUI_ImportProfilesOp.cxx | 2 +- src/HYDROGUI/HYDROGUI_ImportSinusXOp.cxx | 2 +- src/HYDROGUI/HYDROGUI_ListModel.cxx | 24 +++++----- src/HYDROGUI/HYDROGUI_ListModel.h | 3 +- src/HYDROGUI/HYDROGUI_PriorityTableModel.cxx | 1 - src/HYDROGUI/HYDROGUI_PriorityWidget.cxx | 13 +++--- src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx | 15 ++++--- src/HYDROGUI/HYDROGUI_Tool.cxx | 18 ++++++++ src/HYDROGUI/HYDROGUI_Tool.h | 4 ++ src/HYDROGUI/HYDROGUI_Tool2.cxx | 2 +- src/HYDROGUI/HYDROGUI_VTKPrs.cxx | 2 +- src/HYDROPy/CMakeLists.txt | 13 +++++- src/HYDROPy/HYDROData_Entity.sip | 4 +- src/HYDRO_tests/CMakeLists.txt | 14 +++--- src/HYDRO_tests/ExternalFiles.cmake | 13 ++++-- src/HYDRO_tests/test_HYDROData_Main.cxx | 4 ++ 29 files changed, 181 insertions(+), 111 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8951fca1..36692bf3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,8 +3,6 @@ INCLUDE(CMakeDependentOption) PROJECT(SalomeHYDRO C CXX) -ADD_SUBDIRECTORY (src/HYDRO_tests) - # Ensure a proper linker behavior: CMAKE_POLICY(SET CMP0003 NEW) @@ -92,10 +90,15 @@ OPTION(SALOME_BUILD_TESTS "Build HYDRO tests" ON) ## From KERNEL: ## -# Mandatory products -FIND_PACKAGE(SalomePython REQUIRED) +# Mandatory products: + +FIND_PACKAGE(SalomePython REQUIRED) +FIND_PACKAGE(SalomeCAS REQUIRED) +FIND_PACKAGE(SalomeVTK REQUIRED) +FIND_PACKAGE(SalomeOmniORB REQUIRED) # Optional products: + IF(SALOME_BUILD_TESTS) ENABLE_TESTING() FIND_PACKAGE(SalomeCppUnit) @@ -113,25 +116,31 @@ IF(SALOME_BUILD_DOC) SALOME_LOG_OPTIONAL_PACKAGE(Sphinx SALOME_BUILD_DOC) ENDIF() -# Find optional GUI libraries -IF(SALOME_BUILD_GUI) - # Qt4 - FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui) -ENDIF(SALOME_BUILD_GUI) - ## -## HYDRO specifics +## From GUI: ## -FIND_PACKAGE(SalomeCAS REQUIRED) - -FIND_PACKAGE(SalomeVTK REQUIRED) - FIND_PACKAGE(SalomeSIP REQUIRED) # should come after Python and before PyQt4 -FIND_PACKAGE(SalomePyQt4 REQUIRED) +# Qt +IF(NOT SALOME_GUI_BUILD_WITH_QT5) + FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtWebKit QtOpenGL QtNetwork QtTest) + SET(QT_ROOT_DIR "${QT4_ROOT_DIR}") + SALOME_CONFIGURE_PREPARE(HYDROData HYDROGUI HYDROPy Qt4 PyQt4) +ELSE() + FIND_PACKAGE(SalomeQt5 REQUIRED) + SET(QT_ROOT_DIR "${QT5_ROOT_DIR}") + SALOME_CONFIGURE_PREPARE(HYDROData HYDROGUI HYDROPy Qt5 PyQt5) +ENDIF() -FIND_PACKAGE(SalomeOmniORB REQUIRED) +# PyQt +IF(NOT SALOME_GUI_BUILD_WITH_QT5) + FIND_PACKAGE(SalomePyQt4 REQUIRED) + SET(PYQT_ROOT_DIR "${PYQT4_ROOT_DIR}") +ELSE() + FIND_PACKAGE(SalomePyQt5 REQUIRED) + SET(PYQT_ROOT_DIR "${PYQT5_ROOT_DIR}") +ENDIF() # Detection summary: SALOME_PACKAGE_REPORT_AND_CHECK() @@ -175,6 +184,7 @@ MARK_AS_ADVANCED( # Sources # ======== ADD_SUBDIRECTORY (src/shapelib) +ADD_SUBDIRECTORY (src/HYDRO_tests) ADD_SUBDIRECTORY (src/HYDROData) ADD_SUBDIRECTORY (src/HYDROGUI) ADD_SUBDIRECTORY (src/HYDROPy) diff --git a/src/HYDROData/HYDROData_Entity.cxx b/src/HYDROData/HYDROData_Entity.cxx index 0cdc8f5b..9aaa587e 100644 --- a/src/HYDROData/HYDROData_Entity.cxx +++ b/src/HYDROData/HYDROData_Entity.cxx @@ -269,7 +269,7 @@ HYDROData_SequenceOfObjects HYDROData_Entity::GetAllReferenceObjects() const return HYDROData_SequenceOfObjects(); } -Standard_Boolean HYDROData_Entity::GetZLevel( Standard_Integer& theLevel ) const +bool HYDROData_Entity::GetZLevel( int& theLevel ) const { theLevel = -1; @@ -280,14 +280,14 @@ Standard_Boolean HYDROData_Entity::GetZLevel( Standard_Integer& theLevel ) const if ( aLabel.FindAttribute( TDataStd_Integer::GetID(), anIntVal ) ) { theLevel = anIntVal->Get(); - return Standard_True; + return true; } } - return Standard_False; + return false; } -void HYDROData_Entity::SetZLevel( const Standard_Integer& theLevel ) +void HYDROData_Entity::SetZLevel( int theLevel ) { TDataStd_Integer::Set( myLab.FindChild( DataTag_ZLevel ), theLevel ); } diff --git a/src/HYDROData/HYDROData_Entity.h b/src/HYDROData/HYDROData_Entity.h index 1e41b044..91f74803 100644 --- a/src/HYDROData/HYDROData_Entity.h +++ b/src/HYDROData/HYDROData_Entity.h @@ -235,12 +235,12 @@ public: /** * Returns the z-level for object presentation, -1 if no z-level. */ - HYDRODATA_EXPORT virtual Standard_Boolean GetZLevel( Standard_Integer& theLevel ) const; + HYDRODATA_EXPORT virtual bool GetZLevel( int& theLevel ) const; /** * Set the z-level for object presentation. */ - HYDRODATA_EXPORT virtual void SetZLevel( const Standard_Integer& theLevel ); + HYDRODATA_EXPORT virtual void SetZLevel( int theLevel ); /** * Remove the z-level of object presentation. diff --git a/src/HYDROData/HYDROData_LandCoverMap.h b/src/HYDROData/HYDROData_LandCoverMap.h index 6827d52a..ebaeb1e7 100644 --- a/src/HYDROData/HYDROData_LandCoverMap.h +++ b/src/HYDROData/HYDROData_LandCoverMap.h @@ -116,6 +116,7 @@ public: HYDRODATA_EXPORT bool Remove( const TopoDS_Face& ); HYDRODATA_EXPORT bool Remove( const TopTools_ListOfShape& ); + using HYDROData_Entity::Remove; HYDRODATA_EXPORT bool Split( const Handle( HYDROData_PolylineXY )& ); HYDRODATA_EXPORT bool Split( const TopoDS_Shape& ); diff --git a/src/HYDROData/HYDROData_ShapeFile.cxx b/src/HYDROData/HYDROData_ShapeFile.cxx index 93a75c2a..30a39620 100644 --- a/src/HYDROData/HYDROData_ShapeFile.cxx +++ b/src/HYDROData/HYDROData_ShapeFile.cxx @@ -86,14 +86,14 @@ void HYDROData_ShapeFile::Export(const QString& aFileName, SHPHandle hSHPHandle; if (!aPolyXYSeq.IsEmpty() && aPoly3DSeq.IsEmpty()) { - hSHPHandle = SHPCreate( aFileName.toAscii().data(), SHPT_ARC ); + hSHPHandle = SHPCreate( aFileName.toLatin1().data(), SHPT_ARC ); for (int i = 1; i <= aPolyXYSeq.Size(); i++) if (WriteObjectPolyXY(hSHPHandle, aPolyXYSeq(i)) != 1) aNonExpList.append(aPolyXYSeq(i)->GetName()); } else if (aPolyXYSeq.IsEmpty() && !aPoly3DSeq.IsEmpty()) { - hSHPHandle = SHPCreate( aFileName.toAscii().data(), SHPT_ARCZ ); + hSHPHandle = SHPCreate( aFileName.toLatin1().data(), SHPT_ARCZ ); for (int i = 1; i <= aPoly3DSeq.Size(); i++) if (WriteObjectPoly3D(hSHPHandle, aPoly3DSeq(i)) != 1) aNonExpList.append(aPoly3DSeq(i)->GetName()); @@ -118,7 +118,7 @@ void HYDROData_ShapeFile::Export(const QString& aFileName, const Handle_HYDRODat SHPHandle hSHPHandle = NULL; if ( !aLCM.IsNull() && !aLCM->IsEmpty()) { - hSHPHandle = SHPCreate( aFileName.toAscii().data(), SHPT_POLYGON ); + hSHPHandle = SHPCreate( aFileName.toLatin1().data(), SHPT_POLYGON ); HYDROData_LandCoverMap::Explorer It( aLCM ); for( ; It.More(); It.Next()) { @@ -494,7 +494,7 @@ int HYDROData_ShapeFile::ImportPolygons(const QString theFileName, QStringList& int Stat = TryOpenShapeFile(theFileName); if (Stat != 0) return Stat; - myHSHP = SHPOpen( theFileName.toAscii().data(), "rb" ); + myHSHP = SHPOpen( theFileName.toLatin1().data(), "rb" ); if (!Parse(myHSHP, HYDROData_ShapeFile::ShapeType_Polygon, theShapeTypeOfFile)) return 0; for (size_t i = 0; i < mySHPObjects.size(); i++) @@ -558,10 +558,10 @@ void HYDROData_ShapeFile::ReadSHPPolyXY(Handle(HYDROData_Document) theDocument, anObj->padfY[StartIndex] == anObj->padfY[EndIndex - 1] ) { IsClosed = true; - aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toAscii()), aSectType, true); + aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, true); } else - aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toAscii()), aSectType, false); + aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, false); if (IsClosed) EndIndex--; @@ -611,10 +611,10 @@ void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, anObj->padfZ[StartIndex] == anObj->padfZ[EndIndex - 1]) { IsClosed = true; - aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toAscii()), aSectType, true ); + aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, true ); } else - aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toAscii()), aSectType, false ); + aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, false ); if (IsClosed) EndIndex--; @@ -670,7 +670,7 @@ int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument, anExistingNames.push_back(anIter.Current()->GetName()); SHPHandle aHSHP; - aHSHP = SHPOpen( theFileName.toAscii().data(), "rb" ); + aHSHP = SHPOpen( theFileName.toLatin1().data(), "rb" ); QFileInfo aFileInfo(theFileName); QString aBaseFileName = aFileInfo.baseName(); @@ -776,9 +776,9 @@ int HYDROData_ShapeFile::TryOpenShapeFile(QString theFileName) return -3; FILE* pFileSHP = NULL; - pFileSHP = fopen (aSHPfile.toAscii().data(), "r"); + pFileSHP = fopen (aSHPfile.toLatin1().data(), "r"); FILE* pFileSHX = NULL; - pFileSHX = fopen (aSHXfile.toAscii().data(), "r"); + pFileSHX = fopen (aSHXfile.toLatin1().data(), "r"); if (pFileSHP == NULL || pFileSHX == NULL) { @@ -799,7 +799,7 @@ bool HYDROData_ShapeFile::CheckDBFFileExisting(const QString& theSHPFilePath, QS QString aSHPfile = theSHPFilePath.simplified(); QString aDBFfile = theSHPFilePath.simplified().replace( theSHPFilePath.simplified().size() - 4, 4, ".dbf"); FILE* pFileDBF = NULL; - pFileDBF = fopen (aDBFfile.toAscii().data(), "r"); + pFileDBF = fopen (aDBFfile.toLatin1().data(), "r"); if (pFileDBF == NULL) { @@ -814,7 +814,7 @@ bool HYDROData_ShapeFile::CheckDBFFileExisting(const QString& theSHPFilePath, QS bool HYDROData_ShapeFile::DBF_OpenDBF(const QString& thePathToDBFFile) { - myHDBF = DBFOpen( thePathToDBFFile.toAscii().data(), "r" ); + myHDBF = DBFOpen( thePathToDBFFile.toLatin1().data(), "r" ); if(myHDBF != NULL) return true; else diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt index bcb457a4..5a04636a 100644 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@ -1,5 +1,10 @@ include(../../CMake/Common.cmake) -include(../../CMake/UseQT4EXT.cmake) + +IF (SalomeGUI_VERSION VERSION_LESS "8.0.0") + INCLUDE(UseQt4Ext) +ELSE() + INCLUDE(UseQtExt) +ENDIF() set(PROJECT_HEADERS HYDROGUI.h @@ -145,7 +150,11 @@ set(PROJECT_HEADERS HYDROGUI_TransparencyDlg.h ) -QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${PROJECT_HEADERS}) +IF(NOT SALOME_GUI_BUILD_WITH_QT5) + QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${PROJECT_HEADERS}) +ELSE() + QT_WRAP_MOC(PROJECT_HEADERS_MOC ${PROJECT_HEADERS}) +ENDIF() set(PROJECT_SOURCES HYDROGUI_AbstractDisplayer.cxx @@ -334,7 +343,11 @@ set(GUITS_SOURCES #include(../../CMake/CommonInstall.cmake) # resources -QT4_INSTALL_TS_RESOURCES("${GUITS_SOURCES}" "${SALOME_HYDRO_INSTALL_RES_DATA}") +IF (SalomeGUI_VERSION VERSION_LESS "8.0.0") + QT4_INSTALL_TS_RESOURCES("${GUITS_SOURCES}" "${SALOME_HYDRO_INSTALL_RES_DATA}") +ELSE() + QT_INSTALL_TS_RESOURCES("${GUITS_SOURCES}" "${SALOME_HYDRO_INSTALL_RES_DATA}") +ENDIF() FILE(GLOB GUIPNG_DATA "${CMAKE_CURRENT_SOURCE_DIR}/resources/*.png") FILE(GLOB GUIXML_DATA "${CMAKE_CURRENT_SOURCE_DIR}/resources/*.xml") diff --git a/src/HYDROGUI/HYDROGUI_DataBrowser.cxx b/src/HYDROGUI/HYDROGUI_DataBrowser.cxx index eb5f2539..bfb178a4 100644 --- a/src/HYDROGUI/HYDROGUI_DataBrowser.cxx +++ b/src/HYDROGUI/HYDROGUI_DataBrowser.cxx @@ -19,6 +19,7 @@ #include "HYDROGUI_DataBrowser.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_DataObject.h" +#include "HYDROGUI_Tool.h" #include #include @@ -277,7 +278,7 @@ HYDROGUI_DataBrowser::HYDROGUI_DataBrowser( HYDROGUI_Module* theModule, // Create OBSelector new HYDROGUI_OBSelector( this, theModule->getApp()->selectionMgr() ); - treeView()->header()->setResizeMode(SUIT_DataObject::VisibilityId, QHeaderView::Fixed); + HYDROGUI_Tool::setResizeMode( treeView()->header(), SUIT_DataObject::VisibilityId, QHeaderView::Fixed ); treeView()->header()->moveSection(SUIT_DataObject::NameId,SUIT_DataObject::VisibilityId); treeView()->setColumnWidth(SUIT_DataObject::VisibilityId, VISIBILITY_COLUMN_WIDTH); treeView()->hideColumn( SUIT_DataObject::VisibilityId ); diff --git a/src/HYDROGUI/HYDROGUI_DataModel.cxx b/src/HYDROGUI/HYDROGUI_DataModel.cxx index 12938432..d2acbf88 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.cxx +++ b/src/HYDROGUI/HYDROGUI_DataModel.cxx @@ -270,40 +270,40 @@ void HYDROGUI_DataModel::update( const int theStudyId ) // Create root objects: // IMAGES - LightApp_DataObject* anImageRootObj = createObject( aNewRootObj, tr( partitionName( KIND_IMAGE ).toAscii() ) ); + LightApp_DataObject* anImageRootObj = createObject( aNewRootObj, tr( partitionName( KIND_IMAGE ).toLatin1() ) ); // BATHYMETRY - LightApp_DataObject* aBathymetryRootObj = createObject( aNewRootObj, tr( partitionName( KIND_BATHYMETRY ).toAscii() ) ); + LightApp_DataObject* aBathymetryRootObj = createObject( aNewRootObj, tr( partitionName( KIND_BATHYMETRY ).toLatin1() ) ); // ARTIFICIAL OBJECTS - LightApp_DataObject* anArtificialObjectsRootObj = createObject( aNewRootObj, tr( partitionName( KIND_ARTIFICIAL_OBJECT ).toAscii() ) ); + LightApp_DataObject* anArtificialObjectsRootObj = createObject( aNewRootObj, tr( partitionName( KIND_ARTIFICIAL_OBJECT ).toLatin1() ) ); // NATURAL OBJECTS - LightApp_DataObject* aNaturalObjectsRootObj = createObject( aNewRootObj, tr( partitionName( KIND_NATURAL_OBJECT ).toAscii() ) ); + LightApp_DataObject* aNaturalObjectsRootObj = createObject( aNewRootObj, tr( partitionName( KIND_NATURAL_OBJECT ).toLatin1() ) ); // OBSTACLES - LightApp_DataObject* anObstaclesRootObj = createObject( aNewRootObj, tr( partitionName( KIND_OBSTACLE ).toAscii() ) ); + LightApp_DataObject* anObstaclesRootObj = createObject( aNewRootObj, tr( partitionName( KIND_OBSTACLE ).toLatin1() ) ); // STRICKLER TABLES - LightApp_DataObject* aStricklerTablesRootObj = createObject( aNewRootObj, tr( partitionName( KIND_STRICKLER_TABLE ).toAscii() ) ); + LightApp_DataObject* aStricklerTablesRootObj = createObject( aNewRootObj, tr( partitionName( KIND_STRICKLER_TABLE ).toLatin1() ) ); // LAND COVER MAPS - LightApp_DataObject* aLandCoversRootObj = createObject( aNewRootObj, tr( partitionName( KIND_LAND_COVER_MAP ).toAscii() ) ); + LightApp_DataObject* aLandCoversRootObj = createObject( aNewRootObj, tr( partitionName( KIND_LAND_COVER_MAP ).toLatin1() ) ); // CALCULATION CASES - LightApp_DataObject* aCalculRootObj = createObject( aNewRootObj, tr( partitionName( KIND_CALCULATION ).toAscii() ) ); + LightApp_DataObject* aCalculRootObj = createObject( aNewRootObj, tr( partitionName( KIND_CALCULATION ).toLatin1() ) ); // POLYLINES - LightApp_DataObject* aPolylineRootObj = createObject( aNewRootObj, tr( partitionName( KIND_POLYLINEXY ).toAscii() ) ); + LightApp_DataObject* aPolylineRootObj = createObject( aNewRootObj, tr( partitionName( KIND_POLYLINEXY ).toLatin1() ) ); // POLYLINES - LightApp_DataObject* aPolyline3DRootObj = createObject( aNewRootObj, tr( partitionName( KIND_POLYLINE ).toAscii() ) ); + LightApp_DataObject* aPolyline3DRootObj = createObject( aNewRootObj, tr( partitionName( KIND_POLYLINE ).toLatin1() ) ); // PROFILES - LightApp_DataObject* aProfileRootObj = createObject( aNewRootObj, tr( partitionName( KIND_PROFILE ).toAscii() ) ); + LightApp_DataObject* aProfileRootObj = createObject( aNewRootObj, tr( partitionName( KIND_PROFILE ).toLatin1() ) ); // VISUAL STATES - LightApp_DataObject* aVisualStateRootObj = createObject( aNewRootObj, tr( partitionName( KIND_VISUAL_STATE ).toAscii() ) ); + LightApp_DataObject* aVisualStateRootObj = createObject( aNewRootObj, tr( partitionName( KIND_VISUAL_STATE ).toLatin1() ) ); int aNoStricklerTableObj = 0; HYDROData_Iterator anIterator( aDocument, KIND_UNKNOWN ); @@ -964,10 +964,10 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent, createObject( aPolylineSect, aPolyline, aGuiObj->entry(), false ); LightApp_DataObject* aCaseAOSect = - createObject( aGuiObj, tr( partitionName( KIND_ARTIFICIAL_OBJECT ).toAscii() ), + createObject( aGuiObj, tr( partitionName( KIND_ARTIFICIAL_OBJECT ).toLatin1() ), aGuiObj->entry() ); LightApp_DataObject* aCaseNOSect = - createObject( aGuiObj, tr( partitionName( KIND_NATURAL_OBJECT ).toAscii() ), + createObject( aGuiObj, tr( partitionName( KIND_NATURAL_OBJECT ).toLatin1() ), aGuiObj->entry() ); HYDROData_SequenceOfObjects aSeq = aCaseObj->GetGeometryObjects(); diff --git a/src/HYDROGUI/HYDROGUI_DataObject.cxx b/src/HYDROGUI/HYDROGUI_DataObject.cxx index 8ec9658d..890e29a9 100644 --- a/src/HYDROGUI/HYDROGUI_DataObject.cxx +++ b/src/HYDROGUI/HYDROGUI_DataObject.cxx @@ -161,7 +161,7 @@ QPixmap HYDROGUI_DataObject::icon( const int theId ) const anObjectKind = aFatherObj->GetKind(); } - anIcon = QObject::tr( QString("HYDRO_%1TYPE%2_ICO").arg( aNeedUpdate ).arg( anObjectKind ).toAscii() ); + anIcon = QObject::tr( QString("HYDRO_%1TYPE%2_ICO").arg( aNeedUpdate ).arg( anObjectKind ).toLatin1() ); } return aResMgr->loadPixmap( "HYDRO", anIcon ); diff --git a/src/HYDROGUI/HYDROGUI_GeomObjectDlg.cxx b/src/HYDROGUI/HYDROGUI_GeomObjectDlg.cxx index 5180be14..1179745d 100644 --- a/src/HYDROGUI/HYDROGUI_GeomObjectDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_GeomObjectDlg.cxx @@ -179,14 +179,14 @@ void HYDROGUI_GeomObjectDlg::onBrowse() { SUIT_FileDlg* aFileDlg = new SUIT_FileDlg( this, true ); aFileDlg->setWindowTitle( tr("IMPORT_OBSTACLE_FROM_FILE") ); - aFileDlg->setFilter( tr("OBSTACLE_FILTER") ); + aFileDlg->setNameFilter( tr("OBSTACLE_FILTER") ); if ( !lastUsedFilter.isEmpty() ) { - aFileDlg->selectFilter( lastUsedFilter ); + aFileDlg->selectNameFilter( lastUsedFilter ); } if ( aFileDlg->exec() == QDialog::Accepted ) { QString aFileName = aFileDlg->selectedFile(); - lastUsedFilter = aFileDlg->selectedFilter(); + lastUsedFilter = aFileDlg->selectedNameFilter(); if ( !aFileName.isEmpty() ) { myFileName->setText( aFileName ); @@ -261,4 +261,4 @@ void HYDROGUI_GeomObjectDlg::setDefaultName( const QString& theName ) QString HYDROGUI_GeomObjectDlg::getDefaultName() { return myDefaultName; -} \ No newline at end of file +} diff --git a/src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.cxx b/src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.cxx index d99c13e4..2d2e8bd6 100644 --- a/src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -269,7 +270,7 @@ void HYDROGUI_ImportLandCoverMapDlg::FillCorrespondenceTable(const QStringList& myCorrTableWidget->setHorizontalHeaderItem(0, aHeader_1); myCorrTableWidget->setHorizontalHeaderItem(1, aHeader_2); myCorrTableWidget->setHorizontalHeaderItem(2, aHeader_3); - myCorrTableWidget->horizontalHeader()->setResizeMode( QHeaderView::ResizeToContents ); + HYDROGUI_Tool::setResizeMode( myCorrTableWidget->horizontalHeader(), QHeaderView::ResizeToContents ); // for (int i = 0; i < aFCSize; i++) { @@ -453,4 +454,4 @@ bool HYDROGUI_ImportLandCoverMapDlg::CheckFirstPageFilling() const return false; } return true; -} \ No newline at end of file +} diff --git a/src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.cxx b/src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.cxx index 5a639978..9c0743c0 100644 --- a/src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.cxx @@ -72,9 +72,9 @@ void HYDROGUI_ImportObstacleFromFileOp::startOperation() } else { myFileDlg = new SUIT_FileDlg( module()->getApp()->desktop(), true ); myFileDlg->setWindowTitle( getName() ); - myFileDlg->setFilter( tr("OBSTACLE_FILTER") ); + myFileDlg->setNameFilter( tr("OBSTACLE_FILTER") ); if ( !lastUsedFilter.isEmpty() ) { - myFileDlg->selectFilter( lastUsedFilter ); + myFileDlg->selectNameFilter( lastUsedFilter ); } connect( myFileDlg, SIGNAL( accepted() ), this, SLOT( onApply() ) ); @@ -118,7 +118,7 @@ bool HYDROGUI_ImportObstacleFromFileOp::processApply( int& theUpdateFlags, } else if ( myFileDlg ) { // Get file name and file filter defined by the user aFileName = myFileDlg->selectedFile(); - lastUsedFilter = myFileDlg->selectedFilter(); + lastUsedFilter = myFileDlg->selectedNameFilter(); } // Check the file name @@ -195,4 +195,4 @@ HYDROGUI_InputPanel* HYDROGUI_ImportObstacleFromFileOp::createInputPanel() const } return aPanel; -} \ No newline at end of file +} diff --git a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx index 7cdbd1ed..a82fecdb 100644 --- a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx @@ -58,7 +58,7 @@ void HYDROGUI_ImportPolylineOp::startOperation() myFileDlg = new SUIT_FileDlg( module()->getApp()->desktop(), true ); myFileDlg->setWindowTitle( getName() ); myFileDlg->setFileMode( SUIT_FileDlg::ExistingFiles ); - myFileDlg->setFilter( tr("POLYLINE_FILTER") ); + myFileDlg->setNameFilter( tr("POLYLINE_FILTER") ); connect( myFileDlg, SIGNAL( accepted() ), this, SLOT( onApply() ) ); connect( myFileDlg, SIGNAL( rejected() ), this, SLOT( onCancel() ) ); diff --git a/src/HYDROGUI/HYDROGUI_ImportProfilesOp.cxx b/src/HYDROGUI/HYDROGUI_ImportProfilesOp.cxx index deaab0c3..9e12b9ee 100644 --- a/src/HYDROGUI/HYDROGUI_ImportProfilesOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportProfilesOp.cxx @@ -52,7 +52,7 @@ void HYDROGUI_ImportProfilesOp::startOperation() myFileDlg = new SUIT_FileDlg( module()->getApp()->desktop(), true ); myFileDlg->setWindowTitle( getName() ); myFileDlg->setFileMode( SUIT_FileDlg::ExistingFiles ); - myFileDlg->setFilter( tr("PROFILE_FILTER") ); + myFileDlg->setNameFilter( tr("PROFILE_FILTER") ); connect( myFileDlg, SIGNAL( accepted() ), this, SLOT( onApply() ) ); connect( myFileDlg, SIGNAL( rejected() ), this, SLOT( onCancel() ) ); diff --git a/src/HYDROGUI/HYDROGUI_ImportSinusXOp.cxx b/src/HYDROGUI/HYDROGUI_ImportSinusXOp.cxx index 4f30e802..6907a30f 100644 --- a/src/HYDROGUI/HYDROGUI_ImportSinusXOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportSinusXOp.cxx @@ -59,7 +59,7 @@ void HYDROGUI_ImportSinusXOp::startOperation() myFileDlg = new SUIT_FileDlg( module()->getApp()->desktop(), true ); myFileDlg->setWindowTitle( getName() ); myFileDlg->setFileMode( SUIT_FileDlg::ExistingFiles ); - myFileDlg->setFilter( tr("SINUSX_FILTER") ); + myFileDlg->setNameFilter( tr("SINUSX_FILTER") ); connect( myFileDlg, SIGNAL( accepted() ), this, SLOT( onApply() ) ); connect( myFileDlg, SIGNAL( rejected() ), this, SLOT( onCancel() ) ); diff --git a/src/HYDROGUI/HYDROGUI_ListModel.cxx b/src/HYDROGUI/HYDROGUI_ListModel.cxx index b112dd34..9355bbd4 100644 --- a/src/HYDROGUI/HYDROGUI_ListModel.cxx +++ b/src/HYDROGUI/HYDROGUI_ListModel.cxx @@ -51,9 +51,6 @@ HYDROGUI_ListModel::HYDROGUI_ListModel( QObject* theParent ) myEye = QPixmap( 16, 16 ); myEye.fill( Qt::black ); } - - // Set the supported drag actions for the items in the model - setSupportedDragActions( Qt::MoveAction | Qt::CopyAction ); } /** @@ -63,6 +60,11 @@ HYDROGUI_ListModel::~HYDROGUI_ListModel() { } +Qt::DropActions HYDROGUI_ListModel::supportedDragActions() const +{ + return Qt::MoveAction | Qt::CopyAction; +} + /** */ QVariant HYDROGUI_ListModel::data( const QModelIndex &theIndex, int theRole ) const @@ -128,9 +130,9 @@ int HYDROGUI_ListModel::rowCount( const QModelIndex &theParent ) const */ void HYDROGUI_ListModel::setObjects( const Object2VisibleList& theObjects ) { + beginResetModel(); myObjects = theObjects; - - reset(); + endResetModel(); } /** @@ -154,9 +156,9 @@ HYDROGUI_ListModel::ObjectList HYDROGUI_ListModel::getObjects() const */ void HYDROGUI_ListModel::addObject( const Object2Visible& theObject ) { + beginResetModel(); myObjects << theObject; - - reset(); + endResetModel(); } /** @@ -165,16 +167,15 @@ void HYDROGUI_ListModel::addObject( const Object2Visible& theObject ) */ void HYDROGUI_ListModel::removeObjectByName( const QString& theObjectName ) { + beginResetModel(); Object2Visible anItem; foreach( anItem, myObjects ) { if ( anItem.first->GetName() == theObjectName ) { break; } } - myObjects.removeAll(anItem); - - reset(); + endResetModel(); } @@ -492,6 +493,7 @@ void HYDROGUI_ListModel::setDecorationEnabled( const bool theIsToEnable ) void HYDROGUI_ListModel::undoLastMove() { + beginResetModel(); myObjects = myPrevObjects; - reset(); + endResetModel(); } diff --git a/src/HYDROGUI/HYDROGUI_ListModel.h b/src/HYDROGUI/HYDROGUI_ListModel.h index adc0e42c..920222e9 100644 --- a/src/HYDROGUI/HYDROGUI_ListModel.h +++ b/src/HYDROGUI/HYDROGUI_ListModel.h @@ -56,6 +56,7 @@ public: virtual QStringList mimeTypes() const; virtual bool dropMimeData( const QMimeData* theData, Qt::DropAction theAction, int theRow, int theColumn, const QModelIndex& theParent ); + virtual Qt::DropActions supportedDragActions() const; virtual Qt::DropActions supportedDropActions() const; QList getIds( const QModelIndexList& theIndexes, bool theIsToSort = true ) const; @@ -88,4 +89,4 @@ private: bool myIsDecorationEnabled; }; -#endif \ No newline at end of file +#endif diff --git a/src/HYDROGUI/HYDROGUI_PriorityTableModel.cxx b/src/HYDROGUI/HYDROGUI_PriorityTableModel.cxx index 0d7061cb..0b008616 100644 --- a/src/HYDROGUI/HYDROGUI_PriorityTableModel.cxx +++ b/src/HYDROGUI/HYDROGUI_PriorityTableModel.cxx @@ -530,7 +530,6 @@ void HYDROGUI_PriorityTableModel::undoLastChange() beginResetModel(); myRules = myPrevRules; endResetModel(); - reset(); } /** diff --git a/src/HYDROGUI/HYDROGUI_PriorityWidget.cxx b/src/HYDROGUI/HYDROGUI_PriorityWidget.cxx index e6e15e01..59ef21ae 100644 --- a/src/HYDROGUI/HYDROGUI_PriorityWidget.cxx +++ b/src/HYDROGUI/HYDROGUI_PriorityWidget.cxx @@ -17,9 +17,8 @@ // #include "HYDROGUI_PriorityWidget.h" - #include "HYDROGUI_PriorityTableModel.h" - +#include "HYDROGUI_Tool.h" #include "HYDROData_PriorityQueue.h" #include @@ -154,12 +153,12 @@ HYDROGUI_PriorityWidget::HYDROGUI_PriorityWidget( QWidget* theParent ) // Set resize mode myTable->horizontalHeader()->setStretchLastSection( false); - myTable->horizontalHeader()->setResizeMode( 0, QHeaderView::Stretch ); - myTable->horizontalHeader()->setResizeMode( 1, QHeaderView::ResizeToContents ); - myTable->horizontalHeader()->setResizeMode( 2, QHeaderView::Stretch ); - myTable->horizontalHeader()->setResizeMode( 3, QHeaderView::ResizeToContents ); + HYDROGUI_Tool::setResizeMode( myTable->horizontalHeader(), 0, QHeaderView::Stretch ); + HYDROGUI_Tool::setResizeMode( myTable->horizontalHeader(), 1, QHeaderView::ResizeToContents ); + HYDROGUI_Tool::setResizeMode( myTable->horizontalHeader(), 2, QHeaderView::Stretch ); + HYDROGUI_Tool::setResizeMode( myTable->horizontalHeader(), 3, QHeaderView::ResizeToContents ); - myTable->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents ); + HYDROGUI_Tool::setResizeMode( myTable->verticalHeader(), QHeaderView::ResizeToContents ); // Layout // buttons diff --git a/src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx b/src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx index 6c14e957..16b60704 100644 --- a/src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_StricklerTableDlg.cxx @@ -46,7 +46,7 @@ HYDROGUI_ColorDelegate::~HYDROGUI_ColorDelegate() void HYDROGUI_ColorDelegate::paint( QPainter* thePainter, const QStyleOptionViewItem& theOption, const QModelIndex& theIndex ) const { - QColor aColor = qVariantValue( theIndex.data( Qt::BackgroundColorRole ) ); + QColor aColor = qvariant_cast( theIndex.data( Qt::BackgroundColorRole ) ); thePainter->fillRect( theOption.rect, aColor ); } @@ -54,7 +54,7 @@ QWidget* HYDROGUI_ColorDelegate::createEditor( QWidget* theParent, const QStyleOptionViewItem& theOption, const QModelIndex& theIndex ) const { - QColor aColor = qVariantValue( theIndex.data( Qt::BackgroundColorRole ) ); + QColor aColor = qvariant_cast( theIndex.data( Qt::BackgroundColorRole ) ); QColor aNewColor = QColorDialog::getColor( aColor ); if( aNewColor.isValid() ) { @@ -166,13 +166,14 @@ HYDROGUI_StricklerTableDlg::HYDROGUI_StricklerTableDlg( HYDROGUI_Module* theModu myTable->setHorizontalHeaderLabels( aColumnNames ); myTable->horizontalHeader()->setStretchLastSection( false ); - myTable->horizontalHeader()->setResizeMode( 0, QHeaderView::ResizeToContents ); - myTable->horizontalHeader()->setResizeMode( 1, QHeaderView::ResizeToContents ); - myTable->horizontalHeader()->setResizeMode( 2, QHeaderView::ResizeToContents ); - myTable->horizontalHeader()->setResizeMode( 3, QHeaderView::Stretch ); + + HYDROGUI_Tool::setResizeMode( myTable->horizontalHeader(), 0, QHeaderView::ResizeToContents ); + HYDROGUI_Tool::setResizeMode( myTable->horizontalHeader(), 1, QHeaderView::ResizeToContents ); + HYDROGUI_Tool::setResizeMode( myTable->horizontalHeader(), 2, QHeaderView::ResizeToContents ); + HYDROGUI_Tool::setResizeMode( myTable->horizontalHeader(), 3, QHeaderView::Stretch ); myTable->horizontalHeader()->setMinimumSectionSize( 50 ); - myTable->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents ); + HYDROGUI_Tool::setResizeMode( myTable->verticalHeader(), QHeaderView::ResizeToContents ); // Layout // buttons diff --git a/src/HYDROGUI/HYDROGUI_Tool.cxx b/src/HYDROGUI/HYDROGUI_Tool.cxx index f86499f2..5b3fdd0d 100644 --- a/src/HYDROGUI/HYDROGUI_Tool.cxx +++ b/src/HYDROGUI/HYDROGUI_Tool.cxx @@ -32,6 +32,7 @@ #include #include #include +#include // Definition of this id allows to use 'latin1' (Qt alias for 'ISO-8859-1') // encoding instead of default 'System' @@ -339,3 +340,20 @@ Handle(Image_PixMap) HYDROGUI_Tool::Pixmap( const QImage& theImage ) return pix; } +void HYDROGUI_Tool::setResizeMode( QHeaderView* theHeader, int theSection, int theMode ) +{ +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + theHeader->setResizeMode( theSection, (QHeaderView::ResizeMode)theMode ); +#else + theHeader->setSectionResizeMode( theSection, (QHeaderView::ResizeMode)theMode ); +#endif +} + +void HYDROGUI_Tool::setResizeMode( QHeaderView* theHeader, int theMode ) +{ +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + theHeader->setResizeMode( (QHeaderView::ResizeMode)theMode ); +#else + theHeader->setSectionResizeMode( (QHeaderView::ResizeMode)theMode ); +#endif +} diff --git a/src/HYDROGUI/HYDROGUI_Tool.h b/src/HYDROGUI/HYDROGUI_Tool.h index 99aa175c..1c658794 100644 --- a/src/HYDROGUI/HYDROGUI_Tool.h +++ b/src/HYDROGUI/HYDROGUI_Tool.h @@ -30,6 +30,7 @@ class Handle_TCollection_HExtendedString; class QDockWidget; class QImage; class QWidget; +class QHeaderView; namespace HYDROGUI_Tool { @@ -59,6 +60,9 @@ namespace HYDROGUI_Tool HYDROData_SequenceOfObjects GetObjectBackReferences( const Handle(HYDROData_Entity)& theObj ); QMap GetObjectsBackReferences ( const Handle_HYDROData_Document& theDocument, const QStringList& theObjectNames ); + + void setResizeMode( QHeaderView* theHeader, int theSection, int theMode ); + void setResizeMode( QHeaderView* theHeader, int theMode ); }; #endif diff --git a/src/HYDROGUI/HYDROGUI_Tool2.cxx b/src/HYDROGUI/HYDROGUI_Tool2.cxx index c87743e0..ef1962e8 100644 --- a/src/HYDROGUI/HYDROGUI_Tool2.cxx +++ b/src/HYDROGUI/HYDROGUI_Tool2.cxx @@ -244,7 +244,7 @@ ObjectKind HYDROGUI_Tool::GetSelectedPartition( HYDROGUI_Module* theModule ) { anEntry.remove( aPrefix ); for( ObjectKind anObjectKind = KIND_UNKNOWN + 1; anObjectKind <= KIND_LAST; anObjectKind++ ) - if( HYDROGUI_DataModel::tr( HYDROGUI_DataModel::partitionName( anObjectKind ).toAscii() ) == anEntry ) + if( HYDROGUI_DataModel::tr( HYDROGUI_DataModel::partitionName( anObjectKind ).toLatin1() ) == anEntry ) return anObjectKind; } } diff --git a/src/HYDROGUI/HYDROGUI_VTKPrs.cxx b/src/HYDROGUI/HYDROGUI_VTKPrs.cxx index c16dbb01..925f013c 100644 --- a/src/HYDROGUI/HYDROGUI_VTKPrs.cxx +++ b/src/HYDROGUI/HYDROGUI_VTKPrs.cxx @@ -34,7 +34,7 @@ HYDROGUI_VTKPrs::HYDROGUI_VTKPrs( const Handle(HYDROData_Entity)& theObject ) // Define IO for actors to be added: QString anEntry = HYDROGUI_DataObject::dataObjectEntry( theObject ); myIO = new SALOME_InteractiveObject( - anEntry.toAscii(), QString::number( theObject->GetKind() ).toAscii(), theObject->GetName().toAscii() ); + anEntry.toLatin1(), QString::number( theObject->GetKind() ).toLatin1(), theObject->GetName().toLatin1() ); myZRange[0] = HYDROData_IAltitudeObject::GetInvalidAltitude(); myZRange[1] = HYDROData_IAltitudeObject::GetInvalidAltitude(); } diff --git a/src/HYDROPy/CMakeLists.txt b/src/HYDROPy/CMakeLists.txt index c15ed61c..aace69f2 100644 --- a/src/HYDROPy/CMakeLists.txt +++ b/src/HYDROPy/CMakeLists.txt @@ -1,5 +1,10 @@ include(../../CMake/Common.cmake) -include(UsePyQt4) +IF (SalomeGUI_VERSION VERSION_LESS "8.0.0") + include(UsePyQt4) +ELSE() + include(UsePyQt) +ENDIF() + # --- options --- @@ -87,7 +92,11 @@ SET(_add_SOURCES # --- sources --- # sources / sip wrappings -PYQT4_WRAP_SIP(_sip_SOURCES ${_sip_files} SOURCES ${_add_SOURCES}) +IF (SalomeGUI_VERSION VERSION_LESS "8.0.0") + PYQT4_WRAP_SIP(_sip_SOURCES ${_sip_files} SOURCES ${_add_SOURCES}) +ELSE() + PYQT_WRAP_SIP(_sip_SOURCES ${_sip_files} SOURCES ${_add_SOURCES}) +ENDIF() # sources / to compile SET(HYDROPy_SOURCES ${_sip_SOURCES}) diff --git a/src/HYDROPy/HYDROData_Entity.sip b/src/HYDROPy/HYDROData_Entity.sip index fda3ec35..1986b5c1 100644 --- a/src/HYDROPy/HYDROData_Entity.sip +++ b/src/HYDROPy/HYDROData_Entity.sip @@ -244,12 +244,12 @@ public: /** * Returns the z-level for object presentation, -1 if no z-level. */ - virtual bool GetZLevel( int& theLevel ) const [Standard_Boolean ( Standard_Integer& )]; + virtual bool GetZLevel( int& theLevel ) const; /** * Set the z-level for object presentation. */ - virtual void SetZLevel( const int& theLevel ) [void ( const Standard_Integer& )]; + virtual void SetZLevel( int theLevel ); /** * Remove the z-level of object presentation. diff --git a/src/HYDRO_tests/CMakeLists.txt b/src/HYDRO_tests/CMakeLists.txt index 07c05917..61cc4e7f 100644 --- a/src/HYDRO_tests/CMakeLists.txt +++ b/src/HYDRO_tests/CMakeLists.txt @@ -61,7 +61,7 @@ ENDIF() SET( CPPUNIT_INCLUDES $ENV{CPPUNIT_ROOT_DIR}/include ) SET( CAS_INCLUDES $ENV{CAS_ROOT_DIR}/inc ) -SET( QT_INCLUDES $ENV{QT4_ROOT_DIR}/include $ENV{QT4_ROOT_DIR}/include/QtCore $ENV{QT4_ROOT_DIR}/include/QtGui $ENV{QT4_ROOT_DIR}/include/QtTest ) +#SET( QT_INCLUDES $ENV{QT_ROOT_DIR}/include $ENV{QT_ROOT_DIR}/include/QtCore $ENV{QT_ROOT_DIR}/include/QtGui $ENV{QT_ROOT_DIR}/include/QtTest ) SET( KERNEL_INCLUDES $ENV{KERNEL_ROOT_DIR}/include/salome ) SET( GUI_INCLUDES $ENV{GUI_ROOT_DIR}/include/salome ) SET( GEOM_INCLUDES $ENV{GEOM_ROOT_DIR}/include/salome ) @@ -73,12 +73,12 @@ ELSE() ENDIF() SET( CAS_LIBRARIES TKernel TKLCAF TKCAF TKCDF TKMath TKG2d TKG3d TKBRep TKGeomBase TKTopAlgo TKGeomAlgo TKBool TKShHealing TKXSBase TKOffset TKHLR TKBO TKV3d TKService TKMesh ) -link_directories( $ENV{QT4_ROOT_DIR}/lib ) -IF( ${WIN32} ) - SET( QT_LIBRARIES QtCored4 QtGuid4 QtTestd4 ) -ELSE() - SET( QT_LIBRARIES QtCore QtGui QtTest ) -ENDIF() +#link_directories( $ENV{QT4_ROOT_DIR}/lib ) +#IF( ${WIN32} ) +# SET( QT_LIBRARIES QtCored4 QtGuid4 QtTestd4 ) +#ELSE() +# SET( QT_LIBRARIES QtCore QtGui QtTest ) +#ENDIF() link_directories( $ENV{CPPUNIT_ROOT_DIR}/lib ) IF( ${WIN32} ) diff --git a/src/HYDRO_tests/ExternalFiles.cmake b/src/HYDRO_tests/ExternalFiles.cmake index df610ea5..97d01b8e 100644 --- a/src/HYDRO_tests/ExternalFiles.cmake +++ b/src/HYDRO_tests/ExternalFiles.cmake @@ -1,5 +1,8 @@ - -find_package(Qt4 4.8.4 REQUIRED QtCore QtGui ) +IF (SalomeGUI_VERSION VERSION_LESS "8.0.0") + INCLUDE(UseQt4Ext) +ELSE() + INCLUDE(UseQtExt) +ENDIF() set( EXTERNAL_FILES ../HYDROData/HYDROData_AltitudeObject.cxx @@ -73,4 +76,8 @@ set( MOC_HEADERS ../HYDROGUI/HYDROGUI_StricklerTableDlg.h ) -QT4_WRAP_CPP( PROJECT_MOC_HEADERS ${MOC_HEADERS} ) +IF (SalomeGUI_VERSION VERSION_LESS "8.0.0") + QT4_WRAP_CPP( PROJECT_MOC_HEADERS ${MOC_HEADERS} ) +ELSE() + QT_WRAP_MOC( PROJECT_MOC_HEADERS ${MOC_HEADERS} ) +ENDIF() diff --git a/src/HYDRO_tests/test_HYDROData_Main.cxx b/src/HYDRO_tests/test_HYDROData_Main.cxx index 74bb9315..90a5559e 100644 --- a/src/HYDRO_tests/test_HYDROData_Main.cxx +++ b/src/HYDRO_tests/test_HYDROData_Main.cxx @@ -40,7 +40,11 @@ int main( int argc, char* argv[] ) int W = 800, H = 600; aWindow->setGeometry( 200, 200, W, H ); aWindow->show(); +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) QTest::qWaitForWindowShown( aWindow ); +#else + QTest::qWaitForWindowExposed( aWindow ); +#endif int dy = 34; //std::cout << dx << "," << dy << std::endl; -- 2.39.2