qt - QLabel border visible within QGridLayout
问题描述
I'm facing a problem with UI design.
I'm using QT 4.6.2 with QTCreator 1.3.1
I have a QFrame with a background image that "draw" the grid see image below
When i add a QLabel within the layout, when i run the app i see top left border. For test, i moved out the QLabel from the Layout and it works as expected (no border at all)
Do you have any idea about that?
Thanks in advance for your kindly help
Leo
解决方案
您可能正在使用样式表来设置 QFrame 的背景。像这样的东西:
QFrame{
background-image: url(picture.png);
}
样式表传播到子小部件,所以我的想法是您的背景也适用于子 QLabels。
将您的样式表更改为这个(注意开头的点):
.QFrame{
background-image: url(picture.png);
}
点选择器只会将样式表限制为 QFrame 类型为 QFrame 的子小部件,但不会将其应用于继承类,如 QLabel。请参阅文档以了解有关选择器的更多信息。
推荐阅读
- windows - 每天只执行一次批处理脚本
- javascript - 如何在这个javascript代码中添加“IF result = X”而不是“RETURN x”?
- graphql - GraphQL - 如何将返回值用作下一个查询的变量?
- javascript - 如何一次从localStorage中检索多个数据并存储数据
- mapbox - Mpabox GL 放置图层悬停偏移
- r - 为什么我使用 fileInput 的数据路径更改为 /var 数据路径本身?以及如何取回原始数据路径
- reactjs - 使用 React 显示登录或注销按钮
- google-cloud-platform - 替代 Google 服务帐户
- sql - 从每个 id 的多个重复记录中制作一个主记录
- javascript - 无法在端口 443 上创建 PeerJS 服务器