From 9337e61b54dc75745e60cdb7e88cba75cf4f3946 Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 24 Sep 2008 12:21:19 +0000 Subject: [PATCH] Fix problem with drawing color button when assigned color is invalid. --- src/Qtx/QtxColorButton.cxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Qtx/QtxColorButton.cxx b/src/Qtx/QtxColorButton.cxx index 9b9daec17..3fae56101 100644 --- a/src/Qtx/QtxColorButton.cxx +++ b/src/Qtx/QtxColorButton.cxx @@ -230,9 +230,6 @@ void QtxColorButton::paintEvent( QPaintEvent* e ) { QToolButton::paintEvent( e ); - if ( !color().isValid() ) - return; - QStyleOptionToolButton opt; opt.initFrom( this ); opt.text = text(); @@ -245,7 +242,15 @@ void QtxColorButton::paintEvent( QPaintEvent* e ) QPixmap pix( r.size() ); pix.fill( palette().color( backgroundRole() ) ); - drawColor( &pix, color() ); + + if ( color().isValid() ) + drawColor( &pix, color() ); + else { + QPainter pixp( &pix ); + pixp.drawRect( 2, 2, pix.width() - 4, pix.height() - 4 ); + pixp.fillRect( 3, 3, pix.width() - 6, pix.height() - 6, QBrush( Qt::BDiagPattern ) ); + pixp.end(); + } QPainter p( this ); p.drawPixmap( r, pix ); -- 2.39.2