How to get VTK9 + Qt6 working together?

Hi @sankhesh, thanks for the response. Yes, I followed the instructions (again today). The output after performing the final step in the MR checkout instructions:

 Merge made by the 'recursive' strategy.
 CMake/vtk-config.cmake.in                 |  5 +++++
 Documentation/release/dev/qt6-support.md  |  6 ++++++
 GUISupport/Qt/CMakeLists.txt              | 29 ++++++++++++++++++++++++-----
 GUISupport/Qt/QFilterTreeProxyModel.cxx   |  4 ++++
 GUISupport/Qt/QVTKInteractor.cxx          |  5 +++++
 GUISupport/Qt/QVTKInteractorAdapter.cxx   |  6 +++---
 GUISupport/Qt/QVTKOpenGLNativeWidget.cxx  |  1 -
 GUISupport/Qt/QVTKOpenGLStereoWidget.cxx  |  1 -
 GUISupport/Qt/QVTKOpenGLWindow.cxx        |  1 -
 GUISupport/Qt/QVTKRenderWindowAdapter.cxx |  3 +--
 GUISupport/Qt/Testing/Cxx/CMakeLists.txt  |  4 ++--
 GUISupport/Qt/vtkQWidgetTexture.cxx       |  8 ++++----
 GUISupport/Qt/vtkQtDebugLeaksView.cxx     |  8 ++++++++
 Rendering/Qt/CMakeLists.txt               |  6 +++---
 Views/Qt/CMakeLists.txt                   |  6 +++---
 15 files changed, 68 insertions(+), 25 deletions(-)

This is exactly the number of changes on the MR page. With this, I had to choose 4 Qt6 directories (Widgets, WidgetsTools, CoreTools, GuiTools) in the CMake Configure phase, and then got this error:

CMake Error at CMake/vtkModule.cmake:4228 (message):
  Could not find the Qt5 external dependency.
Call Stack (most recent call first):
  GUISupport/QtSQL/CMakeLists.txt:11 (vtk_module_find_package)

You can see the hard-coded Qt5:: in the above line, and a single : in another file:

(base) % grep -n Qt5 GUISupport/QtSQL/CMakeLists.txt 
12:  PACKAGE     Qt5
15:  VERSION_VAR         Qt5_VERSION)
16:vtk_module_link(VTK::GUISupportQtSQL PUBLIC Qt5::Sql Qt5::Widgets)

(base) % grep -n ":Widgets" Views/Qt/CMakeLists.txt 
21:vtk_module_link(VTK::ViewsQt PRIVATE Qt${VTK_QT_MAJOR_VERSION}:Widgets)
                                                                ^^^

Full disclaimer: today I haven’t tried to fix these errors, but I expect the result to be the same as yesterday’s exercise (did it twice!). For example, now I grepped for some (not all) of the code lines that didn’t compile yesterday:

(base) % grep -n "fontMetric.width(" Rendering/Qt/vtkQtTreeRingLabelMapper.cxx
366:      if (sdimDC[0] < fontMetric.width(minString))
                                     ^^^
374:      if (sdimDC[1] < fontMetric.width(minString))
411:        delta_x = -(fontMetric.width(testString)) / 2.;
415:        delta_x = -fontMetric.width(testString);

(base) % grep -n QRegExp Views/Qt/vtkQtListView.cxx
163:void vtkQtListView::SetFilterRegExp(const QRegExp& pattern)
                                              ^^^

Today, the downloaded MR git tag looks correct – as I admitted, I had somehow messed up the tag yesterday. I believe all the other necessary changes (over and above the 15 on the MR page) are outlined in my previous response, at least on Mac OS.

If I build it again today, I will post back. Thanks again!