diff options
Diffstat (limited to 'examples/declarative/aspectratio')
6 files changed, 19 insertions, 21 deletions
diff --git a/examples/declarative/aspectratio/face_fit.qml b/examples/declarative/aspectratio/face_fit.qml index 35c63ce..3005d1b 100644 --- a/examples/declarative/aspectratio/face_fit.qml +++ b/examples/declarative/aspectratio/face_fit.qml @@ -1,7 +1,3 @@ -// The Image primitive does not have any special handling for maintaining -// aspect ratio. This example shows that you can provide whatever specific -// behaviour you like. -// // Here, we implement a hybrid of the "scale to fit" and "scale and crop" // behaviours which will crop up to 25% from *one* dimension if necessary // to fully scale the other. This is a realistic algorithm, for example diff --git a/examples/declarative/aspectratio/face_fit_animated.qml b/examples/declarative/aspectratio/face_fit_animated.qml index 366d27b..9036eeb 100644 --- a/examples/declarative/aspectratio/face_fit_animated.qml +++ b/examples/declarative/aspectratio/face_fit_animated.qml @@ -1,7 +1,3 @@ -// The Image primitive does not have any special handling for maintaining -// aspect ratio. This example shows that you can provide whatever specific -// behaviour you like. -// // Here, we extend the "face_fit" example with animation to show how truly // diverse and usage-specific behaviours are made possible by NOT putting a // hard-coded aspect ratio feature into the Image primitive. diff --git a/examples/declarative/aspectratio/scale_and_crop.qml b/examples/declarative/aspectratio/scale_and_crop.qml index a5409f9..2f35fb5 100644 --- a/examples/declarative/aspectratio/scale_and_crop.qml +++ b/examples/declarative/aspectratio/scale_and_crop.qml @@ -1,7 +1,3 @@ -// The Image primitive does not have any special handling for maintaining -// aspect ratio. This example shows that you can provide whatever specific -// behaviour you like. -// // Here, we implement "Scale and Crop" behaviour. // Rect { diff --git a/examples/declarative/aspectratio/scale_and_sidecrop.qml b/examples/declarative/aspectratio/scale_and_sidecrop.qml index e076735..4b1eb63 100644 --- a/examples/declarative/aspectratio/scale_and_sidecrop.qml +++ b/examples/declarative/aspectratio/scale_and_sidecrop.qml @@ -1,7 +1,3 @@ -// The Image primitive does not have any special handling for maintaining -// aspect ratio. This example shows that you can provide whatever specific -// behaviour you like. -// // Here, we implement a variant of "Scale and Crop" behaviour, where we // crop the sides if necessary to fully fit vertically, but not the reverse. // diff --git a/examples/declarative/aspectratio/scale_to_fit.qml b/examples/declarative/aspectratio/scale_to_fit.qml index 61a4082..867eb37 100644 --- a/examples/declarative/aspectratio/scale_to_fit.qml +++ b/examples/declarative/aspectratio/scale_to_fit.qml @@ -1,8 +1,5 @@ -// The Image primitive does not have any special handling for maintaining -// aspect ratio. This example shows that you can provide whatever specific -// behaviour you like. -// -// Here, we implement "Scale to Fit" behaviour. +// Here, we implement "Scale to Fit" behaviour "manually", rather +// than using the preserveAspect property. // Rect { // default size: whole image, unscaled 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 + } +} |