D9119: Initialize scale factor to the last scale factor set on any instance
Eike Hein
noreply at phabricator.kde.org
Sun Dec 3 14:57:13 UTC 2017
hein added a comment.
So I worked out why this happens. We have API like this:
SvgItem {
svg: Svg { imagePath: "..." }
}
Without my patch, `Svg` is instanciated with a scale factor of 1.0 always. Then `setImagePath` is called on it first. Then `SvgItem::setSvg` is called with the `Svg` instance and calls `setScaleFactor` on it.
In this pattern, `SvgItem` doesn't get a chance to set the scale factor before `imagePath`, because it's not the one setting the latter.
The only call site fix here would be to implement `QQmlParserStatus` in `Svg` and then set `scaleFactor` from QML everywhere by accessing `Units`. But this hygiene would be really hard to enforce, especially in third-party widgets.
I still consider my patch to be a fairly pragmatic solution to this.
REPOSITORY
R242 Plasma Framework (Library)
REVISION DETAIL
https://phabricator.kde.org/D9119
To: hein, #plasma, davidedmundson, broulik, mart
Cc: graesslin, plasma-devel, #frameworks, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20171203/fda0b61b/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list