GUI Qt Application in a docker container

2020-02-29 05:24发布

I try to run some Qt application in a container docker with a mount of /tmp/.X11-unix. I saw here that can be difficult.

So when I run kdevelop in container docker, it does not work ( I have an empty window ). But if I run qtcreator it's fine.

I think the difference comes from the Qt version (kdevelop are developped in Qt4 and qtcreator in Qt5). All my others qt5 applications works fine, but not a single in qt4.

Question:

Does anyone know what to do to launch an qt4 application without going through vnc or ssh, just like this:

docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix someQt4AppContainer

?

标签: qt docker
1条回答
Luminary・发光体
2楼-- · 2020-02-29 06:00

Qt5 and Qt4 has a different rendering subsystems

Qt4 renderer just needs a hint:

export QT_GRAPHICSSYSTEM="native"

This must be work

QT_GRAPHICSSYSTEM="native" docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix someQt4AppContainer
查看更多
登录 后发表回答