diff --git a/CMakeLists.txt b/CMakeLists.txt index 86d25c0706..1ecd3aef20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -294,14 +294,20 @@ SET(ADD_VTK_GUI_SUPPORT_QT_TO_CONF FALSE) IF(WITH_QT) FIND_PACKAGE(VTK) IF(NOT VTK_FOUND) - MESSAGE(FATAL_ERROR "VTK is required when using Qt. Set -DWITH_QT=OFF if you don't want gui tools.") + MESSAGE(FATAL_ERROR "VTK is required when using Qt. Set -DWITH_QT=OFF if you don't want gui tools.") ENDIF(NOT VTK_FOUND) # If Qt is here, the GUI will be built IF(NOT(${VTK_MAJOR_VERSION} LESS 9)) - IF(NOT VTK_QT_VERSION) - MESSAGE(FATAL_ERROR "WITH_QT option is ON, but VTK ${VTK_MAJOR_VERSION} has not been built with Qt support, disabling Qt.") - ENDIF() + IF(NOT VTK_QT_VERSION) + MESSAGE(FATAL_ERROR "WITH_QT option is ON, but VTK ${VTK_MAJOR_VERSION} has not been built with Qt support, disabling Qt.") + ENDIF() + + option(VTK_GLOBAL_WARNING_DISPLAY "Show VTK warning display on runtime" OFF) + IF(NOT VTK_GLOBAL_WARNING_DISPLAY) + ADD_DEFINITIONS(-DVTK_GLOBAL_WARNING_DISPLAY_OFF) + ENDIF() + MESSAGE(STATUS "VTK>=9 detected, will use VTK_QT_VERSION=${VTK_QT_VERSION} for Qt version.") IF(${VTK_QT_VERSION} EQUAL 6) FIND_PACKAGE(Qt6 COMPONENTS Widgets Core Gui OpenGL PrintSupport QUIET OPTIONAL_COMPONENTS Svg) diff --git a/app/src/main.cpp b/app/src/main.cpp index 3603aca065..914a3496dc 100644 --- a/app/src/main.cpp +++ b/app/src/main.cpp @@ -55,9 +55,6 @@ int main(int argc, char* argv[]) CoInitialize(nullptr); #endif -#if VTK_MAJOR_VERSION >= 8 && defined(BUILD_AS_BUNDLE) - vtkObject::GlobalWarningDisplayOff(); -#endif #if VTK_MAJOR_VERSION > 9 || (VTK_MAJOR_VERSION==9 && VTK_MINOR_VERSION >= 1) // needed to ensure appropriate OpenGL context is created for VTK rendering. QSurfaceFormat::setDefaultFormat(QVTKRenderWidget::defaultFormat()); diff --git a/guilib/src/CloudViewer.cpp b/guilib/src/CloudViewer.cpp index cb2c7d110e..a67374f3b8 100644 --- a/guilib/src/CloudViewer.cpp +++ b/guilib/src/CloudViewer.cpp @@ -204,6 +204,10 @@ CloudViewer::CloudViewer(QWidget *parent, CloudViewerInteractorStyle * style) : } _visualizer->getRenderWindow()->SetNumberOfLayers(4); +#ifdef VTK_GLOBAL_WARNING_DISPLAY_OFF + _visualizer->getRenderWindow()->GlobalWarningDisplayOff(); +#endif + #if VTK_MAJOR_VERSION > 8 this->setRenderWindow(_visualizer->getRenderWindow()); #else