[SailfishDevel] QML IconButton in SFOS 3.1

rinigus rinigus.git at gmail.com
Sat Aug 3 15:06:15 UTC 2019


Slava,

unfortunately, it doesn't work. IconButton property icon has color
subpropery defined in earlier SFOS versions as well. So,

            IconButton {

                id: image

                [...]

                Component.onCompleted: {

                    if ("color" in image.icon)

                        image.icon.color = undefined;

                }

            }


results in lots of warnings (Cannot assigned [undefined] to QColor).

Maybe there is some var I can check in QML to state that SFOS version is >=
3.1.0.0?

Rinigus

On Sat, Aug 3, 2019 at 5:33 PM Slava Monich <slava.monich at jolla.com> wrote:

> I don't think there's an "official" way of maintaining backward
> compatibility but I'd humbly suggest something like if ("color" in icon) ...
>
> e.g. I do this kind of thing to notifications:
>
>     Notification {
>         id: clipboardNotification
>         previewBody: "Copied to clipboard"
>         Component.onCompleted: {
>             if ("icon" in clipboardNotification) {
>                 clipboardNotification.icon = "icon-s-clipboard"
>             }
>         }
>     }
>
> Cheers,
>
> -Slava
>
> Hi,
>
> due to the changes in handling of icon coloring of IconButton in SFOS 3.1,
> I am getting a steady stream of EA users complaining about the absence of
> icons in Pure Maps - as in
> http://talk.maemo.org/showpost.php?p=1558483&postcount=773 . The issue
> has been described well in
> https://together.jolla.com/question/209315/bug-31011-qml-iconbutton-problems/
> without any response from Jolla devs. Let's see if we can get this response
> over here.
>
> In Pure Maps, icons are expected to be drawn according to the styling
> given by map, not by ambience. I was told that I can set icon.color:
> undefined as a property. However, when doing it for SFOS versions <3.1,
> this leads to lots of warning messages on stdout. What's an official way
> that I am expected to use when I want to support earlier SFOS versions as
> well?
>
> Cheers,
>
> Rinigus
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20190803/3f9acb55/attachment.html>


More information about the Devel mailing list