Migrate to Qt 5

This commit is contained in:
imn 2015-11-26 17:36:23 +03:00
parent 831ca6c828
commit 1461d54981
17 changed files with 71 additions and 51 deletions

View File

@ -127,12 +127,20 @@ IF(SALOME_BUILD_GUI)
##
## Prerequisites From GUI:
##
# Qt4
# 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(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})

View File

@ -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}")

View File

@ -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;

View File

@ -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();

View File

@ -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<QPushButton*>("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();

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->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();

View File

@ -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<QPushButton*>( aDlg, "OK" );
QPushButton* anOkBtn = aDlg->findChild<QPushButton*>( "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;

View File

@ -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}")

View File

@ -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 )

View File

@ -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

View File

@ -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 ---

View File

@ -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)

View File

@ -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 ---

View File

@ -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 ---

View File

@ -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 ---

View File

@ -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)