docker 容器中的 GUI Qt 应用程序 [英] GUI Qt Application in a docker container

查看:91
本文介绍了docker 容器中的 GUI Qt 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在安装了/tmp/.X11-unix 的容器 docker 中运行一些 Qt 应用程序.我在此处看到这可能很困难.

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.

所以当我在容器 docker 中运行 kdevelop 时,它不起作用(我有一个空窗口).但是如果我运行 qtcreator 就好了.

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.

我认为差异来自Qt版本(kdevelop是在Qt4中开发的,而qtcreator是在Qt5中开发的).我所有其他的 qt5 应用程序都运行良好,但在 qt4 中没有一个.

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.

问题:

有谁知道如何在不通过 vnc 或 ssh 的情况下启动 qt4 应用程序,就像这样:

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

?

推荐答案

Qt5和Qt4有不同的渲染子系统

Qt5 and Qt4 has a different rendering subsystems

Qt4 渲染器只需要一个提示:

Qt4 renderer just needs a hint:

export QT_GRAPHICSSYSTEM="native"

这一定可行

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

这篇关于docker 容器中的 GUI Qt 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆