在某些时候,产品要求阴影窗口,例如下面的效果 当窗口在白色的背景下,四周就会有阴影。实现方法其实也不难,Qt已经支持的了这种效果,主要是应用QGraphicsDropShadowEffect类,该效果在Qt4.6就已经支持了,Qt助手的解释如下: A drop shadow effect renders the source with a drop shadow. The color of the drop shadow can be modified using the setColor() function. The drop shadow offset can be modified using the setOffset() function and the blur radius of the drop shadow can be changed with the setBlurRadius() function. By default, the drop shadow is a semi-transparent dark gray (QColor(63, 63, 63, 180)) shadow, blurred with a radius of 1 at an offset of 8 pixels towards the lower right. The drop shadow offset is specified in device coordinates. 下面给出具体代码以及实现。
Qt实现窗口四周阴影
关注
打赏