diff --git a/src/common/QskGradient.cpp b/src/common/QskGradient.cpp index 4c2e271f..987474b4 100644 --- a/src/common/QskGradient.cpp +++ b/src/common/QskGradient.cpp @@ -693,6 +693,17 @@ QskGradientStops QskGradient::colorStops( return qskColorStops( rgb.constData(), count, discrete ); } +QGradientStops QskGradient::qtStops() const +{ + QGradientStops qstops; + qstops.reserve( m_stops.count() ); + + for ( const auto& stop : m_stops ) + qstops += { stop.position(), stop.color() }; + + return qstops; +} + #ifndef QT_NO_DEBUG_STREAM #include diff --git a/src/common/QskGradient.h b/src/common/QskGradient.h index 07fe8185..11503867 100644 --- a/src/common/QskGradient.h +++ b/src/common/QskGradient.h @@ -101,6 +101,8 @@ class QSK_EXPORT QskGradient Q_INVOKABLE QColor colorAt( int index ) const; Q_INVOKABLE int stopCount() const; + QGradientStops qtStops() const; + static QskGradientStops colorStops( const QVector< QRgb >&, bool discrete = false ); diff --git a/src/nodes/QskArcRenderer.cpp b/src/nodes/QskArcRenderer.cpp index c86ae82e..72f5576c 100644 --- a/src/nodes/QskArcRenderer.cpp +++ b/src/nodes/QskArcRenderer.cpp @@ -16,12 +16,6 @@ void QskArcRenderer::renderArc(const QRectF& rect, { painter->setRenderHint( QPainter::Antialiasing, true ); - QGradientStops stops; - stops.reserve( gradient.stops().count() ); - - for( const auto& stop : qAsConst( gradient.stops() ) ) - stops += QGradientStop( stop.position(), stop.color() ); - /* horizontal is interpreted as in direction of the arc, while vertical means from the inner to the outer border @@ -31,17 +25,17 @@ void QskArcRenderer::renderArc(const QRectF& rect, if( gradient.orientation() == QskGradient::Vertical ) { - QRadialGradient gradient( rect.center(), qMin( rect.width(), rect.height() ) ); - gradient.setStops( stops ); + QRadialGradient radial( rect.center(), qMin( rect.width(), rect.height() ) ); + radial.setStops( gradient.qtStops() ); - brush = gradient; + brush = radial; } else { - QConicalGradient gradient( rect.center(), metrics.startAngle() ); - gradient.setStops( stops ); + QConicalGradient conical( rect.center(), metrics.startAngle() ); + conical.setStops( gradient.qtStops() ); - brush = gradient; + brush = conical; } painter->setPen( QPen( brush, metrics.width(), Qt::SolidLine, Qt::FlatCap ) );