From 05357765fa2c00d18e4373ff1131e27f5c387dfb Mon Sep 17 00:00:00 2001 From: imn Date: Thu, 26 Nov 2015 17:42:23 +0300 Subject: [PATCH] Merge Qt5 porting. --- CMakeLists.txt | 8 ++++++-- src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx | 8 ++++++++ src/GUI/BLSURFPluginGUI_StdWidget.cxx | 10 +++++----- src/GUI/CMakeLists.txt | 8 ++++---- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d67ca1..cc7d6d7 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,8 +105,12 @@ ENDIF(SALOME_BUILD_GUI) ## From GUI: ## IF(SALOME_BUILD_GUI) - # Qt4 - FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui) + # Qt + IF(NOT SALOME_GUI_BUILD_WITH_QT5) + FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui) + ELSE() + FIND_PACKAGE(SalomeQt5 REQUIRED) + ENDIF() ENDIF(SALOME_BUILD_GUI) # OCCT diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx index dfe5bc0..5005e10 100644 --- a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx @@ -845,7 +845,11 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() myEnforcedTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); myEnforcedTreeWidget->setSelectionBehavior(QAbstractItemView::SelectItems); for (int column = 0; column < ENF_VER_NB_COLUMNS; ++column) { +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) myEnforcedTreeWidget->header()->setResizeMode(column,QHeaderView::Interactive); +#else + myEnforcedTreeWidget->header()->setSectionResizeMode(column,QHeaderView::Interactive); +#endif myEnforcedTreeWidget->resizeColumnToContents(column); } myEnforcedTreeWidget->hideColumn(ENF_VER_FACE_ENTRY_COLUMN); @@ -962,7 +966,11 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() int periodicityVisibleColumns = 2; for (size_t column = 0; column < periodicityVisibleColumns; ++column) { +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) myPeriodicityTreeWidget->header()->setResizeMode(column,QHeaderView::Interactive); +#else + myPeriodicityTreeWidget->header()->setSectionResizeMode(column,QHeaderView::Interactive); +#endif myPeriodicityTreeWidget->resizeColumnToContents(column); } myPeriodicityTreeWidget->header()->setStretchLastSection(true); diff --git a/src/GUI/BLSURFPluginGUI_StdWidget.cxx b/src/GUI/BLSURFPluginGUI_StdWidget.cxx index 6dff729..d4fbc76 100644 --- a/src/GUI/BLSURFPluginGUI_StdWidget.cxx +++ b/src/GUI/BLSURFPluginGUI_StdWidget.cxx @@ -113,17 +113,17 @@ void BLSURFPluginGUI_StdWidget::resizeWidgets() { myMinSize->setMinimumWidth( max_width+50 ); myMaxSize->setMinimumWidth( max_width+50 ); // Geometrical parameters - metrics1 = myAngleMesh->font(); - metrics2 = myChordalError->font(); + metrics1 = QFontMetrics(myAngleMesh->font()); + metrics2 = QFontMetrics(myChordalError->font()); width1 = metrics1.width(myAngleMesh->GetString()); width2 = metrics2.width(myChordalError->GetString()); max_width = max(width1,width2); myAngleMesh->setMinimumWidth( max_width+50 ); myChordalError->setMinimumWidth( max_width+50 ); // Other parameters - metrics1 = myAnisotropicRatio->font(); - metrics2 = myTinyEdgeLength->font(); - metrics3 = myBadElementAspectRatio->font(); + metrics1 = QFontMetrics(myAnisotropicRatio->font()); + metrics2 = QFontMetrics(myTinyEdgeLength->font()); + metrics3 = QFontMetrics(myBadElementAspectRatio->font()); width1 = metrics1.width(myAnisotropicRatio->GetString()); width2 = metrics2.width(myTinyEdgeLength->GetString()); width3 = metrics3.width(myBadElementAspectRatio->GetString()); diff --git a/src/GUI/CMakeLists.txt b/src/GUI/CMakeLists.txt index 3d1f25d..a97a5ac 100644 --- a/src/GUI/CMakeLists.txt +++ b/src/GUI/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 @@ -78,7 +78,7 @@ SET(BLSURFPluginGUI_HEADERS # --- sources --- # sources / moc wrappings -QT4_WRAP_CPP(_moc_SOURCES ${BLSURFPluginGUI_HEADERS}) +QT_WRAP_MOC(_moc_SOURCES ${BLSURFPluginGUI_HEADERS}) # sources / static SET(_other_SOURCES @@ -105,7 +105,7 @@ SET(_uic_files ) # header files / uic wrappings -QT4_WRAP_UI(_uic_HEADERS ${_uic_files}) +QT_WRAP_UIC(_uic_HEADERS ${_uic_files}) # sources / to compile SET(BLSURFPluginGUI_SOURCES ${_other_SOURCES} ${_moc_SOURCES} ${_uic_HEADERS}) @@ -118,4 +118,4 @@ INSTALL(TARGETS BLSURFPluginGUI EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${ INSTALL(FILES ${BLSURFPluginGUI_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) -QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_BLSURFPLUGIN_INSTALL_RES_DATA}") +QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_BLSURFPLUGIN_INSTALL_RES_DATA}") -- 2.39.2