From 38fd077e215449a7bfb06dd1598a7606db5360d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20L=C3=A9ger?= <17100565+errollgarner@users.noreply.github.com> Date: Tue, 27 Aug 2024 08:26:48 -0400 Subject: [PATCH] Updating to Qt 6 * Remove some deprecated calls. * Update CMake Lists * Update OIGTL/OIGTLIO * VTK fix --- CMakeCommon/windeployqt.cmake | 6 +-- CMakeLists.txt | 34 ++++++-------- Ibis/CMakeLists.txt | 27 +++++++---- IbisHardwareIGSIO/CMakeLists.txt | 4 +- IbisHardwareIGSIO/ibishardwareIGSIO.h | 4 +- IbisLib/CMakeLists.txt | 6 +-- IbisLib/application.cpp | 23 +++++----- IbisLib/filereader.cpp | 10 ++--- IbisLib/gui/opendatafiledialog.h | 1 - IbisLib/gui/pathform.cpp | 2 +- IbisLib/gui/pointercalibrationdialog.ui | 34 -------------- IbisLib/gui/quadviewwindow.cpp | 4 +- IbisLib/ibispreferences.cpp | 1 - IbisLib/imageobject.cpp | 6 +-- IbisLib/mainwindow.cpp | 45 ++++++++++--------- IbisLib/pointcloudobject.cpp | 4 +- IbisLib/pointsobject.cpp | 6 +-- IbisLib/polydataobject.cpp | 4 +- IbisLib/scenemanager.cpp | 6 +-- IbisLib/scenemanager.h | 2 - IbisLib/serializer.h | 13 ------ IbisLib/usacquisitionobject.cpp | 26 +++++------ IbisLib/view.cpp.rej | 10 +++++ IbisLib/worldobject.cpp | 2 +- IbisLib/worldobject.h | 2 +- IbisPlugins/CMakeLists.txt | 4 +- .../landmarkregistrationobject.cpp | 8 ++-- IbisSuperBuild/CMakeLists.txt | 10 +++-- .../IbisDeps/External_OpenIGTLink.cmake | 4 +- .../IbisDeps/External_OpenIGTLinkIO.cmake | 12 +++-- IbisSuperBuild/IbisDeps/External_VTK.cmake | 12 ++--- IbisVTK/vtkQt/CMakeLists.txt | 6 +-- .../vtkQtColorTransferFunctionWidget.cpp | 22 ++++----- IbisVTK/vtkQt/vtkQtHistogramWidget.cpp | 14 +++--- IbisVTK/vtkQt/vtkQtMatrixDialog.cpp | 6 +-- .../vtkQt/vtkQtPiecewiseFunctionWidget.cpp | 12 ++--- 36 files changed, 182 insertions(+), 210 deletions(-) create mode 100644 IbisLib/view.cpp.rej diff --git a/CMakeCommon/windeployqt.cmake b/CMakeCommon/windeployqt.cmake index 8c1759f1..36acd159 100644 --- a/CMakeCommon/windeployqt.cmake +++ b/CMakeCommon/windeployqt.cmake @@ -20,11 +20,11 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -find_package(Qt5Core REQUIRED) +find_package(Qt6Core REQUIRED) # Retrieve the absolute path to qmake and then use that path to find # the windeployqt binary -get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION) +get_target_property(_qmake_executable Qt6::qmake IMPORTED_LOCATION) get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}") @@ -44,7 +44,6 @@ function(windeployqt target directory) env PATH="${_qt_bin_dir}" "${WINDEPLOYQT_EXECUTABLE}" --verbose 0 --no-compiler-runtime - --no-angle --no-opengl-sw \"$\" ) @@ -65,7 +64,6 @@ function(windeployqt target directory) env PATH=\"${_qt_bin_dir}\" \"${WINDEPLOYQT_EXECUTABLE}\" --dry-run --no-compiler-runtime - --no-angle --no-opengl-sw --list mapping \${_file} diff --git a/CMakeLists.txt b/CMakeLists.txt index f517cd0a..72af34db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,28 +39,22 @@ endif() if( IBIS_USE_QT_NETWORK ) list( APPEND IbisQtModules Network ) endif() -if( UNIX AND NOT APPLE ) - list( APPEND IbisQtModules X11Extras ) +MESSAGE("MODULES: ${IbisQtModules}") +foreach( module IN LISTS ${IbisQtModules} ) + message("module::${module}") +endforeach() +find_package( Qt6 COMPONENTS ${IbisQtModules} REQUIRED ) + +if( NOT Qt6Widgets_FOUND ) + message( SEND_ERROR "The Qt6Widgets library could not be found!" ) endif() -find_package( Qt5 COMPONENTS ${IbisQtModules} REQUIRED ) -# Qt support by Qt Company: QT 5.1.0 to 5.5.0 support ended. 5.6.0 still supported until March 2019. -# ibis was never tested with versions 5.6.0, 5.7.0 and 5.8.0. It might work with 5.8.0. -# it worked with 5.9.3 +cmake_path(GET Qt6_DIR PARENT_PATH Qt6_root) -if( Qt5Widgets_FOUND ) - if( Qt5Widgets_VERSION VERSION_LESS 5.6.0 ) - message( SEND_ERROR "Qt version 5.5.x or lower is no longer supported.\nCurrently supported Qt version is 5.9 and higher.\nYou are using " ${Qt5Widgets_VERSION} "." ) - elseif( Qt5Widgets_VERSION VERSION_LESS 5.9.0 ) - message( SEND_ERROR "Currently supported Qt version is 5.9 and higher.\nYou are using " ${Qt5Widgets_VERSION} ". It may work." ) - endif() -else() - message( SEND_ERROR "The Qt5Widgets library could not be found!" ) -endif() - -include_directories( ${Qt5Widgets_INCLUDE_DIRS} ) -include_directories( ${Qt5Xml_INCLUDE_DIRS} ) -include_directories( ${Qt5Multimedia_INCLUDE_DIRS} ) +MESSAGE("INCLUDES:${Qt6Widgets_INCLUDE_DIRS}::${Qt6Xml_INCLUDE_DIRS}::${Qt6Multimedia_INCLUDE_DIRS}") +include_directories( ${Qt6Widgets_INCLUDE_DIRS} ) +include_directories( ${Qt6Xml_INCLUDE_DIRS} ) +include_directories( ${Qt6Multimedia_INCLUDE_DIRS} ) #================================================================== # Look for VTK (required) @@ -178,4 +172,4 @@ if( IBIS_BUILD_DOCUMENTATION ) else( DOXYGEN_FOUND ) message( "Doxygen needs to be installed to generate documentation" ) endif() -endif() \ No newline at end of file +endif() diff --git a/Ibis/CMakeLists.txt b/Ibis/CMakeLists.txt index c29104c4..452a73e5 100755 --- a/Ibis/CMakeLists.txt +++ b/Ibis/CMakeLists.txt @@ -1,8 +1,8 @@ PROJECT ( IBIS_MAIN ) # define sources -SET( IBIS_SRC main.cpp commandlinearguments.cpp ) -SET( IBIS_HDR commandlinearguments.h ) +set( IBIS_SRC main.cpp commandlinearguments.cpp ) +set( IBIS_HDR commandlinearguments.h ) set( exec_name ibis ) # option to turn on vtk warnings @@ -12,7 +12,7 @@ if( NOT IBIS_ENABLE_VTK_WARNINGS ) endif() # moc Qt source file without a ui file -qt5_wrap_cpp( IBIS_MOC ${IBIS_HDR_MOC} ) +qt6_wrap_cpp( IBIS_MOC ${IBIS_HDR_MOC} ) # make rules to create c++ source from Qt resource files @@ -70,7 +70,7 @@ endif() #================================ # Define executable #================================ -SET( SOURCE ${IBIS_HDR} ${IBIS_HDR_MOC} ${IBIS_SRC} ${ImportPluginsSourceFile} ${IBIS_MOC} ${IBIS_SRC_ICNS} ${platform_src} ) +set( SOURCE ${IBIS_HDR} ${IBIS_HDR_MOC} ${IBIS_SRC} ${ImportPluginsSourceFile} ${IBIS_MOC} ${IBIS_SRC_ICNS} ${platform_src} ) ADD_EXECUTABLE( ${exec_name} ${executable_flags} ${SOURCE} ) if (APPLE) @@ -90,10 +90,19 @@ if( USE_POINT_GREY_CAMERA ) set( flycaptureLib flycapture ) endif() -TARGET_LINK_LIBRARIES( ${exec_name} ${PluginLibs} ${PluginExternalLibs} ${HardwareModulesLibs} ${libsToUse} ${QT_LIBRARIES} - ${VTK_LIBRARIES} ${MINC4ITK_LIBRARIES} ${ELASTIX_LIBRARIES} +target_link_libraries( ${exec_name} ${PluginLibs} ${PluginExternalLibs} ${HardwareModulesLibs} ${libsToUse} + ${VTK_LIBRARIES} ${MINC4ITK_LIBRARIES} ${ELASTIX_LIBRARIES} ${itkLibsToUse} ${OpenCV_LIBS} ${flycaptureLib} svl ${gpuLibs} ) -qt5_use_modules( ${exec_name} ${IbisQtModules} ) +message("MODULES:${IbisQtModules}") +message("QTLIBRARIES:${QT_LIBRARIES}") +#target_link_libraries( ${exec_name} Qt6::Widgets ) +#target_link_libraries( ${exec_name} Qt6::Xml ) +#target_link_libraries( ${exec_name} Qt6::OpenGL ) +#qt6_use_modules( ${exec_name} ${IbisQtModules} ) +foreach( module IN LISTS IbisQtModules ) + message( STATUS "Linking against Qt6::${module}" ) + target_link_libraries( ${exec_name} "Qt6::${module}" ) +endforeach() vtk_module_autoinit( TARGETS ${exec_name} MODULES ${VTK_LIBRARIES}) @@ -117,7 +126,7 @@ endif() #================================ if( APPLE ) # On mac, we need to run macdeployqt on the installed bundle (should eventually implement a better solution) - get_target_property( QMakeLocation Qt5::qmake LOCATION) + get_target_property( QMakeLocation Qt6::qmake LOCATION) get_filename_component( QtBinLocation ${QMakeLocation} DIRECTORY ) set( MacDeployQtExec ${QtBinLocation}/macdeployqt ) set( BuiltExecFullPath ${CMAKE_CURRENT_BINARY_DIR}/${exec_name}.app ) @@ -148,7 +157,7 @@ endif() #================================ set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ibis image-guided neurosurgery program and viewer") set( CPACK_PACKAGE_NAME ${exec_name} ) -set( CPACK_PACKAGE_CONTACT "Simon Drouin and Anka Kochanowska") +set( CPACK_PACKAGE_CONTACT "Étienne Léger") set( CPACK_PACKAGE_VENDOR "NeuroImaging and Surgical Technologies (NIST) Lab - McConnell Brain Imaging Centre - Montreal Neurological Institute") set( CPACK_PACKAGE_VERSION_MAJOR ${IBIS_MAJOR_VERSION}) set( CPACK_PACKAGE_VERSION_MINOR ${IBIS_MINOR_VERSION}) diff --git a/IbisHardwareIGSIO/CMakeLists.txt b/IbisHardwareIGSIO/CMakeLists.txt index beb0dac9..d0841cfa 100644 --- a/IbisHardwareIGSIO/CMakeLists.txt +++ b/IbisHardwareIGSIO/CMakeLists.txt @@ -21,10 +21,10 @@ set( IbisHardwareIgsioHdrMoc ibishardwareIGSIO.h plusserverinterface.h ibishardw set( IbisHardwareIgsioUi ibishardwareIGSIOsettingswidget.ui ) # moc Qt source file without a ui file -qt5_wrap_cpp( IbisHardwareIgsioMoc ${IbisHardwareIgsioHdrMoc} ) +qt6_wrap_cpp( IbisHardwareIgsioMoc ${IbisHardwareIgsioHdrMoc} ) # Generate code for .ui files -> ui_xxx.h -qt5_wrap_ui( IbisHardwareIgsioUiHdr ${IbisHardwareIgsioUi} ) +qt6_wrap_ui( IbisHardwareIgsioUiHdr ${IbisHardwareIgsioUi} ) #================================ # Define output diff --git a/IbisHardwareIGSIO/ibishardwareIGSIO.h b/IbisHardwareIGSIO/ibishardwareIGSIO.h index bfd0f93e..12dd4d0c 100644 --- a/IbisHardwareIGSIO/ibishardwareIGSIO.h +++ b/IbisHardwareIGSIO/ibishardwareIGSIO.h @@ -8,8 +8,8 @@ See Copyright.txt or http://ibisneuronav.org/Copyright.html for details. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ -#ifndef __IbisHardwareIGSIO_h_ -#define __IbisHardwareIGSIO_h_ +#ifndef IBISHARDWAREIGSIO_H +#define IBISHARDWAREIGSIO_H #include diff --git a/IbisLib/CMakeLists.txt b/IbisLib/CMakeLists.txt index 5345cf7a..777dddcd 100644 --- a/IbisLib/CMakeLists.txt +++ b/IbisLib/CMakeLists.txt @@ -187,14 +187,14 @@ set( IBISLIB_UI # moc Qt source file without a ui file -qt5_wrap_cpp( IBISLIB_MOC ${IBISLIB_HDR_MOC} ) +qt6_wrap_cpp( IBISLIB_MOC ${IBISLIB_HDR_MOC} ) # Generate code for .ui files -> ui_xxx.h -qt5_wrap_ui( IBISLIB_HDR_UI ${IBISLIB_UI} ) +qt6_wrap_ui( IBISLIB_HDR_UI ${IBISLIB_UI} ) # make rules to create c++ source from Qt resource files set( IBISLIB_RCC IbisLib.qrc ) -qt5_add_resources( IBISLIB_RCC_SRC ${IBISLIB_RCC}) +qt6_add_resources( IBISLIB_RCC_SRC ${IBISLIB_RCC}) #================================ # Define output diff --git a/IbisLib/application.cpp b/IbisLib/application.cpp index 65ec8e9e..dfe76957 100644 --- a/IbisLib/application.cpp +++ b/IbisLib/application.cpp @@ -71,7 +71,7 @@ void ApplicationSettings::LoadSettings( QSettings & settings ) ViewBackgroundColor.setGreen( settings.value( "ViewBackgroundColor_g", 50 ).toInt() ); ViewBackgroundColor.setBlue( settings.value( "ViewBackgroundColor_b", 50 ).toInt() ); // then 3D view, if not found in settings, set the same as 2D. - double bgColor[3]; + float bgColor[3]; ViewBackgroundColor.getRgbF( &bgColor[0], &bgColor[1], &bgColor[2] ); View3DBackgroundColor.setRed( settings.value( "View3DBackgroundColor_r", int( bgColor[0] * 255 ) ).toInt() ); View3DBackgroundColor.setGreen( settings.value( "View3DBackgroundColor_g", int( bgColor[1] * 255 ) ).toInt() ); @@ -221,14 +221,17 @@ Application::~Application() void Application::ApplyApplicationSettings() { - double bgColor[3]; + float bgColor[3]; m_settings.ViewBackgroundColor.getRgbF( &bgColor[0], &bgColor[1], &bgColor[2] ); - m_sceneManager->SetViewBackgroundColor( bgColor ); + double bgColord[3] = { bgColor[0], bgColor[1], bgColor[2] }; + m_sceneManager->SetViewBackgroundColor( bgColord ); m_settings.View3DBackgroundColor.getRgbF( &bgColor[0], &bgColor[1], &bgColor[2] ); - m_sceneManager->SetView3DBackgroundColor( bgColor ); + //TODO + //double bgColord[3] = { bgColor[0], bgColor[1], bgColor[2] }; + m_sceneManager->SetView3DBackgroundColor( bgColord ); m_sceneManager->Set3DCameraViewAngle( m_settings.CameraViewAngle3D ); - double cursorColor[3]; + float cursorColor[3]; m_settings.CutPlanesCursorColor.getRgbF( &cursorColor[0], &cursorColor[1], &cursorColor[2] ); WorldObject * world = WorldObject::SafeDownCast( m_sceneManager->GetSceneRoot() ); world->SetCursorColor( cursorColor ); @@ -445,7 +448,7 @@ void Application::OpenFiles( OpenFileParams * params, bool addToScene ) { QString message( "No read permission on file: " ); message.append( cur.fileName ); - QMessageBox::critical( nullptr, "Error", message, 1, 0 ); + QMessageBox::critical( nullptr, "Error", message, QMessageBox::Ok ); return; } if( m_fileReader->IsMINC1( cur.fileName.toUtf8().data() ) ) @@ -557,7 +560,7 @@ bool Application::GetPointsFromTagFile( QString fileName, PointsObject * pts1, P { QString message( "No read permission on file: " ); message.append( fileName ); - QMessageBox::critical( nullptr, "Error", message, 1, 0 ); + QMessageBox::critical( nullptr, "Error", message, QMessageBox::Ok ); return false; } bool ok = m_fileReader->GetPointsDataFromTagFile( fileName, pts1, pts2 ); @@ -1014,7 +1017,7 @@ int Application::GetNumberOfComponents( QString filename ) { QString message( "No read permission on file: " ); message.append( filename ); - QMessageBox::critical( nullptr, "Error", message, 1, 0 ); + QMessageBox::critical( nullptr, "Error", message, QMessageBox::Ok ); return false; } int n = m_fileReader->GetNumberOfComponents( filename ); @@ -1031,7 +1034,7 @@ bool Application::GetGrayFrame( QString filename, IbisItkUnsignedChar3ImageType: { QString message( "No read permission on file: " ); message.append( filename ); - QMessageBox::critical( nullptr, "Error", message, 1, 0 ); + QMessageBox::critical( nullptr, "Error", message, QMessageBox::Ok ); return false; } bool ok = m_fileReader->GetGrayFrame( filename, itkImage ); @@ -1049,7 +1052,7 @@ bool Application::GetRGBFrame( QString filename, IbisRGBImageType::Pointer itkIm { QString message( "No read permission on file: " ); message.append( filename ); - QMessageBox::critical( nullptr, "Error", message, 1, 0 ); + QMessageBox::critical( nullptr, "Error", message, QMessageBox::Ok ); return false; } bool ok = m_fileReader->GetRGBFrame( filename, itkImage ); diff --git a/IbisLib/filereader.cpp b/IbisLib/filereader.cpp index 255ec8cd..cf5d6671 100644 --- a/IbisLib/filereader.cpp +++ b/IbisLib/filereader.cpp @@ -114,7 +114,7 @@ void FileReader::SetIbisAPI( IbisAPI * api ) QString mincDir = m_ibisAPI->GetCustomPath( MINCToolsPathVarName ); if( !mincDir.isNull() && !mincDir.isEmpty() ) { - if( mincDir.at( mincDir.count() - 1 ) != '/' ) mincDir.append( "/" ); + if( mincDir.at( mincDir.size() - 1 ) != '/' ) mincDir.append( "/" ); m_mincconvert.clear(); m_mincconvert.append( mincDir ); m_mincconvert.append( "mincconvert" ); @@ -183,7 +183,7 @@ bool FileReader::ConvertMINC1toMINC2( QString & inputileName, QString & outputil tmp.append( inputileName + " is of MINC1 type and needs to be converted to MINC2.\n" + "Tool mincconvert was not found in standard paths on your file system.\n" + "Please convert using command: \nmincconvert -2 " ); - QMessageBox::critical( 0, "Error", tmp, 1, 0 ); + QMessageBox::critical( 0, "Error", tmp, QMessageBox::Ok ); return false; } QString dirname( QDir::homePath() ); @@ -247,7 +247,7 @@ bool FileReader::ConvertMINC1toMINC2( QString & inputileName, QString & outputil QString tmp( "File " ); tmp.append( inputileName + " is an acquired frame of MINC1 type and needs to be converted to MINC2.\n" + "Tool minccalc was not found in standard paths on your file system.\n" ); - QMessageBox::critical( 0, "Error", tmp, 1, 0 ); + QMessageBox::critical( 0, "Error", tmp, QMessageBox::Ok ); return false; } } @@ -346,7 +346,7 @@ bool FileReader::OpenFile( QList & readObjects, QString filename, QString tmp( "File " ); tmp.append( filename + " is of MINC1 type and needs to be converted to MINC2.\n" + "Open Settings/Preferences and set path to the directory containing MINC tools.\n" ); - QMessageBox::critical( 0, "Error", tmp, 1, 0 ); + QMessageBox::critical( 0, "Error", tmp, QMessageBox::Ok ); return false; } if( this->ConvertMINC1toMINC2( filename, fileMINC2, true ) ) @@ -847,7 +847,7 @@ int FileReader::GetNumberOfComponents( QString filename ) QString tmp( "File " ); tmp.append( filename + " is an acquired frame of MINC1 type and needs to be converted to MINC2.\n" + "Open Settings/Preferences and set path to the directory containing MINC tools.\n" ); - QMessageBox::critical( 0, "Error", tmp, 1, 0 ); + QMessageBox::critical( 0, "Error", tmp, QMessageBox::Ok ); return 0; } if( this->ConvertMINC1toMINC2( filename, fileMINC2, true ) ) diff --git a/IbisLib/gui/opendatafiledialog.h b/IbisLib/gui/opendatafiledialog.h index fc3f1c7e..774c2441 100644 --- a/IbisLib/gui/opendatafiledialog.h +++ b/IbisLib/gui/opendatafiledialog.h @@ -15,7 +15,6 @@ See Copyright.txt or http://ibisneuronav.org/Copyright.html for details. #include #include -class QStringList; class OpenFileParams; class SceneManager; diff --git a/IbisLib/gui/pathform.cpp b/IbisLib/gui/pathform.cpp index cd587d90..c8ca3ddf 100644 --- a/IbisLib/gui/pathform.cpp +++ b/IbisLib/gui/pathform.cpp @@ -48,7 +48,7 @@ void PathForm::PathLineEditChanged() QString tmp( "File/Directory:\n" ); tmp.append( ui->pathLineEdit->text() ); tmp.append( "\ndoes not exist. Please enter a valid path." ); - QMessageBox::critical( 0, "Error", tmp, 1, 0 ); + QMessageBox::critical( 0, "Error", tmp, QMessageBox::Ok ); ui->pathLineEdit->setText( "" ); } emit PathChanged( ui->label->text(), ui->pathLineEdit->text() ); diff --git a/IbisLib/gui/pointercalibrationdialog.ui b/IbisLib/gui/pointercalibrationdialog.ui index d5d8fe5c..3fae7c41 100644 --- a/IbisLib/gui/pointercalibrationdialog.ui +++ b/IbisLib/gui/pointercalibrationdialog.ui @@ -220,38 +220,4 @@ - - - calibrateButton - clicked() - PointerCalibrationDialog - CalibrateButtonClicked() - - - 20 - 20 - - - 20 - 20 - - - - - cancelButton - clicked() - PointerCalibrationDialog - CancelButtonClicked() - - - 20 - 20 - - - 20 - 20 - - - - diff --git a/IbisLib/gui/quadviewwindow.cpp b/IbisLib/gui/quadviewwindow.cpp index 24b4e75b..1d31d70d 100644 --- a/IbisLib/gui/quadviewwindow.cpp +++ b/IbisLib/gui/quadviewwindow.cpp @@ -224,15 +224,13 @@ void QuadViewWindow::AddBottomWidget( QWidget * w ) void QuadViewWindow::RemoveBottomWidget( QWidget * w ) { w->close(); } -#include - void QuadViewWindow::Detach3DView( QWidget * /*parent*/ ) { Q_ASSERT( !m_detachedWidget ); m_detachedWidget = new QWidget(); QVBoxLayout * layout = new QVBoxLayout( m_detachedWidget ); - layout->setMargin( 0 ); + layout->setContentsMargins( 0, 0, 0, 0 ); layout->addWidget( m_vtkWidgets[1] ); int nbScreens = QGuiApplication::screens().size(); diff --git a/IbisLib/ibispreferences.cpp b/IbisLib/ibispreferences.cpp index f90fb24b..787cb298 100644 --- a/IbisLib/ibispreferences.cpp +++ b/IbisLib/ibispreferences.cpp @@ -1,7 +1,6 @@ #include "ibispreferences.h" #include -#include #include #include diff --git a/IbisLib/imageobject.cpp b/IbisLib/imageobject.cpp index 1de01c33..949a0217 100644 --- a/IbisLib/imageobject.cpp +++ b/IbisLib/imageobject.cpp @@ -192,9 +192,9 @@ void ImageObject::Export() if( saveName.isEmpty() ) return; if( QFile::exists( saveName ) ) { - int ret = - QMessageBox::warning( 0, tr( "Save ImageObject: " ), saveName, QMessageBox::Yes | QMessageBox::Default, - QMessageBox::No | QMessageBox::Escape ); + QMessageBox::StandardButton ret = + QMessageBox::warning( 0, tr( "Save ImageObject: " ), saveName, QMessageBox::Yes | + QMessageBox::No, QMessageBox::No ); if( ret == QMessageBox::No ) return; } diff --git a/IbisLib/mainwindow.cpp b/IbisLib/mainwindow.cpp index 38effccc..72729a8b 100644 --- a/IbisLib/mainwindow.cpp +++ b/IbisLib/mainwindow.cpp @@ -13,7 +13,6 @@ See Copyright.txt or http://ibisneuronav.org/Copyright.html for details. #include #include #include -#include #include #include #include @@ -24,6 +23,8 @@ See Copyright.txt or http://ibisneuronav.org/Copyright.html for details. #include #include #include +//TODO +//#include #include #include #include @@ -79,7 +80,7 @@ MainWindow::MainWindow( QWidget * parent ) // Creates a file menu // ----------------------------------------- QMenu * fileMenu = menuBar()->addMenu( "&File" ); - fileMenu->addAction( tr( "&Open File" ), this, SLOT( fileOpenFile() ), QKeySequence::Open ); + fileMenu->addAction( tr( "&Open File" ), QKeySequence::Open, this, SLOT( fileOpenFile() ) ); QMenu * newObjectFileMenu = fileMenu->addMenu( "&New Object" ); newObjectFileMenu->addAction( tr( "&Point Set" ), this, SLOT( NewPointSet() ) ); this->CreateNewObjectPluginsUi( newObjectFileMenu ); @@ -89,12 +90,12 @@ MainWindow::MainWindow( QWidget * parent ) importFileMenu->addAction( tr( "US Acquisition" ), this, SLOT( fileImportUsAcquisition() ) ); importFileMenu->addAction( tr( "Camera" ), this, SLOT( fileImportCamera() ) ); fileMenu->addSeparator(); - fileMenu->addAction( tr( "Save S&cene" ), this, SLOT( fileSaveScene() ), QKeySequence::Save ); + fileMenu->addAction( tr( "Save S&cene" ), QKeySequence::Save, this, SLOT( fileSaveScene() ) ); fileMenu->addAction( tr( "Save S&cene As..." ), this, SLOT( fileSaveSceneAs() ) ); - fileMenu->addAction( tr( "&Load Scene" ), this, SLOT( fileLoadScene() ), QKeySequence( Qt::CTRL + Qt::Key_L ) ); + fileMenu->addAction( tr( "&Load Scene" ), QKeySequence( Qt::CTRL | Qt::Key_L ), this, SLOT( fileLoadScene() ) ); fileMenu->addAction( tr( "&New Scene" ), this, SLOT( fileNewScene() ) ); fileMenu->addSeparator(); - fileMenu->addAction( tr( "&Exit" ), this, SLOT( close() ), QKeySequence::Quit ); + fileMenu->addAction( tr( "&Exit" ), QKeySequence::Quit, this, SLOT( close() ) ); connect( fileMenu, SIGNAL( aboutToShow() ), this, SLOT( ModifyFileMenu() ) ); connect( newObjectFileMenu, SIGNAL( aboutToShow() ), this, SLOT( ModifyNewObjectFileMenu() ) ); @@ -109,7 +110,7 @@ MainWindow::MainWindow( QWidget * parent ) Application::GetInstance().AddHardwareSettingsMenuEntries( settingsMenu ); } QAction * preferences = - settingsMenu->addAction( tr( "&Preferences" ), this, SLOT( Preferences() ), QKeySequence::Preferences ); + settingsMenu->addAction( tr( "&Preferences" ), QKeySequence::Preferences, this, SLOT( Preferences() ) ); preferences->setMenuRole( QAction::PreferencesRole ); // ----------------------------------------- @@ -123,19 +124,19 @@ MainWindow::MainWindow( QWidget * parent ) m_viewZPlaneAction = AddToggleAction( viewMenu, tr( "&Transverse Plane" ), SLOT( ViewZPlaneToggled( bool ) ), QKeySequence( "Alt+z" ), true ); m_showAllPlanesAction = - viewMenu->addAction( tr( "View All Planes" ), this, SLOT( ViewAllPlanes() ), QKeySequence( "Alt+p" ) ); + viewMenu->addAction( tr( "View All Planes" ), QKeySequence( "Alt+p" ), this, SLOT( ViewAllPlanes() ) ); m_hideAllPlanesAction = - viewMenu->addAction( tr( "Hide All Planes" ), this, SLOT( HideAllPlanes() ), QKeySequence( "Shift+Alt+p" ) ); + viewMenu->addAction( tr( "Hide All Planes" ), QKeySequence( "Shift+Alt+p" ), this, SLOT( HideAllPlanes() ) ); viewMenu->addSeparator(); - viewMenu->addAction( tr( "&Front" ), this, SLOT( View3DFront() ), QKeySequence( "Shift+Alt+f" ) ); - viewMenu->addAction( tr( "&Left" ), this, SLOT( View3DLeft() ), QKeySequence( "Shift+Alt+l" ) ); - viewMenu->addAction( tr( "&Right" ), this, SLOT( View3DRight() ), QKeySequence( "Shift+Alt+r" ) ); - viewMenu->addAction( tr( "&Back" ), this, SLOT( View3DBack() ), QKeySequence( "Shift+Alt+b" ) ); - viewMenu->addAction( tr( "&Top" ), this, SLOT( View3DTop() ), QKeySequence( "Shift+Alt+t" ) ); - viewMenu->addAction( tr( "Botto&m" ), this, SLOT( View3DBottom() ), QKeySequence( "Shift+Alt+m" ) ); + viewMenu->addAction( tr( "&Front" ), QKeySequence( "Shift+Alt+f" ), this, SLOT( View3DFront() ) ); + viewMenu->addAction( tr( "&Left" ), QKeySequence( "Shift+Alt+l" ), this, SLOT( View3DLeft() ) ); + viewMenu->addAction( tr( "&Right" ), QKeySequence( "Shift+Alt+r" ), this, SLOT( View3DRight() ) ); + viewMenu->addAction( tr( "&Back" ), QKeySequence( "Shift+Alt+b" ), this, SLOT( View3DBack() ) ); + viewMenu->addAction( tr( "&Top" ), QKeySequence( "Shift+Alt+t" ), this, SLOT( View3DTop() ) ); + viewMenu->addAction( tr( "Botto&m" ), QKeySequence( "Shift+Alt+m" ), this, SLOT( View3DBottom() ) ); viewMenu->addSeparator(); - viewMenu->addAction( tr( "Re&set Planes" ), this, SLOT( ViewResetPlanes() ), QKeySequence( "Shift+Alt+s" ) ); - viewMenu->addAction( "Full Screen", this, SLOT( ViewFullscreen() ), Qt::CTRL + Qt::Key_F ); + viewMenu->addAction( tr( "Re&set Planes" ), QKeySequence( "Shift+Alt+s" ), this, SLOT( ViewResetPlanes() ) ); + viewMenu->addAction( "Full Screen", Qt::CTRL | Qt::Key_F, this, SLOT( ViewFullscreen() ) ); connect( viewMenu, SIGNAL( aboutToShow() ), this, SLOT( ModifyViewMenu() ) ); // ----------------------------------------- @@ -274,7 +275,7 @@ void MainWindow::CreateNewObjectPluginsUi( QMenu * menu ) QAction * MainWindow::AddToggleAction( QMenu * menu, const QString & title, const char * member, const QKeySequence & shortcut, bool checked ) { - QAction * action = menu->addAction( title, this, member, shortcut ); + QAction * action = menu->addAction( title, shortcut, this, member ); action->setCheckable( true ); action->setChecked( checked ); return action; @@ -532,9 +533,9 @@ void MainWindow::fileLoadScene() bool sceneNotEmpty = manager->GetNumberOfUserObjects() > 0; if( sceneNotEmpty ) { - int ret = + QMessageBox::StandardButton ret = QMessageBox::warning( this, "Load Scene", tr( "All the objects currently in the scene will be removed." ), - QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ); + QMessageBox::Yes | QMessageBox::No, QMessageBox::No ); if( ret == QMessageBox::No ) return; } manager->NewScene(); @@ -563,9 +564,9 @@ void MainWindow::fileNewScene() bool sceneNotEmpty = manager->GetNumberOfUserObjects() > 0; if( sceneNotEmpty ) { - int ret = + QMessageBox::StandardButton ret = QMessageBox::warning( this, "New Scene", tr( "All the objects currently in the scene will be removed." ), - QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ); + QMessageBox::Yes | QMessageBox::No, QMessageBox::No ); if( ret == QMessageBox::No ) return; } Application::GetInstance().GetSettings()->WorkingDirectory = QDir::homePath(); @@ -870,7 +871,7 @@ void MainWindow::LoadSettings( QSettings & s ) const QByteArray geometry = s.value( "geometry", QByteArray() ).toByteArray(); if( geometry.isEmpty() ) { - const QRect availableGeometry = QApplication::desktop()->availableGeometry( this ); + const QRect availableGeometry = QApplication::primaryScreen()->geometry(); int w = static_cast( availableGeometry.width() * 0.7 ); int h = static_cast( availableGeometry.height() * 0.6 ); resize( w, h ); diff --git a/IbisLib/pointcloudobject.cpp b/IbisLib/pointcloudobject.cpp index 0709e4c4..daadad8a 100644 --- a/IbisLib/pointcloudobject.cpp +++ b/IbisLib/pointcloudobject.cpp @@ -80,8 +80,8 @@ void PointCloudObject::Export() if( QFile::exists( saveName ) ) { int ret = - QMessageBox::warning( 0, tr( "Save PointCloudObject" ), saveName, QMessageBox::Yes | QMessageBox::Default, - QMessageBox::No | QMessageBox::Escape ); + QMessageBox::warning( 0, tr( "Save PointCloudObject" ), saveName, QMessageBox::Yes | + QMessageBox::No, QMessageBox::No ); if( ret == QMessageBox::No ) return; } this->SetFullFileName( saveName ); diff --git a/IbisLib/pointsobject.cpp b/IbisLib/pointsobject.cpp index 50b0dd62..af772cc4 100644 --- a/IbisLib/pointsobject.cpp +++ b/IbisLib/pointsobject.cpp @@ -149,8 +149,8 @@ void PointsObject::Export() if( saveName.isEmpty() ) return; if( QFile::exists( saveName ) ) { - int ret = QMessageBox::warning( 0, tr( "Save Points" ), saveName, QMessageBox::Yes | QMessageBox::Default, - QMessageBox::No | QMessageBox::Escape ); + int ret = QMessageBox::warning( 0, tr( "Save Points" ), saveName, QMessageBox::Yes | + QMessageBox::No, QMessageBox::No ); if( ret == QMessageBox::No ) return; } QFileInfo info( saveName ); @@ -171,7 +171,7 @@ void PointsObject::Export() writer->Delete(); } else - QMessageBox::warning( 0, tr( "Error: " ), tr( "There are no points to save." ), 1, 0 ); + QMessageBox::warning( 0, tr( "Error: " ), tr( "There are no points to save." ), QMessageBox::Ok ); } void PointsObject::Setup( View * view ) diff --git a/IbisLib/polydataobject.cpp b/IbisLib/polydataobject.cpp index ab8e8870..832eb13a 100644 --- a/IbisLib/polydataobject.cpp +++ b/IbisLib/polydataobject.cpp @@ -114,8 +114,8 @@ void PolyDataObject::Export() if( QFile::exists( saveName ) ) { int ret = - QMessageBox::warning( 0, tr( "Save PolyDataObject" ), saveName, QMessageBox::Yes | QMessageBox::Default, - QMessageBox::No | QMessageBox::Escape ); + QMessageBox::warning( 0, tr( "Save PolyDataObject" ), saveName, QMessageBox::Yes | + QMessageBox::No, QMessageBox::No ); if( ret == QMessageBox::No ) return; } this->SavePolyData( saveName ); diff --git a/IbisLib/scenemanager.cpp b/IbisLib/scenemanager.cpp index b4359125..d21d52ea 100644 --- a/IbisLib/scenemanager.cpp +++ b/IbisLib/scenemanager.cpp @@ -265,7 +265,7 @@ void SceneManager::LoadScene( QString & fileName, bool interactive ) reader.Finish(); QString message = "SaveScene version from file (" + reader.GetVersionFromFile() + ") is more recent than supported (" + this->SupportedSceneSaveVersion + ")\n"; - QMessageBox::warning( nullptr, "Error", message, 1, 0 ); + QMessageBox::warning( nullptr, "Error", message, QMessageBox::Ok ); SetRenderingEnabled( true ); this->LoadingScene = false; return; @@ -274,7 +274,7 @@ void SceneManager::LoadScene( QString & fileName, bool interactive ) { QString message = "This scene version is older than 6.0. This is not supported anymore. Scene may not be restored.\n"; - QMessageBox::warning( nullptr, "Error", message, 1, 0 ); + QMessageBox::warning( nullptr, "Error", message, QMessageBox::Ok ); SetRenderingEnabled( true ); this->LoadingScene = false; return; @@ -1469,7 +1469,7 @@ void SceneManager::ObjectReader( Serializer * ser, bool interactive ) obj->Serialize( ser ); QString msg( "Incomplete data, ignoring object: " ); msg.append( obj->GetName() ); - QMessageBox::warning( nullptr, "Error", msg, 1, 0 ); + QMessageBox::warning( nullptr, "Error", msg, QMessageBox::Ok ); obj->Delete(); } else if( QString::compare( className, QString( "SceneObject" ), Qt::CaseSensitive ) == diff --git a/IbisLib/scenemanager.h b/IbisLib/scenemanager.h index 0096f849..c1a93c1b 100644 --- a/IbisLib/scenemanager.h +++ b/IbisLib/scenemanager.h @@ -20,7 +20,6 @@ See Copyright.txt or http://ibisneuronav.org/Copyright.html for details. #include #include #include -#include #include #include @@ -30,7 +29,6 @@ See Copyright.txt or http://ibisneuronav.org/Copyright.html for details. #include "view.h" class QWidget; -class QStringList; class TripleCutPlaneObject; class TrackedSceneObject; class WorldObject; diff --git a/IbisLib/serializer.h b/IbisLib/serializer.h index 69214950..e2e4ab61 100644 --- a/IbisLib/serializer.h +++ b/IbisLib/serializer.h @@ -606,19 +606,6 @@ bool Serialize( Serializer * serial, const char * attrName, QPair & value return false; } -template -bool Serialize( Serializer * serial, const char * attrName, std::pair & value ) -{ - if( serial->BeginSection( attrName ) ) - { - Serialize( serial, "First", value.first ); - Serialize( serial, "Second", value.second ); - serial->EndSection(); - return true; - } - return false; -} - template bool Serialize( Serializer * serial, const char * attrName, std::map & value ) { diff --git a/IbisLib/usacquisitionobject.cpp b/IbisLib/usacquisitionobject.cpp index 67c08809..d3ab25ac 100644 --- a/IbisLib/usacquisitionobject.cpp +++ b/IbisLib/usacquisitionobject.cpp @@ -591,7 +591,7 @@ bool USAcquisitionObject::LoadFramesFromMINCFile( QStringList & allMINCFiles ) { QString message( tr( "No read permission on file: " ) ); message.append( allMINCFiles.at( 0 ) ); - QMessageBox::critical( 0, "Error", message, 1, 0 ); + QMessageBox::critical( 0, "Error", message, QMessageBox::Ok ); return false; } m_componentsNumber = Application::GetInstance().GetNumberOfComponents( allMINCFiles.at( 0 ) ); @@ -653,7 +653,7 @@ bool USAcquisitionObject::LoadGrayFrames( QStringList & allMINCFiles ) qApp->processEvents(); if( progress->wasCanceled() ) { - QMessageBox::information( 0, "Importing frames", "Process cancelled", 1, 0 ); + QMessageBox::information( 0, "Importing frames", "Process cancelled", QMessageBox::Ok ); processOK = false; } } @@ -719,7 +719,7 @@ bool USAcquisitionObject::LoadRGBFrames( QStringList & allMINCFiles ) qApp->processEvents(); if( progress->wasCanceled() ) { - QMessageBox::information( 0, "Importing frames", "Process cancelled", 1, 0 ); + QMessageBox::information( 0, "Importing frames", "Process cancelled", QMessageBox::Ok ); processOK = false; } } @@ -760,7 +760,7 @@ bool USAcquisitionObject::LoadFramesFromMINCFile( Serializer * ser ) if( !QFile::exists( subDirName ) ) { QString accessError = tr( "Directory not found - " ) + subDirName; - QMessageBox::warning( 0, tr( "Error: " ), accessError, 1, 0 ); + QMessageBox::warning( 0, tr( "Error: " ), accessError, QMessageBox::Ok ); return false; } QDir dir( subDirName ); @@ -768,7 +768,7 @@ bool USAcquisitionObject::LoadFramesFromMINCFile( Serializer * ser ) if( allMINCFiles.isEmpty() ) { QString accessError = tr( "No acquisition found in " ) + subDirName; - QMessageBox::warning( 0, tr( "Error: " ), accessError, 1, 0 ); + QMessageBox::warning( 0, tr( "Error: " ), accessError, QMessageBox::Ok ); return false; } @@ -810,7 +810,7 @@ void USAcquisitionObject::Serialize( Serializer * ser ) if( !QDir( m_baseDirectory ).exists() ) { QString accessError = tr( "Cannot find acquisition directory: " ) + m_baseDirectory; - QMessageBox::warning( 0, tr( "Error: " ), accessError, 1, 0 ); + QMessageBox::warning( 0, tr( "Error: " ), accessError, QMessageBox::Ok ); return; } @@ -1063,7 +1063,7 @@ void USAcquisitionObject::ExportTrackedVideoBuffer( QString destDir, bool masked if( !dirMade ) { QString accessError = tr( "Can't create directory:\n" ) + baseDirName; - QMessageBox::warning( 0, tr( "Error: " ), accessError, 1, 0 ); + QMessageBox::warning( 0, tr( "Error: " ), accessError, QMessageBox::Ok ); return; } } @@ -1079,7 +1079,7 @@ void USAcquisitionObject::ExportTrackedVideoBuffer( QString destDir, bool masked { QString accessError = tr( "Please select different directory.\nAcquisition data already saved in: " ) + subDirName; - QMessageBox::warning( 0, tr( "Error: " ), accessError, 1, 0 ); + QMessageBox::warning( 0, tr( "Error: " ), accessError, QMessageBox::Ok ); return; } } @@ -1088,7 +1088,7 @@ void USAcquisitionObject::ExportTrackedVideoBuffer( QString destDir, bool masked if( !dirMade ) { QString accessError = tr( "Can't create directory:\n" ) + subDirName; - QMessageBox::warning( 0, tr( "Error: " ), accessError, 1, 0 ); + QMessageBox::warning( 0, tr( "Error: " ), accessError, QMessageBox::Ok ); return; } bool processOK = false; @@ -1105,7 +1105,7 @@ void USAcquisitionObject::ExportTrackedVideoBuffer( QString destDir, bool masked calMatString.append( " " ); } } - calMatString.replace( calMatString.count() - 1, 1, ";" ); + calMatString.replace( calMatString.size() - 1, 1, ";" ); if( numberOfFrames > 0 ) { @@ -1164,7 +1164,7 @@ void USAcquisitionObject::ExportTrackedVideoBuffer( QString destDir, bool masked qApp->processEvents(); if( progress->wasCanceled() ) { - QMessageBox::information( 0, tr( "Exporting frames" ), tr( "Process cancelled" ), 1, 0 ); + QMessageBox::information( 0, tr( "Exporting frames" ), tr( "Process cancelled" ), QMessageBox::Ok ); processOK = false; } } @@ -1218,7 +1218,7 @@ void USAcquisitionObject::ExportTrackedVideoBuffer( QString destDir, bool masked qApp->processEvents(); if( progress->wasCanceled() ) { - QMessageBox::information( 0, tr( "Exporting frames" ), tr( "Process cancelled" ), 1, 0 ); + QMessageBox::information( 0, tr( "Exporting frames" ), tr( "Process cancelled" ), QMessageBox::Ok ); processOK = false; } } @@ -1236,7 +1236,7 @@ void USAcquisitionObject::ExportTrackedVideoBuffer( QString destDir, bool masked writer->Write(); writer->Delete(); } - if( !processOK ) QMessageBox::warning( 0, "Error: ", "Exporting frames failed.", 1, 0 ); + if( !processOK ) QMessageBox::warning( 0, "Error: ", "Exporting frames failed.", QMessageBox::Ok ); } bool USAcquisitionObject::Import() diff --git a/IbisLib/view.cpp.rej b/IbisLib/view.cpp.rej new file mode 100644 index 00000000..ffa1bf0b --- /dev/null +++ b/IbisLib/view.cpp.rej @@ -0,0 +1,10 @@ +diff a/IbisLib/view.cpp b/IbisLib/view.cpp (rejected hunks) +@@ -73,6 +73,8 @@ + m_backupWindowParent = nullptr; + CurrentController = nullptr; + ++ qRegisterMetaType("vtkObject"); ++ + connect( &Application::GetInstance(), SIGNAL( IbisClockTick() ), this, SLOT( EnableRendering() ) ); + } + diff --git a/IbisLib/worldobject.cpp b/IbisLib/worldobject.cpp index 52c1cada..f478cc37 100644 --- a/IbisLib/worldobject.cpp +++ b/IbisLib/worldobject.cpp @@ -74,7 +74,7 @@ void WorldObject::SetCursorColor( const QColor & c ) this->GetManager()->SetCursorColor( c ); } -void WorldObject::SetCursorColor( double color[3] ) +void WorldObject::SetCursorColor( float color[3] ) { Q_ASSERT( this->GetManager() ); QColor col( (int)( color[0] * 255 ), (int)( color[1] * 255 ), (int)( color[2] * 255 ) ); diff --git a/IbisLib/worldobject.h b/IbisLib/worldobject.h index f84556b3..2befc2d3 100644 --- a/IbisLib/worldobject.h +++ b/IbisLib/worldobject.h @@ -79,7 +79,7 @@ class WorldObject : public SceneObject /** Set cursor color. */ void SetCursorColor( const QColor & c ); /** Set cursor color. */ - void SetCursorColor( double[3] ); + void SetCursorColor( float[3] ); /** Get cursor color. */ QColor GetCursorColor(); /** Set background color of all views, 3D included. */ diff --git a/IbisPlugins/CMakeLists.txt b/IbisPlugins/CMakeLists.txt index f236acb7..ebfb140a 100644 --- a/IbisPlugins/CMakeLists.txt +++ b/IbisPlugins/CMakeLists.txt @@ -91,8 +91,8 @@ topological_sort( allIbisEnabledPlugins "" Dependencies ) # Macro to define each plugin. To be called inside each plugin's CMakeLists.txt macro( DefinePlugin PluginSrc PluginHdr PluginHdrMoc PluginUi ) - qt5_wrap_ui( PluginHdrUi ${PluginUi} ) - qt5_wrap_cpp( PluginMoc ${PluginHdrMoc} ) + qt6_wrap_ui( PluginHdrUi ${PluginUi} ) + qt6_wrap_cpp( PluginMoc ${PluginHdrMoc} ) set( PluginSources ${PluginSrc} ${PluginHdrMoc} ${PluginUi} ${PluginMoc} ${PluginHdrUi} ) add_library( ${PluginName} ${PluginSources} ) target_link_libraries( ${PluginName} vtkExtensions IbisLib ${${PluginName}Dependencies} ) diff --git a/IbisPlugins/LandmarkRegistrationObject/landmarkregistrationobject.cpp b/IbisPlugins/LandmarkRegistrationObject/landmarkregistrationobject.cpp index f589bfeb..30907e6d 100644 --- a/IbisPlugins/LandmarkRegistrationObject/landmarkregistrationobject.cpp +++ b/IbisPlugins/LandmarkRegistrationObject/landmarkregistrationobject.cpp @@ -217,7 +217,7 @@ void LandmarkRegistrationObject::Export() if( !info1.isWritable() ) { QString accessError = tr( "No write permission:\n" ) + dirPath; - QMessageBox::warning( 0, tr( "Error: " ), accessError, 1, 0 ); + QMessageBox::warning( 0, tr( "Error: " ), accessError, QMessageBox::Ok ); return; } QString filename1( filename ); @@ -620,13 +620,13 @@ bool LandmarkRegistrationObject::ReadTagFile() if( !fi.exists() ) { QString accessError = tr( "File does not exist:\n" ) + filename; - QMessageBox::warning( 0, tr( "Error: " ), accessError, 1, 0 ); + QMessageBox::warning( 0, tr( "Error: " ), accessError, QMessageBox::Ok ); return false; } if( !fi.isReadable() ) { QString accessError = tr( "No read permission:\n" ) + filename; - QMessageBox::warning( 0, tr( "Error: " ), accessError, 1, 0 ); + QMessageBox::warning( 0, tr( "Error: " ), accessError, QMessageBox::Ok ); return false; } } @@ -638,7 +638,7 @@ bool LandmarkRegistrationObject::ReadTagFile() if( src->GetNumberOfPoints() == 0 ) { QString accessError = tr( "File " ) + filename + tr( " contains no points." ); - QMessageBox::critical( 0, tr( "Error: " ), accessError, 1, 0 ); + QMessageBox::critical( 0, tr( "Error: " ), accessError, QMessageBox::Ok ); return false; } this->SetSourcePoints( src ); diff --git a/IbisSuperBuild/CMakeLists.txt b/IbisSuperBuild/CMakeLists.txt index 1c2e8a2a..d82650de 100644 --- a/IbisSuperBuild/CMakeLists.txt +++ b/IbisSuperBuild/CMakeLists.txt @@ -23,8 +23,10 @@ else() message( STATUS "Building with configuration: ${CMAKE_BUILD_TYPE}" ) endif() -# Find Qt5 -find_package( Qt5 COMPONENTS Widgets REQUIRED ) +# Find Qt6 +find_package( Qt6 COMPONENTS Widgets REQUIRED ) + +cmake_path(GET Qt6_DIR PARENT_PATH Qt6_root) # Find out version numbers of dependencies include( ${CMAKE_CURRENT_SOURCE_DIR}/../CMakeCommon/DependencyVersions.cmake ) @@ -82,7 +84,9 @@ ExternalProject_Add( -DCMAKE_CONFIGURATION_TYPES:STRING=${CMAKE_CONFIGURATION_TYPES} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_CONFIGURATION_TYPES:STRING=${CMAKE_CONFIGURATION_TYPES} - -DQt5_DIR:PATH=${Qt5_DIR} + -DQt6_DIR:PATH=${Qt6_DIR} + -DQt6CoreTools_DIR:PATH=${Qt6_root}/Qt6CoreTools + -DQt6GuiTools_DIR:PATH=${Qt6_root}/Qt6GuiTools -DVTK_DIR:PATH=${IBIS_VTK_DIR} -DITK_DIR:PATH=${IBIS_ITK_DIR} -DElastix_DIR:PATH=${IBIS_ELASTIX_DIR} diff --git a/IbisSuperBuild/IbisDeps/External_OpenIGTLink.cmake b/IbisSuperBuild/IbisDeps/External_OpenIGTLink.cmake index 14fc1389..227a0cca 100644 --- a/IbisSuperBuild/IbisDeps/External_OpenIGTLink.cmake +++ b/IbisSuperBuild/IbisDeps/External_OpenIGTLink.cmake @@ -5,8 +5,8 @@ ExternalProject_Add( ${openigtlink_name} BINARY_DIR ${openigtlink_prefix}/build STAMP_DIR ${openigtlink_prefix}/stamp INSTALL_COMMAND "" - GIT_REPOSITORY "https://github.com/openigtlink/OpenIGTLink.git" - GIT_TAG d4eaae937b6a28ea2324f90c128800b3ad1cf2b3 + GIT_REPOSITORY "https://github.com/IbisNeuronav/OpenIGTLink.git" + GIT_TAG fixes CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${external_project_dir}/${openigtlink_name}/install -DCMAKE_OSX_SYSROOT:PATH=${CMAKE_OSX_SYSROOT} -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET} diff --git a/IbisSuperBuild/IbisDeps/External_OpenIGTLinkIO.cmake b/IbisSuperBuild/IbisDeps/External_OpenIGTLinkIO.cmake index fd3ae3d1..f4c8a40f 100644 --- a/IbisSuperBuild/IbisDeps/External_OpenIGTLinkIO.cmake +++ b/IbisSuperBuild/IbisDeps/External_OpenIGTLinkIO.cmake @@ -1,13 +1,14 @@ set( openigtlinkio_prefix ${external_project_dir}/${openigtlinkio_name} ) +cmake_path(GET Qt6_DIR PARENT_PATH Qt6_root) ExternalProject_Add( ${openigtlinkio_name} PREFIX ${openigtlinkio_prefix} SOURCE_DIR ${openigtlinkio_prefix}/src BINARY_DIR ${openigtlinkio_prefix}/build STAMP_DIR ${openigtlinkio_prefix}/stamp INSTALL_COMMAND "" - GIT_REPOSITORY "https://github.com/IGSIO/OpenIGTLinkIO.git" + GIT_REPOSITORY "https://github.com/IbisNeuronav/OpenIGTLinkIO.git" #the tag is used to mark the version that compiles and links with the first version of ibis 4.x, it will have to be removed altogether once OpenIGTLinkIO is stable - GIT_TAG 46975d197796063b956573f1b1022ac2e3643fe4 + GIT_TAG CompileQt6 CMAKE_ARGS -DCMAKE_OSX_SYSROOT:PATH=${CMAKE_OSX_SYSROOT} -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} @@ -18,7 +19,10 @@ ExternalProject_Add( ${openigtlinkio_name} -DVTK_DIR:PATH=${IBIS_VTK_DIR} -DOpenIGTLink_DIR:PATH=${IBIS_OPENIGTLINK_DIR} -DIGTLIO_USE_GUI:BOOL=ON - -DIGTLIO_QT_VERSION:STRING=5 - -DQt5_DIR:PATH=${Qt5_DIR} + -DIGTLIO_QT_VERSION:STRING=6 + -DQt6_DIR:PATH=${Qt6_DIR} + -DQt6CoreTools_DIR:PATH=${Qt6_root}/Qt6CoreTools + -DQt6GuiTools_DIR:PATH=${Qt6_root}/Qt6GuiTools + -DQt6QmlTools_DIR:PATH=${Qt6_root}/Qt6QmlTools INSTALL_COMMAND "" DEPENDS ${vtk_name} ${openigtlink_name} ) diff --git a/IbisSuperBuild/IbisDeps/External_VTK.cmake b/IbisSuperBuild/IbisDeps/External_VTK.cmake index 35ab5463..d9c25921 100644 --- a/IbisSuperBuild/IbisDeps/External_VTK.cmake +++ b/IbisSuperBuild/IbisDeps/External_VTK.cmake @@ -1,6 +1,6 @@ set( vtk_prefix ${external_project_dir}/${vtk_name} ) set( VTKREPO "https://github.com/IbisNeuronav/VTK.git" ) -set( VTKTAG "5f9dcb5e70884f86bd934f2e3b6a45b74ac6e519" ) +set( VTKTAG "v931" ) if( SUPERBUILD_BUILD_MINIMAL_VTK ) ExternalProject_Add( ${vtk_name} @@ -15,11 +15,12 @@ if( SUPERBUILD_BUILD_MINIMAL_VTK ) -DCMAKE_OSX_SYSROOT:PATH=${CMAKE_OSX_SYSROOT} -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DCMAKE_CONFIGURATION_TYPES:String=${CMAKE_BUILD_TYPE} -DVTK_BUILD_TESTING:STRING=OFF -DBUILD_SHARED_LIBS:BOOL=FALSE -DCMAKE_CXX_FLAGS:STRING=-fPIC - -DVTK_QT_VERSION:STRING=5 - -DQt5_DIR:PATH=${Qt5_DIR} + -DVTK_QT_VERSION:STRING=6 + -DQt6_DIR:PATH=${Qt6_DIR} -DVTK_LEGACY_SILENT:BOOL=TRUE # Make minimal build (debug output): -DVTK_BUILD_ALL_MODULES:BOOL=FALSE @@ -62,13 +63,14 @@ else() -DCMAKE_OSX_SYSROOT:PATH=${CMAKE_OSX_SYSROOT} -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DCMAKE_CONFIGURATION_TYPES:String=${CMAKE_BUILD_TYPE} -DBUILD_TESTING:BOOL=FALSE -DBUILD_SHARED_LIBS:BOOL=FALSE -DCMAKE_CXX_FLAGS:STRING=-fPIC - -DVTK_QT_VERSION:STRING=5 -DVTK_MODULE_ENABLE_VTK_GUISupportQt:STRING=YES -DVTK_MODULE_ENABLE_VTK_hdf5:STRING=NO # hdf5 doesn't build with XCode 12 compiler, could be re-enabled later, but not needed - -DQt5_DIR:PATH=${Qt5_DIR} + -DVTK_QT_VERSION:STRING=6 + -DQt6_DIR:PATH=${Qt6_DIR} -DVTK_LEGACY_SILENT:BOOL=ON -DVTK_RENDERING_BACKEND:STRING=OpenGL ) endif() \ No newline at end of file diff --git a/IbisVTK/vtkQt/CMakeLists.txt b/IbisVTK/vtkQt/CMakeLists.txt index bc795ea4..ae23ef20 100644 --- a/IbisVTK/vtkQt/CMakeLists.txt +++ b/IbisVTK/vtkQt/CMakeLists.txt @@ -13,8 +13,8 @@ SET( IBIS_VTK_QT_HDR_MOC vtkQtImageViewer.h vtkQtMatrixDialog.h ) set( IBIS_VTK_QT_PLUGIN_HDR_MOC vtkQtHistogramWidget.h vtkQtPiecewiseFunctionWidget.h vtkQtColorTransferFunctionWidget.h ) # moc Qt source file without a ui file -qt5_wrap_cpp( IBIS_VTK_QT_MOC ${IBIS_VTK_QT_HDR_MOC} ) -qt5_wrap_cpp( IBIS_VTK_QT_PLUGIN_MOC ${IBIS_VTK_QT_PLUGIN_HDR_MOC} ) +qt6_wrap_cpp( IBIS_VTK_QT_MOC ${IBIS_VTK_QT_HDR_MOC} ) +qt6_wrap_cpp( IBIS_VTK_QT_PLUGIN_MOC ${IBIS_VTK_QT_PLUGIN_HDR_MOC} ) #================================ # Define sources @@ -51,7 +51,7 @@ include_directories(${QT_QTDESIGNER_INCLUDE_DIR}) set( vtkQtPluginSrc vtkQtPlugin.cpp vtkQtHistogramWidget.cpp vtkQtPiecewiseFunctionWidget.cpp vtkQtColorTransferFunctionWidget.cpp ) set( vtkQtPluginHdrMoc vtkQtPlugin.h ) -qt5_wrap_cpp( vtkQtPluginSrcMoc ${vtkQtPluginHdrMoc} ) +qt6_wrap_cpp( vtkQtPluginSrcMoc ${vtkQtPluginHdrMoc} ) # add vtkQtPlugin from sources #ADD_LIBRARY( vtkQtPlugin SHARED ${vtkQtPluginSrc} ${vtkQtPluginSrcMoc} ${vtkQtPluginHdrMoc} ${IBIS_VTK_QT_PLUGING_HDR_MOC} ${IBIS_VTK_QT_PLUGIN_MOC} ) diff --git a/IbisVTK/vtkQt/vtkQtColorTransferFunctionWidget.cpp b/IbisVTK/vtkQt/vtkQtColorTransferFunctionWidget.cpp index ac97ee84..3d21df2c 100644 --- a/IbisVTK/vtkQt/vtkQtColorTransferFunctionWidget.cpp +++ b/IbisVTK/vtkQt/vtkQtColorTransferFunctionWidget.cpp @@ -61,7 +61,7 @@ void vtkQtColorTransferFunctionWidget::mouseMoveEvent( QMouseEvent * event ) if( m_sliderMoving ) MouseMove( event->pos().x(), event->pos().y() ); else - UpdateCurrentCursorInformation( event->x(), event->y() ); + UpdateCurrentCursorInformation( event->position().x(), event->position().y() ); update(); event->accept(); @@ -75,12 +75,12 @@ void vtkQtColorTransferFunctionWidget::mousePressEvent( QMouseEvent * event ) return; } - UpdateCurrentCursorInformation( event->x(), event->y() ); + UpdateCurrentCursorInformation( event->position().x(), event->position().y() ); - if( IsInColorCursorZone( event->x(), event->y() ) || IsInRangeCursorZone( event->x(), event->y() ) ) + if( IsInColorCursorZone( event->position().x(), event->position().y() ) || IsInRangeCursorZone( event->position().x(), event->position().y() ) ) { m_sliderMoving = true; - MouseMove( event->x(), event->y() ); + MouseMove( event->position().x(), event->position().y() ); } event->accept(); @@ -100,7 +100,7 @@ void vtkQtColorTransferFunctionWidget::mouseReleaseEvent( QMouseEvent * event ) return; } - MouseMove( event->x(), event->y() ); + MouseMove( event->position().x(), event->position().y() ); // Stop moving m_sliderMoving = false; @@ -115,11 +115,11 @@ void vtkQtColorTransferFunctionWidget::mouseReleaseEvent( QMouseEvent * event ) void vtkQtColorTransferFunctionWidget::mouseDoubleClickEvent( QMouseEvent * event ) { // In Color cursor zone, choose a new color for a point - if( IsInColorCursorZone( event->x(), event->y() ) ) + if( IsInColorCursorZone( event->position().x(), event->position().y() ) ) { - int index = MinDistanceColor( event->x() ); + int index = MinDistanceColor( event->position().x() ); int pixPos = GetColorNodePixPosition( index ); - if( abs( pixPos - event->x() ) <= m_hotspotRadius ) + if( abs( pixPos - event->position().x() ) <= m_hotspotRadius ) { // clang-format off QColor currentColor = GetColorNodeColor( index ); @@ -135,15 +135,15 @@ void vtkQtColorTransferFunctionWidget::mouseDoubleClickEvent( QMouseEvent * even // Anywhere else, remove point if close to one and add one if not else { - int index = MinDistanceColor( event->x() ); + int index = MinDistanceColor( event->position().x() ); int pixPos = GetColorNodePixPosition( index ); - if( abs( pixPos - event->x() ) <= m_hotspotRadius ) + if( abs( pixPos - event->position().x() ) <= m_hotspotRadius ) { m_colorTransferFunction->RemovePoint( GetColorNodeValue( index ) ); } else { - double value = widgetPosToSliderValue( event->x() ); + double value = widgetPosToSliderValue( event->position().x() ); double * color = m_colorTransferFunction->GetColor( value ); m_colorTransferFunction->AddRGBPoint( value, color[0], color[1], color[2] ); } diff --git a/IbisVTK/vtkQt/vtkQtHistogramWidget.cpp b/IbisVTK/vtkQt/vtkQtHistogramWidget.cpp index d43ac13a..144c97e5 100644 --- a/IbisVTK/vtkQt/vtkQtHistogramWidget.cpp +++ b/IbisVTK/vtkQt/vtkQtHistogramWidget.cpp @@ -130,22 +130,22 @@ void vtkQtHistogramWidget::mousePressEvent( QMouseEvent * event ) return; } - m_currentCursor = MinDistanceCursor( event->x() ); + m_currentCursor = MinDistanceCursor( event->position().x() ); if( m_currentCursor == 0 ) { m_minSliderMoving = true; - setMinSliderValue( event->x() ); + setMinSliderValue( event->position().x() ); } else if( m_currentCursor == 1 ) { m_maxSliderMoving = true; - setMaxSliderValue( event->x() ); + setMaxSliderValue( event->position().x() ); } else if( m_currentCursor == 2 ) { m_midSliderMoving = true; - setMidSliderValue( event->x() ); + setMidSliderValue( event->position().x() ); } event->accept(); @@ -169,11 +169,11 @@ void vtkQtHistogramWidget::mouseReleaseEvent( QMouseEvent * event ) if( rect().contains( event->pos() ) ) { if( m_minSliderMoving ) - setMinSliderValue( event->x() ); + setMinSliderValue( event->position().x() ); else if( m_maxSliderMoving ) - setMaxSliderValue( event->x() ); + setMaxSliderValue( event->position().x() ); else - setMidSliderValue( event->x() ); + setMidSliderValue( event->position().x() ); } // Stop moving diff --git a/IbisVTK/vtkQt/vtkQtMatrixDialog.cpp b/IbisVTK/vtkQt/vtkQtMatrixDialog.cpp index 0c1da9cb..a6f22819 100644 --- a/IbisVTK/vtkQt/vtkQtMatrixDialog.cpp +++ b/IbisVTK/vtkQt/vtkQtMatrixDialog.cpp @@ -46,11 +46,11 @@ vtkQtMatrixDialog::vtkQtMatrixDialog( bool readOnly, QWidget * parent ) MatrixDialogLayout = new QVBoxLayout( this ); MatrixDialogLayout->setSpacing( 6 ); - MatrixDialogLayout->setMargin( 11 ); + MatrixDialogLayout->setContentsMargins( 11, 11, 11, 11 ); gridBox = new QGridLayout; gridBox->setSpacing( 12 ); - gridBox->setMargin( 2 ); + gridBox->setContentsMargins( 2, 2, 2, 2 ); // Create the text boxes for every matrix entry for( int i = 0; i < 4; i++ ) @@ -74,7 +74,7 @@ vtkQtMatrixDialog::vtkQtMatrixDialog( bool readOnly, QWidget * parent ) Layout3 = new QHBoxLayout; Layout3->setSpacing( 6 ); - Layout3->setMargin( 0 ); + Layout3->setContentsMargins( 0, 0 ,0 ,0 ); m_identityButton = new QPushButton( this ); m_identityButton->setObjectName( "m_identityButton" ); diff --git a/IbisVTK/vtkQt/vtkQtPiecewiseFunctionWidget.cpp b/IbisVTK/vtkQt/vtkQtPiecewiseFunctionWidget.cpp index b8f695d4..2c6e94c6 100644 --- a/IbisVTK/vtkQt/vtkQtPiecewiseFunctionWidget.cpp +++ b/IbisVTK/vtkQt/vtkQtPiecewiseFunctionWidget.cpp @@ -73,10 +73,10 @@ void vtkQtPiecewiseFunctionWidget::mousePressEvent( QMouseEvent * event ) { Q_UNUSED( event ) - m_movingPointIndex = PointIndexFromPixCoord( event->x(), event->y() ); + m_movingPointIndex = PointIndexFromPixCoord( event->position().x(), event->position().y() ); if( m_movingPointIndex == -1 ) return; - SetNodeCoordFromPixCoord( event->x(), event->y(), m_movingPointIndex ); + SetNodeCoordFromPixCoord( event->position().x(), event->position().y(), m_movingPointIndex ); update(); } @@ -85,7 +85,7 @@ void vtkQtPiecewiseFunctionWidget::mouseReleaseEvent( QMouseEvent * event ) { if( m_movingPointIndex == -1 ) return; - SetNodeCoordFromPixCoord( event->x(), event->y(), m_movingPointIndex ); + SetNodeCoordFromPixCoord( event->position().x(), event->position().y(), m_movingPointIndex ); m_movingPointIndex = -1; @@ -96,17 +96,17 @@ void vtkQtPiecewiseFunctionWidget::mouseMoveEvent( QMouseEvent * event ) { if( m_movingPointIndex == -1 ) return; - SetNodeCoordFromPixCoord( event->x(), event->y(), m_movingPointIndex ); + SetNodeCoordFromPixCoord( event->position().x(), event->position().y(), m_movingPointIndex ); update(); } void vtkQtPiecewiseFunctionWidget::mouseDoubleClickEvent( QMouseEvent * event ) { - int index = PointIndexFromPixCoord( event->x(), event->y() ); + int index = PointIndexFromPixCoord( event->position().x(), event->position().y() ); if( index == -1 ) - AddPoint( event->x(), event->y() ); + AddPoint( event->position().x(), event->position().y() ); else RemovePoint( index );