Draw scrollbar as focused when scrollbar itself have focus
ClosedPublic

Authored by drosca on Dec 26 2016, 4:36 PM.

Details

Summary

Fixes case when scrollbar have the scrolling widget as focus proxy.

Diff Detail

Repository
R31 Breeze
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
drosca updated this revision to Diff 9367.Dec 26 2016, 4:36 PM
drosca retitled this revision from to Draw scrollbar as focused when scrollbar itself have focus.
drosca updated this object.
drosca edited the test plan for this revision. (Show Details)
drosca added reviewers: Plasma, hpereiradacosta.
Restricted Application added a project: Plasma. · View Herald TranscriptDec 26 2016, 4:36 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript

Hi, ,Thanks for the patch !

Do you have an example application for which this fixes the issue ?
I'm a bit worried about the possible regressions that your change introduced, so I would like to understand better what happens here ...

kstyle/breezestyle.cpp
3067

You sure this is actually needed ? The primitive is supposed to do an horizontal line below the passed rect. Never seen that happened for scrollbars. Does it really ? (without the patch)

Currently, it tries to find QAbstractScrollArea in parent chain and use focused state of this scroll area (+ there is a special case for KTextView). There is no standard way to specify the widget that is being scrolled by the scrollbar. This only works with standard Qt widgets and breaks when you implement custom widget that uses scrollbars.

This proposed solution also checks if the scrollbar itself have the focus, which I think makes sense and should not have any side-effects. Even in the case when scrollbar is actually able to get focus (ie scrollbar having focus while the scrolled widget not having it) it still should be rendered as focused, because it *is* focused.

My use case is scrollbar controlling widget that is not parent of the scrollbar and scrollbar having focusproxy the scrolled widget.

kstyle/breezestyle.cpp
3067

Yes, this is needed because it is painted when the scrollbar have focus (which is the case this patch is trying to support).

hpereiradacosta accepted this revision.Dec 26 2016, 5:22 PM
hpereiradacosta edited edge metadata.

Ok. I buy it. Thanks for the clarification.
Ship it then. (and feel free to push the same for oxygen)

This revision is now accepted and ready to land.Dec 26 2016, 5:22 PM
This revision was automatically updated to reflect the committed changes.