Bug 476383

Summary: Panel spacers center applets in free space, instead of in the middle of the panel
Product: [Plasma] plasmashell Reporter: Alex Čižinský <alex.cizinsky>
Component: Panel Spacer widgetAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: alex.cizinsky, nate, niccolo, notmart
Priority: NOR Keywords: qt6, regression
Version First Reported In: master   
Target Milestone: 1.0   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Comparison between 5.27 and 6 on horizontal panel
Comparison between 5.27 and 6 on vertical panel
The bug on Neon-Unstable

Description Alex Čižinský 2023-10-31 18:23:42 UTC
Created attachment 162773 [details]
Comparison between 5.27 and 6 on horizontal panel

SUMMARY
When using panel spacers to center an applet on a panel, the applet will be in the center of the two panel spacers, instead of in the center of the panel, like in Plasma 5.27

STEPS TO REPRODUCE
1.  Put at least two applets on a panel 
2.  Center one of them using panel spacers
3.  Set those spacers to Set Flexible Size

OBSERVED RESULT
The applet is centered in the free space where are the spacers
All spacers have the same length

EXPECTED RESULT
Plasma 5.27 behavior:
  The applet is in the middle of the panel
  Spacers may not have the same length

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE Tumbleweed 
(available in About System)
KDE Plasma Version: 5.27.80 -> Master - build using kdesrc-build
KDE Frameworks Version: 5.240.0
Qt Version: 6.6.0

ADDITIONAL INFORMATION
I think this is regression between 5.27 and 6
 
Added image showing comparison between 5.27 and 6
This happens with any applet being centered, not only Task Manager like in the image

Also tested in Neon Unstable inside a virtual machine, showing the same result
Comment 1 Alex Čižinský 2023-10-31 18:26:09 UTC
Created attachment 162774 [details]
Comparison between 5.27 and 6 on vertical panel
Comment 2 Alex Čižinský 2023-10-31 18:27:44 UTC
Created attachment 162775 [details]
The bug on Neon-Unstable
Comment 3 Nate Graham 2023-11-01 21:03:35 UTC
Can reproduce.
Comment 4 Bug Janitor Service 2023-11-02 17:08:42 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3465
Comment 5 Nate Graham 2023-11-02 17:52:51 UTC
Git commit 09893ea151923979c25f0b85c0d2bf83f76772f1 by Nate Graham, on behalf of Alex Čižinský.
Committed on 02/11/2023 at 18:52.
Pushed by ngraham into branch 'master'.

Fix applet centering by spacers

Prior to this fix, when using spacers to center an applet in a panel,
the applet would be centered in the available space. However, the
desired behavior is for the applet to be centered in the middle of the
panel, just as it was in Plasma 5.27.

The reason of this bug are the API changes in KF6. Prior to this fix,
the code would try to call nonexistent properties, resulting in the
optimalSize property being NaN.

M  +2    -2    applets/panelspacer/package/contents/ui/main.qml

https://invent.kde.org/plasma/plasma-workspace/-/commit/09893ea151923979c25f0b85c0d2bf83f76772f1