QPixmap createSphere(uchar diameter, const QColor& color) const{ QPixmap pixmap(diameter, diameter); pixmap.fill(Qt::transparent); QPainter p; p.begin(&pixmap); p.setRenderHint(QPainter::Antialiasing, true); p.setPen(QPen(Qt::NoPen)); qreal gx = diameter * 0.3125; QRadialGradient gradient(gx, gx, diameter); gradient.setColorAt(0, QColor(255, 255, 255)); gradient.setColorAt(0.5, color); gradient.setColorAt(1, color); p.setBrush(QBrush(gradient)); p.drawEllipse(1, 1, diameter - 2, diameter - 2); p.end(); return pixmap;}