applets/mediacontroller: Fix widget auto resizing and fix titles getting cutout too short

Original commit message(s)

  • Fix widget auto resizing and fix titles getting cut out too short

Reason for the change

First is the issue with titles getting cutout too short, in my testing, this issue is caused by the widget being the exact width of the label with no extra space, this somehow causes title to get cutout, even though the entire title can fit with the widget size still being smaller than the specified maximum. I found that adding some extra space after the title makes the title cutout properly with the added benefit of making the widget look better when stacked with other widgets. Could there be a more elegant solution? Definitely, but I found this solution to work just fine.

Second of all is the issue with the widgets getting resized by themselves trying to show the whole title, I cannot imagine this being intentional. So I fixed it by just editing the switch case to return -1 instead of implicitWidth to Layout.preferredWidth.

Test plan

The widget works completely fine with no errors or extra logs.

Screenshots or screen recordings

The issue with the titles getting cutout:

Before After
Screenshot_20260209_215257.png Screenshot_20260209_220140.png

The issue with the desktop widget getting resized by it's own:

Before After
Screencast_20260208_182201.webm Screencast_20260208_182550.webm

Bugs fixed

BUG: 501166

Merge request reports

Loading