使用样式表仅部分设置背景颜色 [英] Set background color only partially with stylesheets
本文介绍了使用样式表仅部分设置背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何为背景的一部分设置背景颜色,如下图所示:
How can I set the background color for a part of the background like in the following image:
当然,没有边框,我只想设置青色.
Of course, without border frames, I want to set only the cyan color.
我需要将左部分(青色)的长度设置为小部件长度的百分比,例如30%.
I need to set the length of the left part (cyan) as the percentage of the widget length, e.g 30%.
推荐答案
使用CSS,我会稍微修改qlineargradient.请注意,青色的边缘可能有点模糊.
With css I would hack qlineargradient a little bit. Note that edge of cyan may be a little blurry.
QFrame
{
background-color: qlineargradient(x1:0, x2: 1, stop: 0 cyan, stop: 0.29 cyan, stop: 0.2901 white, stop: 1 white);
}
这篇关于使用样式表仅部分设置背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文