In an attempt to avoid the segfault I’m getting with QVTKWidget (Qt-4.8, VTK-5.10) I am planning to upgrade to a version of VTK that includes QVTKOpenGLWidget. In which VTK version did this widget first appear? Will I need a later version of Qt as well? If possible I’d like to avoid having to make many code changes.
The first version of VTK containing QVTKOpenGLWidget is VTK 8.0.0
However, it has been reworked deeply recently, so I would suggest going for the next release this year, once it’s out.
Thanks Mathieu,
To get up to speed, I have installed Qt5, and built VTK-8.2.0 with Qt GUI support. To start with I am leaving my code as is, i.e. still using QVTKWidget. After many adjustments (to account for the changes from old versions of Qt and VTK) I am almost building my program (in Qt Creator). Now I just get one linking error:
/usr/local/lib/vtk-8.2/libvtkGUISupportQt-8.2.a(QVTKWidget.cxx.o) In function QVTKWidget::SetRenderWindow(vtkRenderWindow*)': QVTKWidget.cxx:-1: error: undefined reference toQX11Info::display()’
Does this convey anything to you? Does it mean QVTKWidget is not just deprecated, it is also invalid?
That example uses setRenderWindow, which is supposed to be a member function of QVTKWidget, e.g. see https://vtk.org/doc/nightly/html/classQVTKWidget.html. But I get the compile error:
class ‘QVTKWidget’ has no member named ‘setRenderWindow’
Presumably there have been some changes to QVTKWidget by version 8.2. This raises the question: is QVTKWidget usable with VTK 8.2? setRenderWindow no longer exists, and getRenderWindow doesn’t give a compile error but causes my program to crash.
Hi Mathieu,
The compile error is with my own program. I haven’t managed to get to the build stage yet with the Events example, because when I run cmake I get this error:
CMake Error at CMakeLists.txt:46 (add_executable):
Target “qtevents” links to target “Qt5::X11Extras” but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?
since that directory contains Qt5Config.cmake, but the same error occurs. Do you know what I need to do to ensure that cmake finds X11Extras? The library libQt5X11Extras.so is present with all the other Qt5 libraries.
(I get the same cmake error with the SimpleView example. With the ImageViewer example I get that the vtkTestingCore module is not available - I guess I didn’t build it.)
Thanks.
Edit: If I ignore the cmake error and run make anyway, I get many warnings about QVTKWidget being deprecated, then this link error:
[100%] Linking CXX executable qtevents
/usr/bin/ld: cannot find -lQt5::X11Extras
collect2: error: ld returned 1 exit status
Presumably there is a way to tell cmake where to find libQt5X11Extras.so, but it seems to be looking for a different name - libQt5::X11Extras.so. I don’t know how to treat that ‘Qt5::’.
Edit!!!
I discovered that the build was not using the Qt installation that I intended, which led to the discovery that I hadn’t built VTK-8.2 with Qt-5.13.0 (an earlier Qt installation was being used). Rebuilding VTK-8.2 with the right Qt fixed the example build problem (after I added X11Extras to the find-package list) - the Events example now works. I still have to sort out my own program
I’ve given up on getting QVTKWidget to work in my program on Linux. I’ve tried with both Qt4-VTK5 and Qt5-VTK8, getRenderWindow() causes the program to crash and I can’t see why. I’m going to explore using Qt’s own 3D capabilities.
The first version of VTK containing QVTKOpenGLWidget is VTK 8.0.0
However, it has been reworked deeply recently, so I would suggest going for the next release this year, once it’s out.
So, ParaView 5.4.1 (the one that can be installed with a package manager in Centos 7 or Ubuntu) is not using VTK 7.1.1 (I thought it was using that version of VTK) ?
@cory.quammen already answered you there, but for completeness, ParaView is not using a release of VTK, but a specific hash, which is a9b132548dc19b8e20898b424b31cafacbf39246 for ParaView 5.4.1.
Hi, FYI, I just was able to get QVTKOpenGLNativeWidget running together with vtkGenericOpenGLRenderWindow and QVTKInteractor on linux with 9.0.0.rc2
and Qt 5.14.1 (from openSUSE tumbleweed system package).
One weird thing is that I had to set vtkGenericOpenGLRenderWindow::SetGlobalMaximumNumberOfMultiSamples(0), sometimes
resulting in strange antialiasing. Without that, rendering was basically impossible.