Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
run qml map app on server with no gui
I need to grab map image with route displayed on it and save this as a picture. It needs to be done by server application, so I have created another app and I'm running it inside QProcess of the server.
The problem is that if I run this process on Linux server without GUI I have this error:
"qt.qpa.screen: QXcbConnection: Could not connect to display \nCould not connect to any X display.\n"
Has anyone some idea how to make it work, except for installing GUI on a server?
Run your app with
-platform offscreenflag. I'm not sure if it will allow you to actually grab an image of the scene (most probably not).
@sierdzio thanks for answer
It runs but generates empty images,
there is an error:
QOpenGLContext is NULL!
So, you need the GUI stuff (or at least OpenGL) installed. Mind you, it does not mean that you need to have a display attached, it can still be a headless server. I think ;-)
I ran my program with this flag on my Laptop which has xserver, and pictures are blank, so I imagine I would need xserver installed on my Linux server
@sierdzio anyway, the answer for this problem i static images from mapbox API (if you need eg. to draw a route taken by a car)