k-donn / plasmoid-wunderground

A Plasma 5/6 widget for showing data from Wunderground PWS
https://store.kde.org/p/2135799
GNU General Public License v2.0
39 stars 15 forks source link

Panel Text Overlapping Neighbor Widget #27

Closed gnemonix closed 5 months ago

gnemonix commented 3 years ago

First thing after logging in to a new session the panel text is overlapping it's neighbor widget on the right. (see screenshot)

Upon going to Configuration -> Appearance and changing the font size (Compact Representation) to anything else and hitting Apply, the panel width and margins are recalculated. Then I can set the font size to my desired size, or even auto.

This is immediately after login. weather_on_login

This is after font size twiddling. weather_after_font_size_twiddling

plasmoid-wunderground version 2.3.7 (also had issue on 2.3.3 before updating) plasmashell 5.22.5 Qt: 5.15.2 KDE Frameworks: 5.85.0 kf5-config: 1.0

Thanks.

k-donn commented 3 years ago

Hello! Sorry about the late response.

The size of the widget is dynamically calculated based on a helper element. The helper element depends on the configuration values. So, the size of the widget is currently only changed when the config values change.

The critical part is here (Notice the TODO as I predicted this might be an issue) https://github.com/k-donn/plasmoid-wunderground/blob/6989fcec95b5fc3364a382de0b9bc36bb97ef5f8/plasmoid/contents/ui/IconAndTextItem.qml#L46

I can add a Component.onCompleted call in IconAndTextItem.qml that actually sets the size of the widget when the widget first loads.

I'll work on this ASAP

Thanks!

k-donn commented 2 years ago

Hello again.

I have done some debugging of the widget. The problem is not related to the calculation of the helper size element. Instead, the size of the icon is not properly calculated when the widget first loads.

With my settings, the text should be 80px wide and the icon should be 64px wide. However, on first load the width of the icon is only 16px wide. Then, I have to follow the behavior you mentioned and change the font size under Appearance which then somehow the icon now calculated its width properly and the widget is correctly resized.

I cannot find anything on the internet about "KDE Plasma SVG icon size not calculated on first load" so I am going to look through the QML rendering engine and see about anything I might be able to do to solve this.

I am currently seeing about a hacky solution that would involve manually multiplying the size of the icon on first load.

Thank you very much for understanding my busy schedule and delay!

k-donn commented 5 months ago

As far as I can tell, this is now fixed in plasma 6. Immediately, after logging in, the widget's boundaries are correctly calculated.