PDA

View Full Version : how to make 3 pixel "focus ring"?



davecotter
7th June 2020, 22:17
i have an example project here, 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).

-dave

d_stranz
8th June 2020, 18:45
For those of us who have no idea what a "focus ring" around a text edit on a Mac is, it would be nice if you could post some screen shots of what you are trying to achieve, and what your current code actually does.

davecotter
8th June 2020, 20:00
it's trivial to run the example project, but okay here:

how a text edit looks:
13466

table view looks fine:
13468

tree view has only one pixel?
13467

d_stranz
9th June 2020, 17:01
You may have to implement your own style and override some of the drawing methods for primitive elements (PE_...) to accomplish this if the external methods you have tried with QFocusFrame or style sheets don't work.

The default styles on each of your platforms may be the cause of the differences you see in your test programs. Try setting a different QStyle in main() on Windows to see if you get a change in appearance.

And please don't assume that everyone on this forum has the time or resources to download, build, and run your test code on multiple platforms. This is an all-volunteer effort.