Bug 460542

Summary: QtWidgets KCM titles are not properly vertically centered
Product: [Applications] systemsettings Reporter: Phos <phyllon>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: minor CC: nate
Priority: NOR    
Version: 5.26.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.100
Sentry Crash Report:
Attachments: Keyboard KCM
This is a KCM that has proper alignment of title
This is a KCM that has bad title alignment
Bad title alignment

Description Phos 2022-10-16 14:55:16 UTC
Created attachment 152899 [details]
Keyboard KCM

SUMMARY
This occurs in many System Settings KCMs and Info Center App. 

STEPS TO REPRODUCE
1. Open system settings

OBSERVED RESULT
The names in the KCMs title is misaligned

EXPECTED RESULT
The names should be aligned

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.26.0
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.6
Kernel Version: 5.15.73-3-lts (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION
This also occurs in the Info Center application
Comment 1 Nate Graham 2022-10-17 19:52:36 UTC
What font, font size, force font dpi, and global scaling settings are you using?
Comment 2 Phos 2022-10-22 09:40:02 UTC
(In reply to Nate Graham from comment #1)
> What font, font size, force font dpi, and global scaling settings are you
> using?

I am using HarmonyOS Sans 10pt for Toolbar, Menu, Window Title and General. 
No force DPI
Scale in Display Configuration is 75% at 1920x1080.
Comment 3 Nate Graham 2022-10-24 18:03:38 UTC
Does it happen with 10pt HarmonyOS at 100% scale?

Does it happen with 10pt Noto Sans at 75% scale?
Comment 4 Phos 2022-10-25 13:29:34 UTC
(In reply to Nate Graham from comment #3)
> Does it happen with 10pt HarmonyOS at 100% scale?
Yes

> Does it happen with 10pt Noto Sans at 75% scale?
Yes (but with different KCMs) Some are correct and aligned, some are now off center.
Comment 5 Nate Graham 2022-10-25 16:44:42 UTC
What do you mean by off center? Can you attach a screenshot?
Comment 6 Phos 2022-10-25 19:57:50 UTC
(In reply to Nate Graham from comment #5)
> What do you mean by off center? Can you attach a screenshot?

The title in the titlebar of some KCMs are misaligned and are much closer to the left edge
Attached are some examples
Comment 7 Phos 2022-10-25 19:58:25 UTC
Created attachment 153202 [details]
This is a KCM that has proper alignment of title
Comment 8 Phos 2022-10-25 19:58:49 UTC
Created attachment 153203 [details]
This is a KCM that has bad title alignment
Comment 9 Phos 2022-10-25 19:59:06 UTC
Created attachment 153204 [details]
Bad title alignment
Comment 10 Phos 2022-10-25 20:00:21 UTC
All are Noto Sans 10pt
Display at 100% scaling, 1920x1080 on Wayland
Comment 11 Phos 2022-10-25 20:01:44 UTC
It seems like there are two ways that the title of the KCMs are being aligned one that is closer to the left edge and another that is further from the left edge. Look at the good KCM and bad KCM attachments.
Comment 12 Nate Graham 2022-10-26 17:42:24 UTC
The issue with KCMs having different left padding is something else, which is tracked elsewhere and already being worked on.

Let's focus on the bad vertical positioning in this bug report.
Comment 13 Ismael Asensio 2022-10-27 20:11:48 UTC
Git commit 40c97c954d5b39ba2888672a32090cc5b81eb921 by Ismael Asensio.
Committed on 27/10/2022 at 19:37.
Pushed by ngraham into branch 'master'.

KTitleWidget: Constraint the frame size so it properly aligns

Setting the layout constraint to `SetFixedSize` makes the frame
adapt to the labels size, fixing the wrong vertical alignment.

M  +1    -0    src/ktitlewidget.cpp

https://invent.kde.org/frameworks/kwidgetsaddons/commit/40c97c954d5b39ba2888672a32090cc5b81eb921