gpt4 book ai didi

c++ - QScrollBar 上的样式表留下带有棋盘图案的滚动条背景?

转载 作者:IT老高 更新时间:2023-10-28 23:10:07 25 4
gpt4 key购买 nike

当我使用样式表设置我的 QScrollBar 样式时,背景颜色是方格的,而不是纯色的。

QScrollBar:horizontal {
background-color: grey;
}

enter image description here

如何让滚动条的背景变成纯色?

最佳答案

您所说的“背景”实际上是两个子元素add-pagesub-page。您需要在这些子元素上定义背景元素。

最简单的解决方案是删除两者上的 background。然后它将继承您已经在 QScrollBar 上设置的背景颜色 grey:

QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {
background: none;
}

enter image description here

但如果需要,您可以根据自己的喜好单独设置样式:

QScrollBar::sub-page:horizontal {
background: red;
}

QScrollBar::add-page:horizontal {
background: green;
}

enter image description here

Source.

不幸的是,这个解决方案很难从 official documentation 中推断出来。 .

关于c++ - QScrollBar 上的样式表留下带有棋盘图案的滚动条背景?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17935691/

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