Skip to content

Commit

Permalink
Fix cyclical QPaintEvent updates for color button, which caused exces…
Browse files Browse the repository at this point in the history
…sive cpu cycles
  • Loading branch information
dakcarto committed Mar 30, 2013
1 parent 0229ea9 commit 5660bc5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/gui/qgscolorbutton.cpp
Expand Up @@ -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 )
Expand Down
3 changes: 3 additions & 0 deletions src/gui/qgscolorbutton.h
Expand Up @@ -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:
Expand Down

0 comments on commit 5660bc5

Please sign in to comment.