import QtQuick 2.4 import QtQuick.Window 2.2 import Ubuntu.Components 1.3 MainView { height: units.gu(40) width: units.gu(40) property bool isLandscape: true readonly property int maxSize: Math.max(Screen.width, Screen.height) Rectangle { anchors.fill: parent color: UbuntuColors.red } CrossFadeImage { id: crossfade anchors.fill: parent fillMode: Image.PreserveAspectCrop source: isLandscape ? Qt.resolvedUrl("horizontal.jpg") : Qt.resolvedUrl("vertical.jpg") sourceSize: isLandscape ? Qt.size(0, maxSize) : Qt.size(maxSize, 0) onSourceChanged: console.log("source", source) onSourceSizeChanged: console.log("sourceSize", sourceSize) } Button { anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom anchors.bottomMargin: units.gu(1) text: "Switch" onClicked: isLandscape = !isLandscape } }