PlatformArgv
Give a tool a platform to fall back on, through Qt's own `-platform` argument rather than through the environment.
In the namespace utility::process. Declared in src/libs/libutil/utility/process/PlatformArgv.hpp.
Detailed description
A tool that constructs a `QGuiApplication` or `QApplication` needs a platform plugin, and Qt resolves that before `main()` gets to parse anything. With no display it aborts:
qt.qpa.xcb: could not connect to display This application failed to start because no Qt platform plugin could be initialized.
which it does for `–help` too — so a measurement tool written to be run over SSH could not so much as print its usage there. The environment variable that would fix it is forbidden (no-environment-variables §NEV-3), and Qt already offers the argument: `-platform` (§NEV-A3, the same route `TestArgs` uses for suites and `icon` uses for itself).
The default spec is a FALLBACK LIST, not `offscreen`. Qt's `init_platform` splits on `;` and tries each in turn (`qtbase/src/gui/kernel/qguiapplication.cpp`, Qt 6.11.1), so a tool run at a desk gets the real platform its GUI modes need — `banter-bench two-node gui` is a window an operator drives at the rig — and the same binary over SSH falls through to `offscreen` instead of dying.
An explicit `-platform` on the command line still wins: this inserts its own right after `argv[0]`, and Qt takes the LAST one it parses.
Usage — the object must outlive the application, because Qt keeps the pointers:
utility::process::PlatformArgv args(argc, argv); QApplication app(args.argc(), args.argv());