Qt自绘实现环形图鼠标覆盖阴影特性

效果图

Qt自绘实现环形图鼠标覆盖阴影特性_第1张图片
Qt自绘实现环形图鼠标覆盖阴影特性_第2张图片

思路

使用mouseMoveEvent移动事件来判断鼠标是否在图层中。圆环的坐标路径使用QPainterPath保存,使用QPainterPath的contains方法判断鼠标位置是否在图层之内。
使用两次绘图,外层绘制饼图使用QPainter.drawPie,内层使用QPainter.drawEllipse绘制圆。

透明窗体使用鼠标移动事件完成

#include 
#include 
#include<

你可能感兴趣的:(Qt,qt,开发语言)