From b50920c72bfa86b7998d840c92d09ad2eb00f84a Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 17 Apr 2023 17:32:20 +0200 Subject: [PATCH] color filter: Leave original brush as it was when substituting colors QBrush is explicitly shared, so when setting the gradient of a copy, we are also changing the gradient of the original. --- src/graphic/QskColorFilter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/graphic/QskColorFilter.cpp b/src/graphic/QskColorFilter.cpp index d748ba33..f8049754 100644 --- a/src/graphic/QskColorFilter.cpp +++ b/src/graphic/QskColorFilter.cpp @@ -56,10 +56,10 @@ static inline QBrush qskSubstitutedBrush( if ( isModified ) { - newBrush = brush; - - auto newGradient = const_cast< QGradient* >( newBrush.gradient() ); - newGradient->setStops( stops ); + auto newGradient = *gradient; + newGradient.setStops( stops ); + newBrush = QBrush( newGradient ); + newBrush.setTransform( brush.transform() ); } } else