From 103746d71910b7756bacdfff8176e22f0a0b4cc0 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Thu, 1 Dec 2022 14:23:13 +0100 Subject: [PATCH] more C++11 --- src/graphic/QskColorFilter.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/graphic/QskColorFilter.cpp b/src/graphic/QskColorFilter.cpp index 85c26fb2..e6094bd3 100644 --- a/src/graphic/QskColorFilter.cpp +++ b/src/graphic/QskColorFilter.cpp @@ -41,12 +41,11 @@ static inline QBrush qskSubstitutedBrush( { QBrush newBrush; - const QGradient* gradient = brush.gradient(); - if ( gradient ) + if ( const auto gradient = brush.gradient() ) { bool isModified = false; - QGradientStops stops = gradient->stops(); + auto stops = gradient->stops(); for ( auto& stop : stops ) { const QColor c = qskSubstitutedColor( substitions, stop.second ); @@ -61,7 +60,7 @@ static inline QBrush qskSubstitutedBrush( { newBrush = brush; - QGradient* newGradient = const_cast< QGradient* >( newBrush.gradient() ); + auto newGradient = const_cast< QGradient* >( newBrush.gradient() ); newGradient->setStops( stops ); } } @@ -167,7 +166,7 @@ QPen QskColorFilter::substituted( const QPen& pen ) const if ( m_substitutions.isEmpty() || pen.style() == Qt::NoPen ) return pen; - const QBrush newBrush = qskSubstitutedBrush( m_substitutions, pen.brush() ); + const auto newBrush = qskSubstitutedBrush( m_substitutions, pen.brush() ); if ( newBrush.style() == Qt::NoBrush ) return pen; @@ -181,7 +180,7 @@ QBrush QskColorFilter::substituted( const QBrush& brush ) const if ( m_substitutions.isEmpty() || brush.style() == Qt::NoBrush ) return brush; - const QBrush newBrush = qskSubstitutedBrush( m_substitutions, brush ); + const auto newBrush = qskSubstitutedBrush( m_substitutions, brush ); return ( newBrush.style() != Qt::NoBrush ) ? newBrush : brush; }