When I try to visualize the detector geometry with Qt, I got an error about Qt, as shown below:
qt.qpa.plugin: Could not find the Qt platform plugin “windows” in “”
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
I have searched for this error on the web. One solution is to set an environment variable QT_PLUGIN_PATH = pathto\Qt\5.15.2\msvc2019_64\plugins. This makes it work. Qt was initialized successfully. But some other programs went wrong because of the environment variable QT_PLUGIN_PATH. I have to delete the environment variable QT_PLUGIN_PATH to ensure other programs based on Qt function well.
This application failed to start because no Qt platform plugin could be initialized Reinstalling the application may fix this problem. (This error is given by another program based on Qt after the environment variable QT_PLUGIN_PATH was set.)
I want to know what is wrong with my GEANT4 installation. I never met this problem before. Neither 10.7 on windows 11 with VS 2022 and Qt 5.15 nor 11.0 on windows 10 with VS 2022 and Qt 5.12.
Qt Version: 5.15.2
Geant4 Version: 11.1.2
Operating System: Windows 11 22H2
Compiler/Version: Visual Studio 2022
CMake Version: 3.27.4
Since there is no answer… We can try a workaround. I am not familiar with installations in windows. However, I have seen the Linux subsystem of Windows working pretty well. The instructions to install the WLS have change, now it looks simpler
After installing the Linux subsystem you will have a native Linux virtual machine (ubuntu22 or other distribution). To enable visualization you may an X server like XMing (or other).
Since the environment is empty, you may need to install a number of packages. The metapackage ‘HEP OS lib’ takes care of it. The recipe for Ubuntu22,
I have a similar problem with Alma9, caused by a mismatch in the version of Qt5 packages (some are 5.12 and some 5.15). I have not found a nice solution to that yet.
Thanks for your reply.
I found another potential solution. Setting environment variable QT_QPA_PLATFORM_PLUGIN_PATH = pathto\Qt\5.15.2\msvc2019_64\plugins\platforms instead of QT_PLUGIN_PATH = pathto\Qt\5.15.2\msvc2019_64\plugins might fix this problem without causing any other errors.