[Interest] how to get 3 pixel focus ring?
David M. Cotter
dave at kjams.com
Mon Jun 8 21:48:03 CEST 2020
can anyone explain why tree view looks fine but table view only has 1 pixel?
@adam did you download the example project? it's trivial to run and you can test several implementations. which impl would be used with your suggestion of PM_FocusFrame margins?
and do you have maybe example code to implement your suggestion?
part of my question is: is this a bug in Qt ? because IMHO "QFocusFrame" should "just work", and why does it NOT?
or setting the style to 3 px should "just work" and why does it NOT work but only for certain widgets?
you'd think that QFocusFrame would *manage* the clipping properly?
or the doc should be more clear, with sample code, cuz i've read the doc several times and am no further along :(
any help would be greatly appreciated! if you like karaoke, i have an app for you ;-)
-dave
> On Jun 8, 2020, at 5:18 AM, Adam Light <aclight at gmail.com> wrote:
>
> On Sun, Jun 7, 2020 at 2:21 PM David M. Cotter <dave at kjams.com <mailto: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.
>
> Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200608/0f799210/attachment.html>
More information about the Interest
mailing list