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 display
error. 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?
-
-
Thanks @raven-worx
I'm not convinced that any proactive action ought to be required, but I have verified that addingqputenv("DISPLAY", ":0");
before creating the QApplication instance does indeed work.