From 278876855b372afe791020bd50ada182f848820d Mon Sep 17 00:00:00 2001 From: David Rosca Date: Mon, 26 Dec 2016 17:35:15 +0100 Subject: [PATCH] Draw scrollbar as focused when scrollbar itself have focus Fixes case when scrollbar have the scrolling widget as focus proxy. Differential Revision: https://phabricator.kde.org/D3813 --- kstyle/breezestyle.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp index 51c637e3..a16ba54b 100644 --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -3063,8 +3063,8 @@ namespace Breeze //___________________________________________________________________________________ bool Style::drawFrameFocusRectPrimitive( const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { - // no focus indicator on buttons, since it is rendered elsewhere - if ( widget && qobject_cast< const QAbstractButton*>( widget ) ) + // no focus indicator on buttons / scrollbars, since it is rendered elsewhere + if ( qobject_cast< const QAbstractButton*>( widget ) || qobject_cast< const QScrollBar*>( widget ) ) return true; #if QT_VERSION >= 0x050000 @@ -4947,7 +4947,7 @@ namespace Breeze // check focus from relevant parent const QWidget* parent( scrollBarParent( widget ) ); - const bool hasFocus( enabled && parent && parent->hasFocus() ); + const bool hasFocus( enabled && ( (widget && widget->hasFocus()) || (parent && parent->hasFocus()) ) ); // enable animation state const bool handleActive( sliderOption->activeSubControls & SC_ScrollBarSlider );