diff options
Diffstat (limited to 'examples/declarative/aspectratio/scale_to_fit_simple.qml')
-rw-r--r-- | examples/declarative/aspectratio/scale_to_fit_simple.qml | 20 |
1 files changed, 20 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..7389581 --- /dev/null +++ b/examples/declarative/aspectratio/scale_to_fit_simple.qml @@ -0,0 +1,20 @@ +import Qt 4.6 + +// Here, we implement "Scale to Fit" behaviour, using the +// fillMode property. +// +Rectangle { + // default size: whole image, unscaled + width: face.width + height: face.height + color: "gray" + clip: true + + Image { + id: face + smooth: true + source: "pics/face.png" + fillMode: Image.PreserveAspectFit + anchors.fill: parent + } +} |