Skip to content
Permalink
Browse files
Fix cyclical QPaintEvent updates for color button, which caused exces…
…sive cpu cycles
  • Loading branch information
dakcarto committed Mar 30, 2013
1 parent 0229ea9 commit 5660bc5f4c84f8d919ca7df029057ef300282b03
Showing with 16 additions and 1 deletion.
  1. +13 −1 src/gui/qgscolorbutton.cpp
  2. +3 −0 src/gui/qgscolorbutton.h
@@ -106,10 +106,22 @@ void QgsColorButton::changeEvent( QEvent* e )
QPushButton::changeEvent( e );
}

#if 0 // causes too many cyclical updates, but may be needed on some platforms
void QgsColorButton::paintEvent( QPaintEvent* e )
{
setButtonBackground();
QPushButton::paintEvent( e );

if ( !mBackgroundSet )
{
setButtonBackground();
}
}
#endif

void QgsColorButton::showEvent( QShowEvent* e )
{
setButtonBackground();
QPushButton::showEvent( e );
}

void QgsColorButton::setColor( const QColor &color )
@@ -117,7 +117,10 @@ class GUI_EXPORT QgsColorButton: public QPushButton

protected:
void changeEvent( QEvent* e );
#if 0 // causes too many cyclical updates, but may be needed on some platforms
void paintEvent( QPaintEvent* e );
#endif
void showEvent( QShowEvent* e );
static const QPixmap& transpBkgrd();

private:

0 comments on commit 5660bc5

Please sign in to comment.