Run Environment is missing DISPLAY env variable
When deploying to a device (Odroid in this case, but the specific device is not significant), the Run Environment is lacking the DISPLAY env variable. This causes the deployment to fail with a
QXcbConnection: Could not connect to displayerror. Adding the DISPLAY variable set to :0 allows the application to launch correctly.
If I check env in a shell on the target device, the DISPLAY variable is of course set to :0, as expected. But hitting "Fetch Device Environment" in QtCreator pulls in only a small subset (crucially, missing DISPLAY) from the device environment.
How can this be fixed, besides adding that variable manually every time I open a project?
I'm not convinced that any proactive action ought to be required, but I have verified that adding
qputenv("DISPLAY", ":0");before creating the QApplication instance does indeed work.