From dc67b591c3e1c6e326b4af6a24150bd103f988b4 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Thu, 7 Aug 2014 18:27:43 +0200 Subject: [PATCH] Fixed rendering of dock widget buttons and titlebar buttons --- kstyle/breezestyle.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp index 6535c791..d1bcf830 100644 --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -4755,11 +4755,9 @@ namespace Breeze { // cast to abstract button - const QAbstractButton* button( qobject_cast( widget ) ); - // adjust state to have correct icon rendered + const QAbstractButton* button( qobject_cast( widget ) ); if( button->isChecked() || button->isDown() ) copy.state |= State_On; - else if( !(copy.state & State_MouseOver) ) copy.state &= ~State_Enabled; } else { @@ -5248,15 +5246,25 @@ namespace Breeze const QSize iconSize( iconWidth, iconWidth ); iconRect = centerRect( iconRect, iconSize ); - // get pixmap + // set icon mode and state const bool subControlActive( titleBarOption->activeSubControls & subControl ); - const QIcon::Mode iconMode =QIcon::Normal; - const QIcon::State iconState( QIcon::On ); -// const QIcon::Mode iconMode = ( active && enabled ) ? QIcon::Selected:QIcon::Normal; -// const QIcon::State iconState( subControlActive ? QIcon::On : QIcon::Off ); - const QPixmap pixmap = icon.pixmap( iconSize, iconMode, iconState ); + QIcon::Mode iconMode; + QIcon::State iconState; - // render + if( !enabled ) + { + iconMode = QIcon::Disabled; + iconState = QIcon::Off; + + } else { + + iconMode = active ? QIcon::Selected : QIcon::Normal; + iconState = subControlActive ? QIcon::On : QIcon::Off; + + } + + // get pixmap and render + const QPixmap pixmap = icon.pixmap( iconSize, iconMode, iconState ); painter->drawPixmap( iconRect, pixmap ); }