Bug 488319

Summary: cb0f60c54e092a647ccf3831a0bc8ab08d79a3b8 regresses header appearance for QtWidgets KCMs
Product: [Frameworks and Libraries] frameworks-kwidgetsaddons Reporter: Nate Graham <nate>
Component: generalAssignee: Christoph Feck <cfeck>
Status: RESOLVED FIXED    
Severity: normal CC: kdelibs-bugs-null, kossebau
Priority: NOR Keywords: regression
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Messed up header

Description Nate Graham 2024-06-10 19:03:54 UTC
Created attachment 170355 [details]
Messed up header

STEPS TO REPRODUCE
1. Navigate to a QtWidgets KCM in System Settings like Device Actions (e.g by running `systemsettings kcm_solid_actions`)

OBSERVED RESULT
Header is visually messed up, as in the attached screenshot

EXPECTED RESULT
Header looks the same as in QtQuick KCMs

ADDITIONAL INFORMATION
The regression is more significant with color schemes that have Header colors such as Breeze Light, but it's still visibly broken with other color schemes like Breeze Classic
Comment 1 Friedrich W. H. Kossebau 2024-06-11 08:57:49 UTC
Playing a bit with the code to understand the mechanisms, seems the change to KTitleWidget as side-effects also changed its default QSizePolicy(s), and also affected the vertical centering. Which was not intended and sadly not considered when doing the patch, as all places tested just used the default size of the widget, in retrospective.
Systemsettings though relies on those behaviours for its usage of KTitleWidget, when doing its twisting to simulate the QtQuick UI, in the class ModuleView with its KTitleWidget subclass CustomTitle also rendering the full background.

As I would not see arguments in favour of the new behaviours, which is different from that of a QLabel as a sibling purpose widget.
So going to do a patch to KTitleWidget to restore the old sizing behaviour. Some first approach already exists locally, still pondering about alternatives, should appear close to KWidgetsAddons repo later today.
Comment 2 Bug Janitor Service 2024-06-11 14:41:49 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kwidgetsaddons/-/merge_requests/253
Comment 3 Friedrich W. H. Kossebau 2024-06-11 18:09:32 UTC
Git commit cdc949aa4f323cc1832a5d24942dadbf337b59c5 by Friedrich W. H. Kossebau.
Committed on 11/06/2024 at 14:50.
Pushed by cullmann into branch 'master'.

KTitleWidget: restore size policies to Preferred & vertical centering

cb0f60c54e092a647ccf3831a0bc8ab08d79a3b8 made the internal QGridLayout the
main layout. This as unintended side-effect changed two things:
* KTitleWidget now follows the QLayout::SetFixedSize size constraint set
  on that grid layout
* any content will be aligned at the top if there is more space available
  then needed

Wrapping the grid layout again into a QVBoxLayout and making this the
main layout restores the old default KTitleWidget size policies, which also
resemble those of a plain QLabel.

M  +11   -1    src/ktitlewidget.cpp

https://invent.kde.org/frameworks/kwidgetsaddons/-/commit/cdc949aa4f323cc1832a5d24942dadbf337b59c5