Bug 498582

Summary: GroupBox caption is truncated
Product: [Plasma] Breeze Reporter: finalcountdown72
Component: QStyleAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: jb, nate, noahadvs, uhhadd
Priority: NOR    
Version First Reported In: 6.2.5   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=436993
Latest Commit: Version Fixed In: 6.4.0
Sentry Crash Report:
Attachments: Example project and screenshot
QGroupBox font issue

Description finalcountdown72 2025-01-12 23:17:51 UTC
Created attachment 177309 [details]
Example project and screenshot

SUMMARY
When using a point size of less than 10, GroupBox captions are truncated. 

STEPS TO REPRODUCE
Create a QGroupBox widget with caption "GroupBox1" and a Noto Sans font with a point size of 8.

I've attached an example project exhibiting the problem.

OBSERVED RESULT
The centered GroupBox caption text is truncated at the left and right. The lower the size, the more pronounced the truncation. It seems the actual font size does not go down, only the width determined via QFontMetrics.size goes down, causing the truncation.

The attachment contains a screenshot.

EXPECTED RESULT
The caption is legible in its entirety. With the 'Fusion' and 'Windows' qt styles, it's working as expected.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: EndeavourOS, kernel 6.12.8, Wayland
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.9.0
Qt Version: 6.8.1

ADDITIONAL INFORMATION
The logicalDotsPerInch values of my screen are all 96, screen scale factor in KDE settings is 100%.
Comment 1 Jean-Baptiste Mardelle 2025-05-01 07:13:42 UTC
I can confirm the issue, we are also seeing it in Kdenlive. Problem seems to be that with the Breeze style, when using a specific font, the QGroupBox title does not use the correct font and keeps a default large font.
Comment 2 Jean-Baptiste Mardelle 2025-05-01 07:14:50 UTC
Created attachment 180841 [details]
QGroupBox font issue

You can see in the screenshot that with the Breeze style, an incorrect font is used, while with Fusion style it uses the correct one
Comment 3 Jean-Baptiste Mardelle 2025-05-01 07:19:30 UTC
This is using:
KDE Frameworks: 6.12.0
Plasma: 6.3.4
Qt: Using 6.9.0 and built against 6.9.0
Manjaro Linux (Wayland)
Comment 4 Bug Janitor Service 2025-05-01 16:08:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/breeze/-/merge_requests/541
Comment 5 Kai Uwe Broulik 2025-05-01 19:52:36 UTC
Git commit 9f6f7eb6f2bf61b66f0712e5975c5ed6ba2465f3 by Kai Uwe Broulik.
Committed on 01/05/2025 at 16:06.
Pushed by broulik into branch 'master'.

kstyle: Take into account widget font when drawing QGroupBox

We do it when calculating the metrics but not when actually drawing
the widget, causing it to draw out of bounds when there's a custom font.

M  +1    -1    kstyle/breezestyle.cpp

https://invent.kde.org/plasma/breeze/-/commit/9f6f7eb6f2bf61b66f0712e5975c5ed6ba2465f3