void MainWindow::paintEvent(QPaintEvent *e)
{
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
painter.translate(250,250);
int centerX = width()/2;
int centerY = height() / 2;
int radial = qMin(centerX,centerY) * 0.8;
painter.setRenderHints(QPainter::Antialiasing);
// 纯黑色背景
painter.setPen(Qt::NoPen);
painter.setBrush(Qt::black);
painter.drawRect(-249,-249,width(),height());
QRadialGradient g;
// 焦点在内部中心位置
QColor color = QColor(0,255,0,150).lighter();
g.setCenter(0,0);
g.setRadius(250);
//g = QRadialGradient(0,0 ,250,0,0 ,0.1);
g.setColorAt(0,QColor(color.red(),color.green(),color.blue(),150));
// g.setColorAt(0.5,QColor(0,255,0,50));
// g.setColorAt(0.2,QColor(0,255,0,100));
// g.setColorAt(0.6,QColor(0,255,0,50));
// g.setColorAt(0.8,QColor(0,255,0,10));
g.setColorAt(1,QColor(color.red(),color.green(),color.blue(),10));
//painter.fillRect(0,0,width(),height(),g);
painter.setBrush(g);
painter.drawPie(-249,-249,499,499,0,360*16);
return QMainWindow::paintEvent(e);
}