Bug 363423

Summary: widget misalignment with the "Macintosh" native platform theme
Product: [Frameworks and Libraries] frameworks-kguiaddons Reporter: RJVB <rjvbertin>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED DUPLICATE    
Severity: major CC: cfeck, simonandric5
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: macOS   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Screenshot of kcalc5 showing the widget rendering glitch when using the native "macintosh" widget style on OS X. The upper instance uses the regular Cocoa QPA, the lower instance the XCB QPA.

Description RJVB 2016-05-23 07:49:50 UTC
There is a longstanding bug somewhere in Qt or a KDE component that causes misalignment of certain widgets on OS X, when the native platform theme/style is used. With KDE4 this was so frequent that we (MacPorts) strongly suggested using QtCurve as the default theme, something which was then still possible with an unpatched Qt. We did report the issue, but it was never addressed.

It has become less frequent with KF5, but it still exists. The best showcase we found in KDE4, kcalc, is still affected, but it can also be seen in Kate's search & replace panel. Symptoms are:
- overlapping widgets
- widgets that are not large (high, usually) enough for the text

Affected widgets include buttons and comboboxes but I cannot exclude the possibility others are concerned too. There may be a link with font family or font size: KDE applications using a standard Qt and the native platform theme usually get end up using the same typeface (Lucida Sans 13) for almost everything because that's how Qt initialises the fontroles KDE uses. Clearly the buttons in kcalc do not use that typeface.

I'm filing this under kguiaddons, but I actually have no idea where the bug might be - it could even be in individual applications, but I wouldn't be surprised if it's in Qt itself. It is *not* purely in Qt's cocoa QPA plugin. One can build Qt for use under X11 on OS X, and install the resulting xcb qpa + dependencies in a normal build for cocoa. One can then launch, say, `kcalc5 -platform xcb -style macintosh` and it won't load the cocoa qpa but still have access to and use the Macintosh widget style. You get the same rendering glitches, which is why I expect the bug might be in Qt's drawing routines that render the "native" widgets (scoop: they're not rendered with "official" SDKs, there's no NSButton instance hiding behind a QButton).

Reproducible: Always


Actual Results:  
See the screenshot I'll be attaching.
Comment 1 RJVB 2016-05-23 07:53:47 UTC
Created attachment 99140 [details]
Screenshot of kcalc5 showing the widget rendering glitch when using the native "macintosh" widget style on OS X. The upper instance uses the regular Cocoa QPA, the lower instance the XCB QPA.
Comment 2 Christoph Feck 2016-05-24 00:55:42 UTC
> but I actually have no idea where the bug might be

These bugs are already reported:
- kcalc, see bug 339670
- kurlnavigator, see bug 296845
- kmultitabbar, see bug 296810

If there are additional cases, please report them separately.
I am closing this unspecific bug.

The bugs are in the "handmade" widgets, that paint using QStyle, but do not calculate metrics the way QMacStyle does. Only Mac developers will be able to debug this, as the Mac style uses Aqua, which is not available on Linux.

*** This bug has been marked as a duplicate of bug 339670 ***
Comment 3 RJVB 2016-05-24 12:01:20 UTC
Are you saying this should be corrected in individual applications rather than in some library somewhere? Is the `Qt::WA_LayoutUsesWidgetRect` attribute in any way involved?