VTK9.2 + Qt5.12 + Windows build (no python) runtime error: qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""

Hi, I built successfully vtk 9.2 rc2 since a while with a default config to whitch I added opengl2 support for rendering imaging and volumes, also have working multiple versions of qt that all build fine and on my path also have a 5.12.12 version (also tested with QT 5.14 versions and vtk 9.1 with the same failures).

I have a minimal qt app that find and links against:
find_package(VTK COMPONENTS
when i run it i get the error:
qt.qpa.plugin: Could not find the Qt platform plugin “windows” in “”
and the app exits.

Note that the manual is quite old and talks about Qt5/windows and it seems the QVTKWidgetPlugin.* additions are obsolete in VTK9?
See as an example https://vtk.org/Wiki/VTK/Configure_and_Build#VS2012

Any idea why?

I think Qt version is the problem.
VTK9.~ needs Qt 6.~ version.
Try with Qt version 6.~

Take a look at the Qt documentation for locating plugins for your application. Based on the error you reported, your app cannot locate the Qt platform plugins.

@mh0223 VTK 9 prefers Qt6 if both versions (Qt5 and Qt6) are found on the system but it is not a requirement. Even in that case, you should be able to explicitly control the Qt version with the CMake variable VTK_QT_VERSION.

3D Slicer latest version use VTK9.2 with Qt5.15 without major issues, so it may be better to use Qt6, but not required.

I was not checking the qt side yet because I have non-vtk other apps that work fine with the same Qt5.12 version I tried to used but it is a good idea to investigate that to.

Thanks to both of you for your feedback,

They are great Qt examples in VTK, you may want to start there.
BTW this looks moke like a Qt configuration issue.

VTK can work with Qt6 but Qt5 is way better tested.

1 Like

Sorry for the late answer, I’m only using Qt for learning from the examples purposes,
and as I have already developped my own MPR viewing UI using natively WPF/C# in conjunction with VTK/C++ built from sources( working and more stable already than the four pane viewer example in my current experience with VTK9 ), so I did not use Qt for a while ; but went back to it today and answering my own question for others to benefit, the problem was :

The Qt plugins (in particular the windows plugin) need to be either in the executable directory (like it is in apps such as ITK SNAP when searching for state of art deployments simpler than 3dslicer) or better in my use case: you just need to add once for all the extra path to

Once I added this extra path, it worked with Qt 5.15.2 (changed back to Qt5 influenced by the @mwestphal advice upper in this thread).

1 Like