summaryrefslogtreecommitdiffstats
path: root/examples/declarative/aspectratio/scale_to_fit_simple.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/aspectratio/scale_to_fit_simple.qml')
-rw-r--r--examples/declarative/aspectratio/scale_to_fit_simple.qml17
1 files changed, 13 insertions, 4 deletions
diff --git a/examples/declarative/aspectratio/scale_to_fit_simple.qml b/examples/declarative/aspectratio/scale_to_fit_simple.qml
index ae2be83..4f89586 100644
--- a/examples/declarative/aspectratio/scale_to_fit_simple.qml
+++ b/examples/declarative/aspectratio/scale_to_fit_simple.qml
@@ -1,8 +1,17 @@
// Here, we implement "Scale to Fit" behaviour, using the
// preserveAspect property.
//
-Image {
- id: Image
- source: "pics/face.png"
- preserveAspect: true
+Rect {
+ // default size: whole image, unscaled
+ width: Image.width
+ height: Image.height
+ color: "gray"
+ clip: true
+
+ Image {
+ id: Image
+ source: "pics/face.png"
+ preserveAspect: true
+ anchors.fill: parent
+ }
}