diff options
Diffstat (limited to 'examples/declarative/aspectratio/scale_to_fit_simple.qml')
-rw-r--r-- | examples/declarative/aspectratio/scale_to_fit_simple.qml | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/declarative/aspectratio/scale_to_fit_simple.qml b/examples/declarative/aspectratio/scale_to_fit_simple.qml new file mode 100644 index 0000000..4f89586 --- /dev/null +++ b/examples/declarative/aspectratio/scale_to_fit_simple.qml @@ -0,0 +1,17 @@ +// Here, we implement "Scale to Fit" behaviour, using the +// preserveAspect property. +// +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 + } +} |