Bug 398960

Summary: Weather widget shows huge icons while third part icon theme is in use
Product: [Plasma] plasmashell Reporter: Patrick Silva <bugseforuns>
Component: WeatherAssignee: Friedrich W. H. Kossebau <kossebau>
Status: RESOLVED FIXED    
Severity: normal CC: kde, nate, plasma-bugs
Priority: NOR    
Version: 5.13.90   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.14.0
Sentry Crash Report:
Attachments: demonstration

Description Patrick Silva 2018-09-22 14:56:08 UTC
Created attachment 115165 [details]
demonstration

SUMMARY


STEPS TO REPRODUCE
1. install newaita icon theme from kde store
2. drag weather widget from widgets explorer to your desktop
3. set your city in widget settings

EXPECTED RESULT
weather widget icons have correct size


ACTUAL RESULT
weather widget shows huge icons and the widget can not be resized.
See the screencast please.


SOFTWARE VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.13.90
Qt Version: 5.11.2
KDE Frameworks Version: 5.50.0
Comment 1 Friedrich W. H. Kossebau 2018-09-22 16:00:07 UTC
Thanks for the report. As nice as those icons look, I agree that's not enough of reason to have the widget unshrinkable that large. :)

Will see to give that a closer look in the next days what triggers such a large seemingly minimum size.
This one, https://store.kde.org/p/1243493/ , right?
Comment 2 Patrick Silva 2018-09-22 16:18:25 UTC
(In reply to Friedrich W. H. Kossebau from comment #1)
> This one, https://store.kde.org/p/1243493/ , right?

Right.
Comment 3 Kai Uwe Broulik 2018-09-24 07:52:25 UTC
Probably IconItem placed in a QtQuick Layout where the icon item's implicit size takes precedence over any custom set width/height. It should set Layout.preferredWidth (or Layout.minimum/maximumWidth) to fix that.
Comment 4 Friedrich W. H. Kossebau 2018-09-24 13:36:10 UTC
(In reply to Kai Uwe Broulik from comment #3)
> Probably IconItem placed in a QtQuick Layout where the icon item's implicit
> size takes precedence over any custom set width/height. It should set
> Layout.preferredWidth (or Layout.minimum/maximumWidth) to fix that.

Yes, the IconItems are inside Layouts. And the weather icons from newaita internally have a size of width="512pt" height="512pt" viewBox="0 0 512 512" (slightly puzzled about the "pt" there), while the Breeze ones have 48.

Seems though that just setting Layout.minimumWidth/Height is not sufficient somehow, that will be ignored/reset somehow.

The "conditionIcon" in the top panel has the minimum set to Huge=64, but yet it cannot be resized to something smaller for some reason. See the current code for which this bug report is valid here:
https://cgit.kde.org/kdeplasma-addons.git/tree/applets/weather/package/contents/ui/TopPanel.qml

Adding a
```
        MouseArea {
            anchors.fill: parent

            onClicked: {
                console.log("MW:"+parent.Layout.minimumWidth+" PW:"+parent.Layout.preferredWidth+" IW:"+parent.implicitWidth);
                console.log("MH:"+parent.Layout.minimumHeight+" PH:"+parent.Layout.preferredHeight+" IH:"+parent.implicitHeight);
            }
        }
```
the output on click in the toppanel status icon is
```
qml: MinW:64 PrefW:-1 ImplW:512
qml: MinH:64 PrefH:-1 ImplH:512
```
where I would have expected one is able to shrink the IconItem still? But somehow the layout does not react accordingly.

The icons in the forecast columns are exposing an even greater challenge, being created by a Loader in a Repeater, who again are created by a Loader in a repeater, where Layout property setting is not yet really understood by me (and possibly broken in my code or perhaps even Qt ones).

Going to play some more to get more ideas...
Comment 5 Friedrich W. H. Kossebau 2018-09-25 15:11:09 UTC
Git commit a49908b6eaef562afa5d5f82769c63925a4ec4d0 by Friedrich W. H. Kossebau.
Committed on 25/09/2018 at 15:10.
Pushed by kossebau into branch 'Plasma/5.14'.

[weather applet] Fix unwanted ruling of implicit icon sizes on displayed size

Summary:
FIXED-IN: 5.14.0

Test Plan:
Switching icon sets between newaita, Breeze, or Oxygen no longer results in
different (too large) icon sizes to be used.

Reviewers: broulik

Reviewed By: broulik

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D15744

M  +16   -8    applets/weather/package/contents/ui/ForecastView.qml
M  +2    -0    applets/weather/package/contents/ui/TopPanel.qml

https://commits.kde.org/kdeplasma-addons/a49908b6eaef562afa5d5f82769c63925a4ec4d0