on xenial help sign in
More works on the sourceSize
e39795fAndrea Cimitan
Shell.qml+9−2
@@ -120,6 +120,15 @@ FocusScope {
120
120
121 function updateImage() {
121 function updateImage() {
122 if (testImage.status == Image.Ready) {
122 if (testImage.status == Image.Ready) {
123+ if (shell.width / shell.height <= testImage.sourceSize.width / testImage.sourceSize.height) {
124+ backgroundImage.sourceSize = undefined
125+ backgroundImage.sourceSize.height = shell.height
126+ }
127+ else {
128+ backgroundImage.sourceSize = undefined
129+ backgroundImage.sourceSize.width = shell.width
130+ }
131+
123 shell.background = testImage.source
132 shell.background = testImage.source
124 } else if (testImage.status == Image.Error) {
133 } else if (testImage.status == Image.Error) {
125 shell.background = shell.default_background
134 shell.background = shell.default_background
@@ -157,8 +166,6 @@ FocusScope {
157 Image {
166 Image {
158 id: backgroundImage
167 id: backgroundImage
159 source: shell.background
168 source: shell.background
160− sourceSize.width: parent.width
161− sourceSize.height: parent.height
162 anchors.fill: parent
169 anchors.fill: parent
163 fillMode: Image.PreserveAspectCrop
170 fillMode: Image.PreserveAspectCrop
164 }
171 }