using qAsConst
This commit is contained in:
parent
6455c26f86
commit
b89fa86b67
@ -317,8 +317,17 @@ void QskGradient::setStops( const QskGradientStops& stops )
|
||||
m_isDirty = true;
|
||||
}
|
||||
|
||||
QskGradientStops QskGradient::stops() const
|
||||
const QskGradientStops& QskGradient::stops() const
|
||||
{
|
||||
#if 1
|
||||
/*
|
||||
Returning a const& so that it is possible to write:
|
||||
for ( const auto& stop : qAsConst( gradient.stops() ) )
|
||||
|
||||
Once we have changed QskGradientStop from QColor to QRgb
|
||||
we should check if there is a better solution possible
|
||||
*/
|
||||
#endif
|
||||
return m_stops;
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ class QSK_EXPORT QskGradient
|
||||
Q_INVOKABLE QColor endColor() const;
|
||||
|
||||
Q_INVOKABLE void setStops( const QVector< QskGradientStop >& );
|
||||
Q_INVOKABLE QVector< QskGradientStop > stops() const;
|
||||
Q_INVOKABLE const QVector< QskGradientStop >& stops() const;
|
||||
|
||||
Q_INVOKABLE bool hasStopAt( qreal value ) const;
|
||||
|
||||
|
@ -36,7 +36,7 @@ uint QskArcNode::hash() const
|
||||
{
|
||||
uint h = m_metrics.hash();
|
||||
|
||||
for( const auto& stop : m_gradient.stops() )
|
||||
for( const auto& stop : qAsConst( m_gradient.stops() ) )
|
||||
h = stop.hash( h );
|
||||
|
||||
return h;
|
||||
|
@ -18,7 +18,7 @@ void QskArcRenderer::renderArc(const QRectF& rect,
|
||||
|
||||
QGradientStops stops;
|
||||
|
||||
for( const QskGradientStop& stop : gradient.stops() )
|
||||
for( const QskGradientStop& stop : qAsConst( gradient.stops() ) )
|
||||
{
|
||||
QGradientStop s( stop.position(), stop.color() );
|
||||
stops.append( s );
|
||||
|
@ -434,7 +434,7 @@ static inline void qskCreateBorder(
|
||||
const qreal dy1 = in.top - in.bottom;
|
||||
const qreal dy2 = out.top - out.bottom;
|
||||
|
||||
for( const auto& stop : gradientBottom.stops() )
|
||||
for( const auto& stop : qAsConst( gradientBottom.stops() ) )
|
||||
{
|
||||
const Color c( stop.color() );
|
||||
const qreal x1 = in.right - stop.position() * dx1;
|
||||
@ -445,7 +445,7 @@ static inline void qskCreateBorder(
|
||||
( line++ )->setLine( x1, y1, x2, y2, c );
|
||||
}
|
||||
|
||||
for( const auto& stop : gradientLeft.stops() )
|
||||
for( const auto& stop : qAsConst( gradientLeft.stops() ) )
|
||||
{
|
||||
const Color c( stop.color() );
|
||||
const qreal x1 = in.left;
|
||||
@ -456,7 +456,7 @@ static inline void qskCreateBorder(
|
||||
( line++ )->setLine( x1, y1, x2, y2, c );
|
||||
}
|
||||
|
||||
for( const auto& stop : gradientTop.stops() )
|
||||
for( const auto& stop : qAsConst( gradientTop.stops() ) )
|
||||
{
|
||||
const Color c( stop.color() );
|
||||
const qreal x1 = in.left + stop.position() * dx1;
|
||||
@ -467,7 +467,7 @@ static inline void qskCreateBorder(
|
||||
( line++ )->setLine( x1, y1, x2, y2, c );
|
||||
}
|
||||
|
||||
for( const auto& stop : gradientRight.stops() )
|
||||
for( const auto& stop : qAsConst( gradientRight.stops() ) )
|
||||
{
|
||||
const Color c( stop.color() );
|
||||
const qreal x1 = in.right;
|
||||
|
Loading…
x
Reference in New Issue
Block a user