Closed Talkless closed 3 months ago
I can confirm this issue. It can even be reproduced in desktop mode with clickable desktop
.
@rinigus, what is the reason for those icons not to have an iconWidth
set?
Really weird. I wonder I don't see it in other platforms... Was it always like this on UT?
I think it started to be like this when UT switched from Qt 5.9 to 5.12.
Re iconWidth: it is not set to let it scale proportionally. Do you still have this issue at UT?
Yes, we still have the issue. Do you think it is a bug in the Ubuntu/Lomiri UI Toolkit?
It boils down to Icon implementation in UT. Corresponding type used by Pure Maps is https://github.com/rinigus/pure-maps/blob/master/qml/platform.uuitk/IconPL.qml . It is expected that the width would be calculated on the basis of height if not specified. That approach works for Kirigami, Silica, and older UT. Probably it is a bug in UT Icon.
Has anyone looked into it from UT side? Any bugs in Icon code? We have, in principle, square icons. I can try to set them both equal if not set otherwise...
I looked into it. This function should be responsible. I couldn't spot an issue there and also didn't yet debug.
This section is a bit weird, if I read it correctly. I would have used something like:
if (requestSize.width() > 0 && requestSize.height()==0) {
ratio = qreal(requestSize.width())/s.width();
}
...
Right now, if requstSize.height
is zero, but requestSize.width() > s.width()
is true, we don't get any scaling. For UT, we use the following icons: https://github.com/rinigus/pure-maps/blob/master/qml/platform.uuitk/StylerPL.qml#L60
I think force_scale
should be true
thanks to the svg format. Therefore we should end up scaling the image. But even if we would not scale it, it should keep its ratio and not get distorted, shouldn't it?
No, Info and Delete are Ubuntu Touch provided icons from its theme. So, they could be something else...
They are svg, too.
If I remove * factor
from this line, the icons show correctly. The factor
logic does not seem to work as intended and I have a hard time understanding it in the first place.
When I print the values, this is what I get:
w: -32, req: 364, item.width: 0
w: 591, req: 364, item.width: 623
Looks like on first calculation item.width
is still zero, causing the factor
to be 1/4.
I have added if (item.width == 0) return 1.0;
to the factor
calculation. This seems to fix it. But if I resize the window to be very narrow once, they get squeezed again. If I return to a broad width, they stay squeezed.
I created a bug report upstream and opened a PR with the workaround mentioned above (see the video).
Just as a side note: In the video above you can see that the other icons don't get squeezed horizontally. But they get squeezed vertically when the app width is small, making the whole factor logic meaningless. Is this the case for other platforms, too?
Thank you very much for looking into it. No, on Kirigami it works as it should. Note that you can probably install Pure Maps through Flatpak on Linux PC and see it for yourself. I have icons reduced in size as needed.
But the fix ensuring that there is no zero division, if I understand it correctly, should be there. Will look into PR in a sec
It is not a zero division, but just the incorrect initial assumption of not enough space due to width 0
. In a sequence of events and bugs this leads to the squeezed icons.
Fixed with the 3.3.0 release.
Yep, works as expected. Thanks!
Screenshot on Ubuntu Touch (Volla Phone X, had same issue on smaller BQ Aquaris E5):
Screenshot was made while pressing "Info" button. We can see that it's area is small, button's width is squeezed and rather hard to hit with your finger. Same with marker button.
Same situation in landscape mode.