Hi Slava, my code, corresponding snippet:
IconButton { id: image anchors.centerIn: parent down: pressed || parent.pressed icon.opacity: iconOpacity icon.source: iconName || iconSource icon.sourceSize.height: iconHeight icon.sourceSize.width: iconWidth onClicked: item.clicked() Component.onCompleted: { if ("color" in icon) { icon.color = undefined } } } On SFOS 3.0.3.9 (ported to OnePlus X), I get errors for a line with icon.color = undefined : file:///... Error: Cannot assign [undefined] to QColor So, it seems that this property was introduced before 3.1.x, but not used in 3.0.3. Rinigus On Wed, Aug 14, 2019 at 1:07 PM Slava Monich <slava.mon...@jolla.com> wrote: > Hi Rinigus, > > AFAICT icon.color appeared in 3.1 and it wasn't there before. > > This piece of QML seems to work for me without any warnings on both > 2.0.1.7 (no icon.color) and 3.1.1.xxx (latest devel, has icon.color): > > IconButton { > icon.source: "image://theme/icon-m-refresh" > Component.onCompleted: { > if ("color" in icon) { > icon.color = undefined > } > } > } > > I'm not sure if it does what you want it to do, but it doesn't produce any > warnings! > > And no, I'm not in a position to formulate the official position :) > > Cheers, > > -Slava > > Hi, > > it would be good to get some kind of official position on QML IconButton > issue. Is it considered for fixing or it will stay as it is? Slava's > suggestion didn't work since color member is available on older versions of > SFOS as well. > > Rinigus > > On Wed, Aug 7, 2019 at 2:29 PM rinigus <rinigus....@gmail.com> wrote: > >> Hi, >> >> any ideas on how to fix this IconButton issue? Is there a way to query >> SFOS version and make an ugly fix on the basis of that... >> >> Cheers, >> >> Rinigus >> >> On Sat, Aug 3, 2019 at 6:06 PM rinigus <rinigus....@gmail.com> wrote: >> >>> 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.mon...@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 >>>> >>>
_______________________________________________ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org