@@ -1,5 +1,5 @@
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2014, 2015 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -21,7 +21,16 @@ Image {
22 fillMode: Image.PreserveAspectCrop
22 fillMode: Image.PreserveAspectCrop
24− readonly property real itemAspectRatio: width / height
24+ property bool useHeight: false
25+ function updateUseHeight()
25− readonly property real imageAspectRatio: implicitWidth / implicitHeight
27+ useHeight = (implicitWidth / implicitHeight) > (width / height);
30+ onHeightChanged: updateUseHeight();
31+ onWidthChanged: updateUseHeight();
32+ onImplicitHeightChanged: updateUseHeight();
33+ onImplicitWidthChanged: updateUseHeight();
26− sourceSize: (imageAspectRatio > itemAspectRatio) ? Qt.size(0, height) : Qt.size(width, 0)
35+ sourceSize: useHeight ? Qt.size(0, height) : Qt.size(width, 0)