Merge Qt5 porting.

This commit is contained in:
imn 2015-11-26 17:36:23 +03:00 committed by rnv
parent e8abed47dd
commit 15a2d78f10
17 changed files with 71 additions and 51 deletions

View File

@ -127,12 +127,20 @@ IF(SALOME_BUILD_GUI)
## ##
## Prerequisites From GUI: ## Prerequisites From GUI:
## ##
# Qt4 # Qt
IF(NOT SALOME_GUI_BUILD_WITH_QT5)
FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml) FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml)
ELSE()
FIND_PACKAGE(SalomeQt5 REQUIRED)
ENDIF()
# SIP # SIP
FIND_PACKAGE(SalomeSIP REQUIRED) # should come after Python and before PyQt4 FIND_PACKAGE(SalomeSIP REQUIRED) # should come after Python and before PyQt5
# PyQt4 # PyQt
IF (NOT SALOME_GUI_BUILD_WITH_QT5)
FIND_PACKAGE(SalomePyQt4 REQUIRED) FIND_PACKAGE(SalomePyQt4 REQUIRED)
ELSE()
FIND_PACKAGE(SalomePyQt5 REQUIRED)
ENDIF()
# Qwt # Qwt
FIND_PACKAGE(SalomeQwt REQUIRED) FIND_PACKAGE(SalomeQwt REQUIRED)
ELSE(EXISTS ${GUI_ROOT_DIR}) ELSE(EXISTS ${GUI_ROOT_DIR})

View File

@ -17,7 +17,7 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
INCLUDE(UseQt4Ext) INCLUDE(UseQtExt)
# --- options --- # --- options ---
# additional include directories # additional include directories
@ -173,7 +173,7 @@ SET(SMESH_HEADERS ${_moc_HEADERS} ${_other_HEADERS})
# --- sources --- # --- sources ---
# sources / moc wrappings # sources / moc wrappings
QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static # sources / static
SET(_other_SOURCES 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}) 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}")

View File

@ -569,7 +569,11 @@ QFrame* SMESHGUI_ComputeDlg::createMainFrame (QWidget* theParent, bool ForEval)
myTable->hideColumn( COL_PUBLISHED ); myTable->hideColumn( COL_PUBLISHED );
myTable->hideColumn( COL_SHAPEID ); myTable->hideColumn( COL_SHAPEID );
myTable->hideColumn( COL_BAD_MESH ); myTable->hideColumn( COL_BAD_MESH );
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
myTable->horizontalHeader()->setResizeMode( COL_ERROR, QHeaderView::Interactive ); myTable->horizontalHeader()->setResizeMode( COL_ERROR, QHeaderView::Interactive );
#else
myTable->horizontalHeader()->setSectionResizeMode( COL_ERROR, QHeaderView::Interactive );
#endif
myTable->setWordWrap( true ); myTable->setWordWrap( true );
myTable->horizontalHeader()->setStretchLastSection( true ); myTable->horizontalHeader()->setStretchLastSection( true );
myTable->setMinimumWidth( 500 ); myTable->setMinimumWidth( 500 );
@ -1710,7 +1714,7 @@ void SMESHGUI_PrecomputeOp::initDialog()
myOrderMgr = new SMESHGUI_MeshOrderMgr( myDlg->getMeshOrderBox() ); myOrderMgr = new SMESHGUI_MeshOrderMgr( myDlg->getMeshOrderBox() );
myOrderMgr->SetMesh( myMesh ); myOrderMgr->SetMesh( myMesh );
bool isOrder = myOrderMgr->GetMeshOrder(myPrevOrder); bool isOrder = myOrderMgr->GetMeshOrder(myPrevOrder);
myDlg->getMeshOrderBox()->setShown(isOrder); myDlg->getMeshOrderBox()->setVisible(isOrder);
if ( !isOrder ) { if ( !isOrder ) {
delete myOrderMgr; delete myOrderMgr;
myOrderMgr = 0; myOrderMgr = 0;

View File

@ -378,7 +378,7 @@ void SMESHGUI_CreatePatternDlg::onSave()
SUIT_FileDlg* aDlg = new SUIT_FileDlg( this, false ); SUIT_FileDlg* aDlg = new SUIT_FileDlg( this, false );
aDlg->setWindowTitle( tr( "SAVE_PATTERN" ) ); aDlg->setWindowTitle( tr( "SAVE_PATTERN" ) );
aDlg->setFileMode( QFileDialog::AnyFile ); aDlg->setFileMode( QFileDialog::AnyFile );
aDlg->setFilter( tr( "PATTERN_FILT" ) ); aDlg->setNameFilter( tr( "PATTERN_FILT" ) );
if ( myName->text() != "" ) if ( myName->text() != "" )
aDlg->selectFile( myName->text() ); aDlg->selectFile( myName->text() );
@ -392,7 +392,7 @@ void SMESHGUI_CreatePatternDlg::onSave()
if ( QFileInfo( fName ).suffix().isEmpty() ) if ( QFileInfo( fName ).suffix().isEmpty() )
fName = autoExtension( fName ); fName = autoExtension( fName );
fName = QDir::convertSeparators( fName ); fName = QDir::toNativeSeparators( fName );
QString aData( myPattern->GetString() ); QString aData( myPattern->GetString() );
long aLen = aData.length(); long aLen = aData.length();

View File

@ -611,7 +611,7 @@ void SMESHGUI_FilterLibraryDlg::onBrowse()
//aDlg->setMode(myMode == COPY_FROM ? QFileDialogP::ExistingFile : QFileDialogP::AnyFile); //aDlg->setMode(myMode == COPY_FROM ? QFileDialogP::ExistingFile : QFileDialogP::AnyFile);
aDlg->setFileMode(myMode == COPY_FROM ? QFileDialog::ExistingFile : QFileDialog::AnyFile); aDlg->setFileMode(myMode == COPY_FROM ? QFileDialog::ExistingFile : QFileDialog::AnyFile);
aDlg->setFilters(prepareFilters()); aDlg->setNameFilters(prepareFilters());
aDlg->selectFile(getFileName()); aDlg->selectFile(getFileName());
QPushButton* anOkBtn = (QPushButton*)aDlg->findChild<QPushButton*>("OK"); QPushButton* anOkBtn = (QPushButton*)aDlg->findChild<QPushButton*>("OK");
@ -629,8 +629,8 @@ void SMESHGUI_FilterLibraryDlg::onBrowse()
if (QFileInfo(fName).suffix().isEmpty()) if (QFileInfo(fName).suffix().isEmpty())
fName = autoExtension(fName); fName = autoExtension(fName);
fName = QDir::convertSeparators(fName); fName = QDir::toNativeSeparators(fName);
QString prev = QDir::convertSeparators(getFileName()); QString prev = QDir::toNativeSeparators(getFileName());
if (prev == fName) if (prev == fName)
return; return;
@ -756,7 +756,7 @@ bool SMESHGUI_FilterLibraryDlg::isPermissionValid(const bool theIsExistingOnly)
if (QFileInfo(fName).suffix().isEmpty()) if (QFileInfo(fName).suffix().isEmpty())
fName = autoExtension(fName); fName = autoExtension(fName);
fName = QDir::convertSeparators(fName); fName = QDir::toNativeSeparators(fName);
if (QFileInfo(fName).exists()) { if (QFileInfo(fName).exists()) {
isWritable = QFileInfo(fName).isWritable(); isWritable = QFileInfo(fName).isWritable();

View File

@ -102,7 +102,7 @@ QPixmap SMESHGUI_MergeDlg::IconFirst()
" .. ... ... ", " .. ... ... ",
" .. .. .. ", " .. .. .. ",
" . . "}; " . . "};
return iconFirst; return QPixmap( iconFirst );
} }
//================================================================================= //=================================================================================

View File

@ -1650,7 +1650,11 @@ SMESHGUI_TreeElemInfo::SMESHGUI_TreeElemInfo( QWidget* parent )
myInfo->setColumnCount( 2 ); myInfo->setColumnCount( 2 );
myInfo->setHeaderLabels( QStringList() << tr( "PROPERTY" ) << tr( "VALUE" ) ); myInfo->setHeaderLabels( QStringList() << tr( "PROPERTY" ) << tr( "VALUE" ) );
myInfo->header()->setStretchLastSection( true ); myInfo->header()->setStretchLastSection( true );
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
myInfo->header()->setResizeMode( 0, QHeaderView::ResizeToContents ); myInfo->header()->setResizeMode( 0, QHeaderView::ResizeToContents );
#else
myInfo->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
#endif
myInfo->setItemDelegate( new ItemDelegate( myInfo ) ); myInfo->setItemDelegate( new ItemDelegate( myInfo ) );
QVBoxLayout* l = new QVBoxLayout( frame() ); QVBoxLayout* l = new QVBoxLayout( frame() );
l->setMargin( 0 ); l->setMargin( 0 );
@ -2342,7 +2346,11 @@ SMESHGUI_AddInfo::SMESHGUI_AddInfo( QWidget* parent )
{ {
setColumnCount( 2 ); setColumnCount( 2 );
header()->setStretchLastSection( true ); header()->setStretchLastSection( true );
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
header()->setResizeMode( 0, QHeaderView::ResizeToContents ); header()->setResizeMode( 0, QHeaderView::ResizeToContents );
#else
header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
#endif
header()->hide(); header()->hide();
} }
@ -3147,7 +3155,7 @@ void SMESHGUI_MeshInfoDlg::dump()
DumpFileDlg fd( this ); DumpFileDlg fd( this );
fd.setWindowTitle( tr( "SAVE_INFO" ) ); fd.setWindowTitle( tr( "SAVE_INFO" ) );
fd.setFilters( aFilters ); fd.setNameFilters( aFilters );
fd.myBaseChk->setChecked( anIsBase ); fd.myBaseChk->setChecked( anIsBase );
fd.myElemChk->setChecked( anIsElem ); fd.myElemChk->setChecked( anIsElem );
fd.myAddChk ->setChecked( anIsAdd ); fd.myAddChk ->setChecked( anIsAdd );
@ -3858,7 +3866,7 @@ void SMESHGUI_CtrlInfoDlg::dump()
DumpFileDlg fd( this ); DumpFileDlg fd( this );
fd.setWindowTitle( tr( "SAVE_INFO" ) ); fd.setWindowTitle( tr( "SAVE_INFO" ) );
fd.setFilters( aFilters ); fd.setNameFilters( aFilters );
fd.myBaseChk->hide(); fd.myBaseChk->hide();
fd.myElemChk->hide(); fd.myElemChk->hide();
fd.myAddChk ->hide(); fd.myAddChk ->hide();

View File

@ -809,10 +809,10 @@ void SMESHGUI_MeshPatternDlg::onOpen()
SUIT_FileDlg* aDlg = new SUIT_FileDlg (this, true); SUIT_FileDlg* aDlg = new SUIT_FileDlg (this, true);
aDlg->setWindowTitle(tr("LOAD_PATTERN")); aDlg->setWindowTitle(tr("LOAD_PATTERN"));
aDlg->setFileMode(QFileDialog::ExistingFile); aDlg->setFileMode(QFileDialog::ExistingFile);
aDlg->setFilters(prepareFilters()); aDlg->setNameFilters(prepareFilters());
if (!myName->text().isEmpty()) if (!myName->text().isEmpty())
aDlg->selectFile(myName->text() + ".smp"); aDlg->selectFile(myName->text() + ".smp");
QPushButton* anOkBtn = qFindChild<QPushButton*>( aDlg, "OK" ); QPushButton* anOkBtn = aDlg->findChild<QPushButton*>( "OK" );
if (anOkBtn != 0) if (anOkBtn != 0)
anOkBtn->setText(tr("SMESH_BUT_OK")); anOkBtn->setText(tr("SMESH_BUT_OK"));
@ -826,9 +826,9 @@ void SMESHGUI_MeshPatternDlg::onOpen()
if (QFileInfo(fName).suffix().isEmpty()) if (QFileInfo(fName).suffix().isEmpty())
fName = autoExtension(fName); 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) if (prev == fName)
return; return;

View File

@ -17,7 +17,7 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
INCLUDE(UseQt4Ext) INCLUDE(UseQtExt)
# --- options --- # --- options ---
# additional include directories # additional include directories
@ -101,7 +101,7 @@ SET(StdMeshersGUI_HEADERS ${_moc_HEADERS} ${_other_HEADERS})
# --- sources --- # --- sources ---
# sources / moc wrappings # sources / moc wrappings
QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / static # sources / static
SET(_other_SOURCES 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(TARGETS StdMeshersGUI EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
INSTALL(FILES ${StdMeshersGUI_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) 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}")

View File

@ -319,10 +319,10 @@ namespace StdMeshersGUI
void GridAxisTab::onMode(int isSpacing) void GridAxisTab::onMode(int isSpacing)
{ {
mySpacingTreeWdg->setShown( isSpacing ); mySpacingTreeWdg->setVisible( isSpacing );
myCoordList->setShown( !isSpacing ); myCoordList->setVisible( !isSpacing );
myStepSpin->setShown( !isSpacing ); myStepSpin->setVisible( !isSpacing );
myStepLabel->setShown( !isSpacing ); myStepLabel->setVisible( !isSpacing );
if ( isSpacing ) if ( isSpacing )
{ {
if ( mySpacingTreeWdg->topLevelItemCount() == 0 ) if ( mySpacingTreeWdg->topLevelItemCount() == 0 )

View File

@ -447,25 +447,25 @@ void StdMeshersGUI_NbSegmentsCreator::onValueChanged()
myTable->setData( arr ); //update data in table myTable->setData( arr ); //update data in table
} }
myScale->setShown( distr==1 ); myScale->setVisible( distr==1 );
myLScale->setShown( distr==1 ); myLScale->setVisible( distr==1 );
myReversedEdgesBox->setShown( distr!=0 ); myReversedEdgesBox->setVisible( distr!=0 );
if ( myReversedEdgesHelper ) { if ( myReversedEdgesHelper ) {
myReversedEdgesHelper->Clear(); myReversedEdgesHelper->Clear();
myReversedEdgesHelper->setShown( distr!=0 ); myReversedEdgesHelper->setVisible( distr!=0 );
} }
myDirectionWidget->ShowPreview( distr!=0 ); myDirectionWidget->ShowPreview( distr!=0 );
bool isFunc = distr==2 || distr==3; bool isFunc = distr==2 || distr==3;
#ifndef DISABLE_PLOT2DVIEWER #ifndef DISABLE_PLOT2DVIEWER
myPreview->setShown( isFunc ); myPreview->setVisible( isFunc );
#endif #endif
myConvBox->setShown( isFunc ); myConvBox->setVisible( isFunc );
myTable->setShown( distr==2 ); myTable->setVisible( distr==2 );
myExpr->setShown( distr==3 ); myExpr->setVisible( distr==3 );
myLExpr->setShown( distr==3 ); myLExpr->setVisible( distr==3 );
myInfo->setShown( distr==3); myInfo->setVisible( distr==3);
#ifndef DISABLE_PLOT2DVIEWER #ifndef DISABLE_PLOT2DVIEWER
//change of preview //change of preview

View File

@ -20,7 +20,7 @@ IF(SALOME_BUILD_DOC)
ADD_SUBDIRECTORY(doc) ADD_SUBDIRECTORY(doc)
ENDIF(SALOME_BUILD_DOC) ENDIF(SALOME_BUILD_DOC)
INCLUDE(UsePyQt4) INCLUDE(UsePyQt)
# --- scripts --- # --- scripts ---
@ -40,7 +40,7 @@ SET(_pyuic_files
) )
# scripts / pyuic wrappings # scripts / pyuic wrappings
PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files})
# --- rules --- # --- rules ---

View File

@ -18,7 +18,7 @@
# #
IF(SALOME_BUILD_GUI) IF(SALOME_BUILD_GUI)
INCLUDE(UsePyQt4) INCLUDE(UsePyQt)
ENDIF(SALOME_BUILD_GUI) ENDIF(SALOME_BUILD_GUI)
# --- options --- # --- options ---
@ -69,7 +69,7 @@ IF(SALOME_BUILD_GUI)
) )
# scripts / pyuic wrappings # scripts / pyuic wrappings
PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files})
ENDIF(SALOME_BUILD_GUI) ENDIF(SALOME_BUILD_GUI)

View File

@ -17,7 +17,7 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
INCLUDE(UsePyQt4) INCLUDE(UsePyQt)
# --- scripts --- # --- scripts ---
@ -44,7 +44,7 @@ SET(_pyuic_files
) )
# scripts / pyuic wrappings # scripts / pyuic wrappings
PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files})
# --- rules --- # --- rules ---

View File

@ -21,7 +21,7 @@ IF(SALOME_BUILD_DOC)
ADD_SUBDIRECTORY(doc) ADD_SUBDIRECTORY(doc)
ENDIF(SALOME_BUILD_DOC) ENDIF(SALOME_BUILD_DOC)
INCLUDE(UsePyQt4) INCLUDE(UsePyQt)
# --- scripts --- # --- scripts ---
@ -41,7 +41,7 @@ SET(_pyuic_files
) )
# scripts / pyuic wrappings # scripts / pyuic wrappings
PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files})
# --- rules --- # --- rules ---

View File

@ -17,7 +17,7 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
INCLUDE(UsePyQt4) INCLUDE(UsePyQt)
# --- scripts --- # --- scripts ---
@ -37,7 +37,7 @@ SET(_pyuic_files
) )
# scripts / pyuic wrappings # scripts / pyuic wrappings
PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files})
# --- rules --- # --- rules ---

View File

@ -17,7 +17,7 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
INCLUDE(UsePyQt4) INCLUDE(UsePyQt)
# --- scripts --- # --- scripts ---
@ -52,7 +52,7 @@ SET(_pyuic_files
) )
# scripts / pyuic wrappings # scripts / pyuic wrappings
PYQT4_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files})
# --- rules --- # --- rules ---
SALOME_INSTALL_SCRIPTS("${_pyuic_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/smesh/spadder/gui) SALOME_INSTALL_SCRIPTS("${_pyuic_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/smesh/spadder/gui)