[Interest] how to get 3 pixel focus ring?
aclight at gmail.com
Mon Jun 8 14:18:21 CEST 2020
On Sun, Jun 7, 2020 at 2:21 PM David M. Cotter <dave at kjams.com> wrote:
> 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?
It might be as simple as returning a different value
for QStyle::PM_FocusFrameHMargin and QStyle::PM_FocusFrameVMargin in a
QStyle::pixelMetric or QProxyStyle::pixelMetric implementaton. If you're
using one of the standard styles then it's pretty simple to create and use
a QProxyStyle class to tweak pixel metrics and other aspects of the style.
If that doesn't work you may be able to reimplement
Q[Proxy]Style::drawControl for element QStyle::CE_FocusFrame and handle the
drawing of the focus frame itself.
One thing to watch out for is that making QStyle::PM_FocusFrameHMargin and
QStyle::PM_FocusFrameVMargin larger than default can result in the focus
frame getting clipped in some situations. We see this using persistent
editors in itemviews sometimes, and I think we also sometimes see this when
certain widgets are in splitters.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Interest