From dd5aad0e71213a37c7cf40b0f0f69616a40999be Mon Sep 17 00:00:00 2001 From: Eric Mehl Date: Fri, 25 Oct 2024 10:38:24 -0400 Subject: [PATCH] fixup! ColorChooser : Optimize slider redraws --- python/GafferUI/ColorChooser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/GafferUI/ColorChooser.py b/python/GafferUI/ColorChooser.py index 3abd8ad7ef0..b191b252e92 100644 --- a/python/GafferUI/ColorChooser.py +++ b/python/GafferUI/ColorChooser.py @@ -130,6 +130,7 @@ def __init__( self, color, component, dynamicColors = False, **kw ) : self.component = component self.__dynamicColors = dynamicColors self.__gradientToDraw = None + self.__size = self.size() # Sets the slider color in RGB space for RGBA channels, # HSV space for HSV channels and TMI space for TMI channels. @@ -161,7 +162,7 @@ def _drawBackground( self, painter ) : size = self.size() - if self.__gradientToDraw is None : + if self.__gradientToDraw is None or size != self.__size : self.__gradientToDraw = QtGui.QLinearGradient( 0, 0, size.x, 0 ) displayTransform = self.displayTransform() @@ -199,6 +200,7 @@ def _drawBackground( self, painter ) : brush = QtGui.QBrush( self.__gradientToDraw ) painter.fillRect( 0, 0, size.x, size.y, brush ) + self.__size = size def _drawValue( self, painter, value, position, state ) :