From: vsr Date: Wed, 24 Sep 2008 12:21:19 +0000 (+0000) Subject: Fix problem with drawing color button when assigned color is invalid. X-Git-Tag: V5_1_0a2~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9337e61b54dc75745e60cdb7e88cba75cf4f3946;p=modules%2Fgui.git Fix problem with drawing color button when assigned color is invalid. --- 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 );