diff --git a/kstyle/breezehelper.h b/kstyle/breezehelper.h --- a/kstyle/breezehelper.h +++ b/kstyle/breezehelper.h @@ -165,7 +165,7 @@ void renderDebugFrame( QPainter*, const QRect& ) const; //* focus rect - void renderFocusRect( QPainter*, const QRect&, const QColor&, const QColor& outline = QColor(), Sides = 0 ) const; + void renderFocusRect( QPainter*, const QRect&, const QColor&, const QColor& outline = QColor(), bool hasSides = false ) const; //* focus line void renderFocusLine( QPainter*, const QRect&, const QColor& ) const; diff --git a/kstyle/breezehelper.cpp b/kstyle/breezehelper.cpp --- a/kstyle/breezehelper.cpp +++ b/kstyle/breezehelper.cpp @@ -441,15 +441,15 @@ } //______________________________________________________________________________ - void Helper::renderFocusRect( QPainter* painter, const QRect& rect, const QColor& color, const QColor& outline, Sides sides ) const + void Helper::renderFocusRect( QPainter* painter, const QRect& rect, const QColor& color, const QColor& outline, bool hasSides ) const { if( !color.isValid() ) return; painter->save(); painter->setRenderHints( QPainter::Antialiasing ); painter->setBrush( color ); - if( !( outline.isValid() && sides ) ) + if( !( outline.isValid() && hasSides ) ) { painter->setPen( Qt::NoPen ); @@ -463,10 +463,6 @@ copy.adjust( 0.5, 0.5, -0.5, -0.5 ); const qreal radius( frameRadius( -1.0 ) ); - if( !(sides&SideTop) ) copy.adjust( 0, -radius, 0, 0 ); - if( !(sides&SideBottom) ) copy.adjust( 0, 0, 0, radius ); - if( !(sides&SideLeft) ) copy.adjust( -radius, 0, 0, 0 ); - if( !(sides&SideRight) ) copy.adjust( 0, 0, radius, 0 ); painter->setPen( outline ); // painter->setBrush( Qt::NoBrush ); diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -4770,19 +4770,13 @@ if( useStrongFocus && ( selected || sunken ) ) { - const auto color = _helper->focusColor( palette ); + auto color = _helper->focusColor( palette ); + color.setAlphaF(0.3); + const auto backgroundColor = color; const auto outlineColor = _helper->focusOutlineColor( palette ); + bool hasSides = !menuItemOption->menuRect.isNull(); - Sides sides = nullptr; - if( !menuItemOption->menuRect.isNull() ) - { - if( rect.top() <= menuItemOption->menuRect.top() ) sides |= SideTop; - if( rect.bottom() >= menuItemOption->menuRect.bottom() ) sides |= SideBottom; - if( rect.left() <= menuItemOption->menuRect.left() ) sides |= SideLeft; - if( rect.right() >= menuItemOption->menuRect.right() ) sides |= SideRight; - } - - _helper->renderFocusRect( painter, rect, color, outlineColor, sides ); + _helper->renderFocusRect( painter, rect, backgroundColor, outlineColor, hasSides ); }