gpt4 book ai didi

qt - QFrame 的样式表影响 QLabel

转载 作者:行者123 更新时间:2023-12-05 01:46:45 27 4
gpt4 key购买 nike

我正在使用 QFrame 只是为了有彩色边框,因为我找不到改变 QDialog 颜色的方法。所以因为篡改QFrame的边框,它也影响了QLabel的外观,有没有如何避免这种情况?

编辑:这是我正在使用的样式表,其中 QLabels' 没有任何效果。它采用 QFrames'

QWidget {
background-color: black;
}
QLabel {
color:white;
border: solid 2px black;
font: bold 19px Sans Serif;
}
QFrame {
border: solid 2px white;
border-radius: 4px;
}

最佳答案

不要使用匹配该类及其子类的所有实例的类型选择器,而是使用类选择器。

所以在您的样式表中,不要使用 QFrame{...},而是使用 .QFrame{border: 1px solid red;}。注意类名前的 .

查看有关选择器类型的更多信息 here .

关于qt - QFrame 的样式表影响 QLabel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33796103/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com