Qt应用程序UI元素在Docker中随机呈现为空白/黑色 [英] Qt app UI elements randomly rendered as blank/black in Docker

查看:191
本文介绍了Qt应用程序UI元素在Docker中随机呈现为空白/黑色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我准备了



我使用的是Docker 18.06和Qt 5.01的Ubuntu 16.04.5。

解决方案

我遇到了同样的问题,但无法正式解决。但是我们发现了一种不显示错误的替代解决方法:



在我们的例子中,我们在一个窗口中有四个QComboBoxes。我们的问题是,启动应用程序后,您单击的第二个(有时是第一个)组合框显示了一个黑色弹出窗口。因此,我们要做的是用两个虚拟组合框初始化窗口,调用showPopup方法,然后隐藏弹出框和组合框。因此用户不会注意到该错误。希望您可以使用自己的应用做类似的事情。


I prepared Dockerfile to build Docker image of my Qt application. To run the application I use X - I enable access to X server (xhost +local:root), then I use the following command to run it:

docker run -it --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" \
    --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" mindforger:latest mindforger

The problem is that some Qt UI elements (menu items, dialogs, ...) are rendered blank in black (randomly) - check the screenshot below:

I'm on Ubuntu 16.04.5 with Docker 18.06 and Qt 5.01.

解决方案

I had the same problem, and I couldn't solve it formally. But we found an alternative workaround to not display the error:

In our case, we have four QComboBoxes in a window. Our problem was that after starting the app, the second (sometimes the first) combo box you clicked displayed a black popup. So what we did was initializing the window with two dummy combo boxes, calling the showPopup method, and then hiding both the popups and the combo boxes. So the user can't notice the error. I hope you can make something similar with your app.

这篇关于Qt应用程序UI元素在Docker中随机呈现为空白/黑色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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