我在主窗口中使用了 QFrame。这个QFrame的背景颜色要求是:
背景
颜色69/69/69
顶部轮廓 1px; 90/90/90
右轮廓1px; 49/49/49
16px内的阴影;颜色 0/0/0;
不透明度15%
并在此框架顶部有一条线:
线
尺寸 1 像素
颜色49/49/49
这里,我无法给出背景的阴影效果。使用的样式表是:
border-right: 1px solid #313131;
border-top: 1px solid #313131;
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #5A5A5A,
stop: 0.05 #5A5A5A,
stop:0.06 rgb(0,0,0,38.5),
stop:0.43 rgb(0,0,0,38.5),
stop:0.44 #454545);
使用这个,我只能获得顶部的阴影效果,并且我想在该帧的右端获得相同的阴影效果。
我如何实现这一目标?
您可能想使用 qradialgradient 来代替。
参见 http://doc.qt.io/qt-5/stylesheet-reference.html#list-of-properties
这样的事情应该会给你一个类似于你想要做的结果:
background: qradialgradient(cx:0.5, cy:0.5, radius: 2.5,
fx:0.5, fy:0.5, stop:0 white, stop:1 black);
您可以查看 http://doc.qt.io/qt-5/qradialgradient.html 或者只是稍微调整一下这些值来实现您所需要的。