PROJECT(SalomeHYDRO C CXX)
-ADD_SUBDIRECTORY (src/HYDRO_tests)
-
# Ensure a proper linker behavior:
CMAKE_POLICY(SET CMP0003 NEW)
## 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)
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()
# Sources
# ========
ADD_SUBDIRECTORY (src/shapelib)
+ADD_SUBDIRECTORY (src/HYDRO_tests)
ADD_SUBDIRECTORY (src/HYDROData)
ADD_SUBDIRECTORY (src/HYDROGUI)
ADD_SUBDIRECTORY (src/HYDROPy)
return HYDROData_SequenceOfObjects();
}
-Standard_Boolean HYDROData_Entity::GetZLevel( Standard_Integer& theLevel ) const
+bool HYDROData_Entity::GetZLevel( int& theLevel ) const
{
theLevel = -1;
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 );
}
/**
* 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.
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& );
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());
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())
{
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++)
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--;
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--;
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();
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)
{
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)
{
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
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
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
#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")
#include "HYDROGUI_DataBrowser.h"
#include "HYDROGUI_Module.h"
#include "HYDROGUI_DataObject.h"
+#include "HYDROGUI_Tool.h"
#include <LightApp_Application.h>
#include <LightApp_OBSelector.h>
// 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 );
// 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 );
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();
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 );
{
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 );
QString HYDROGUI_GeomObjectDlg::getDefaultName()
{
return myDefaultName;
-}
\ No newline at end of file
+}
#include <SUIT_Session.h>
#include <SUIT_FileDlg.h>
#include <HYDROGUI_Module.h>
+#include <HYDROGUI_Tool.h>
#include <SUIT_MessageBox.h>
#include <LightApp_Application.h>
#include <QTableWidget>
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++)
{
return false;
}
return true;
-}
\ No newline at end of file
+}
} 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() ) );
} 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
}
return aPanel;
-}
\ No newline at end of file
+}
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() ) );
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() ) );
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() ) );
myEye = QPixmap( 16, 16 );
myEye.fill( Qt::black );
}
-
- // Set the supported drag actions for the items in the model
- setSupportedDragActions( Qt::MoveAction | Qt::CopyAction );
}
/**
{
}
+Qt::DropActions HYDROGUI_ListModel::supportedDragActions() const
+{
+ return Qt::MoveAction | Qt::CopyAction;
+}
+
/**
*/
QVariant HYDROGUI_ListModel::data( const QModelIndex &theIndex, int theRole ) const
*/
void HYDROGUI_ListModel::setObjects( const Object2VisibleList& theObjects )
{
+ beginResetModel();
myObjects = theObjects;
-
- reset();
+ endResetModel();
}
/**
*/
void HYDROGUI_ListModel::addObject( const Object2Visible& theObject )
{
+ beginResetModel();
myObjects << theObject;
-
- reset();
+ endResetModel();
}
/**
*/
void HYDROGUI_ListModel::removeObjectByName( const QString& theObjectName )
{
+ beginResetModel();
Object2Visible anItem;
foreach( anItem, myObjects ) {
if ( anItem.first->GetName() == theObjectName ) {
break;
}
}
-
myObjects.removeAll(anItem);
-
- reset();
+ endResetModel();
}
void HYDROGUI_ListModel::undoLastMove()
{
+ beginResetModel();
myObjects = myPrevObjects;
- reset();
+ endResetModel();
}
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<int> getIds( const QModelIndexList& theIndexes, bool theIsToSort = true ) const;
bool myIsDecorationEnabled;
};
-#endif
\ No newline at end of file
+#endif
beginResetModel();
myRules = myPrevRules;
endResetModel();
- reset();
}
/**
//
#include "HYDROGUI_PriorityWidget.h"
-
#include "HYDROGUI_PriorityTableModel.h"
-
+#include "HYDROGUI_Tool.h"
#include "HYDROData_PriorityQueue.h"
#include <SUIT_MessageBox.h>
// 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
void HYDROGUI_ColorDelegate::paint( QPainter* thePainter, const QStyleOptionViewItem& theOption,
const QModelIndex& theIndex ) const
{
- QColor aColor = qVariantValue<QColor>( theIndex.data( Qt::BackgroundColorRole ) );
+ QColor aColor = qvariant_cast<QColor>( theIndex.data( Qt::BackgroundColorRole ) );
thePainter->fillRect( theOption.rect, aColor );
}
const QStyleOptionViewItem& theOption,
const QModelIndex& theIndex ) const
{
- QColor aColor = qVariantValue<QColor>( theIndex.data( Qt::BackgroundColorRole ) );
+ QColor aColor = qvariant_cast<QColor>( theIndex.data( Qt::BackgroundColorRole ) );
QColor aNewColor = QColorDialog::getColor( aColor );
if( aNewColor.isValid() )
{
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
#include <QStringList>
#include <QTextCodec>
#include <QWidget>
+#include <QHeaderView>
// Definition of this id allows to use 'latin1' (Qt alias for 'ISO-8859-1')
// encoding instead of default 'System'
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
+}
class QDockWidget;
class QImage;
class QWidget;
+class QHeaderView;
namespace HYDROGUI_Tool
{
HYDROData_SequenceOfObjects GetObjectBackReferences( const Handle(HYDROData_Entity)& theObj );
QMap<QString,HYDROData_SequenceOfObjects> GetObjectsBackReferences
( const Handle_HYDROData_Document& theDocument, const QStringList& theObjectNames );
+
+ void setResizeMode( QHeaderView* theHeader, int theSection, int theMode );
+ void setResizeMode( QHeaderView* theHeader, int theMode );
};
#endif
{
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;
}
}
// 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();
}
include(../../CMake/Common.cmake)
-include(UsePyQt4)
+IF (SalomeGUI_VERSION VERSION_LESS "8.0.0")
+ include(UsePyQt4)
+ELSE()
+ include(UsePyQt)
+ENDIF()
+
# --- options ---
# --- 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})
/**
* 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.
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 )
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} )
-
-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
../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()
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;