20void QQuickFusionKnob::paint(QPainter *painter)
22 const qreal w = width();
23 const qreal h = height();
27 QColor color = QQuickItemPrivate::get(
this)->palette()->button().toHsv();
28 color.setHsv(color.hue(),
29 qMin(140, color .saturation()),
30 qMax(180, color.value()));
31 color = color.lighter(104);
32 color.setAlphaF(0.8f);
34 const qreal sz = qMin(w, h);
35 QRectF rect(0, 0, sz, sz);
36 rect.moveCenter(QPointF(w / 2.0, h / 2.0));
37 const QPointF center = rect.center();
39 QRadialGradient gradient(center.x() + rect.width() / 2,
40 center.y() + rect.width(),
42 center.x(), center.y());
43 gradient.setColorAt(1, color.darker(140));
44 gradient.setColorAt(qreal(0.4), color.darker(120));
45 gradient.setColorAt(0, color.darker(110));
47 painter->setRenderHint(QPainter::Antialiasing);
48 painter->setBrush(gradient);
49 painter->setPen(QColor(255, 255, 255, 150));
50 painter->drawEllipse(rect);
51 painter->setPen(QColor(0, 0, 0, 80));
52 painter->drawEllipse(rect.adjusted(1, 1, -1, -1));