[Interest] how to get 3 pixel focus ring?

Elvis Stansvik elvstone at gmail.com
Wed Jun 10 08:59:08 CEST 2020


If you really want this, how about a proxy style? (QProxyStyle). I think
that's the only way for you to get what you want.

You could try to wrangle it using a QFocusFrame subclass with custom
paintEvent, but you'd have to manually track widget resizes using an event
filter, and I'm not sure you're guaranteed that all styles will respect the
focus frame and stand off on painting their own focus visualization. When I
tried it here with the Breeze style I'd get both my own QFocusFrame and
Breeze's own focus visualization, which stuck out a little underneath since
it's rounded.

I know you didn't want any judgement but in general it's bad to disregard
the user's choice of widget style and do these kind of customizations. I as
a Breeze user wish to see Breeze's focus visualization, not that
applications override them.

Even if you have had that look for 10 years without users complaining, it
does not mean they like it - they could just see it as a minor oddity and
shrug at it.

Elvis

Den sön 7 juni 2020 23:21David M. Cotter <dave at kjams.com> skrev:

> i have an example project (see below), that tries 6 different
> implementations, attempts to make the focus ring 3 pix wide. None of them
> work on windows, and only one of them PARTIALLY works on mac. What i want
> is the style you get around a text edit on mac, but i want that style on
> ALL widgets, and i want it on windows too.
>
> anyone have any idea how i can accomplish this?
>
> Please see the example project <http://kjams.com/downloads/qfocustest.zip>.
> I've set it up so the same code can be run on both mac and windows (use
> file sharing to run both at once).
>
> thanks
>
> -dave
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200610/fed82c40/attachment.html>


More information about the Interest mailing list