Comment 8 for bug 1371509

Revision history for this message
Tim Peeters (tpeeters) wrote :

so, it broke here:

=== modified file modules/Ubuntu/Components/Icon10.qml
--- modules/Ubuntu/Components/Icon10.qml 2014-08-21 13:59:24 +0000
+++ modules/Ubuntu/Components/Icon10.qml 2014-09-02 09:39:09 +0000
@@ -34,42 +34,16 @@
     Image {
         id: image
         objectName: "image"
- anchors.fill: parent
-
- /* Necessary so that icons are not loaded before a size is set. */
- source: ""
- sourceSize {
- width: 0
- height: 0
- }
-
- Component.onCompleted: update()
- onWidthChanged: update()
- onHeightChanged: update()
- Connections {
- target: icon
- ignoreUnknownSignals: true
- onNameChanged: image.update()
- onSourceChanged: image.update()
- }
-
- function update() {
- // only set sourceSize.width, sourceSize.height and source when
- // icon dimensions are valid, see bug #1349769.
- if (width > 0 && height > 0
- && (icon.name || (icon.hasOwnProperty("source") && icon.source))) {
- sourceSize.width = width;
- sourceSize.height = height;
- if (icon.hasOwnProperty("source")) {
- source = icon.source;
- } else {
- source = "image://theme/%1".arg(icon.name);
- }
- } else {
- source = "";
- sourceSize.width = 0;
- sourceSize.height = 0;
- }
+ anchors { top: parent.top; bottom: parent.bottom }
+ fillMode: Image.PreserveAspectFit;
+ sourceSize.height: height
+ source: {
+ if (icon.name)
+ return "image://theme/%1".arg(icon.name);
+ else if (icon.hasOwnProperty("source"))
+ return icon.source;
+ else
+ return "";
         }

         cache: true