Qt--圆形阴影边框

来源:互联网 发布:最好股指期货交易软件 编辑:程序博客网 时间:2024/05/17 03:15
QPainterPath path;path.setFillRule(Qt::WindingFill);path.addEllipse(10,10, this->width()-20, this->height()-20);QPainter painter(this);painter.setRenderHint(QPainter::Antialiasing, true);painter.fillPath(path, QBrush(Qt::white));QColor color(0, 0, 0, 50);for(int i=0; i<10; i++){QPainterPath path;path.setFillRule(Qt::WindingFill);path.addEllipse(10-i, 10-i, this->width()-(10-i)*2, this->height()-(10-i)*2);color.setAlpha(150- qSqrt(i)*50);painter.setPen(color);painter.drawPath(path);}


10像素阴影

0 0