diff options
Diffstat (limited to 'examples')
7 files changed, 39 insertions, 20 deletions
diff --git a/examples/declarative/aspectratio/face_fit.qml b/examples/declarative/aspectratio/face_fit.qml index 4573160..8d38cca 100644 --- a/examples/declarative/aspectratio/face_fit.qml +++ b/examples/declarative/aspectratio/face_fit.qml @@ -8,13 +8,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Image.width - height: Image.height + width: Face.width + height: Face.height color: "gray" clip: true Image { - id: Image + id: Face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/face_fit_animated.qml b/examples/declarative/aspectratio/face_fit_animated.qml index 7db1c80..7d73900 100644 --- a/examples/declarative/aspectratio/face_fit_animated.qml +++ b/examples/declarative/aspectratio/face_fit_animated.qml @@ -6,13 +6,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Image.width - height: Image.height + width: Face.width + height: Face.height color: "gray" clip: true Image { - id: Image + id: Face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_and_crop.qml b/examples/declarative/aspectratio/scale_and_crop.qml index 75080b4..3cace8d 100644 --- a/examples/declarative/aspectratio/scale_and_crop.qml +++ b/examples/declarative/aspectratio/scale_and_crop.qml @@ -4,13 +4,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Image.width - height: Image.height + width: Face.width + height: Face.height color: "gray" clip: true Image { - id: Image + id: Face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_and_crop_simple.qml b/examples/declarative/aspectratio/scale_and_crop_simple.qml new file mode 100644 index 0000000..26758e6 --- /dev/null +++ b/examples/declarative/aspectratio/scale_and_crop_simple.qml @@ -0,0 +1,19 @@ +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 + source: "pics/face.png" + fillMode: "PreserveAspectCrop" + anchors.fill: parent + } +} diff --git a/examples/declarative/aspectratio/scale_and_sidecrop.qml b/examples/declarative/aspectratio/scale_and_sidecrop.qml index a6bd2c8..18cc110 100644 --- a/examples/declarative/aspectratio/scale_and_sidecrop.qml +++ b/examples/declarative/aspectratio/scale_and_sidecrop.qml @@ -5,13 +5,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Image.width - height: Image.height + width: Face.width + height: Face.height color: "gray" clip: true Image { - id: Image + id: Face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_to_fit.qml b/examples/declarative/aspectratio/scale_to_fit.qml index 744abce..7450ea4 100644 --- a/examples/declarative/aspectratio/scale_to_fit.qml +++ b/examples/declarative/aspectratio/scale_to_fit.qml @@ -5,13 +5,13 @@ import Qt 4.6 // Rectangle { // default size: whole image, unscaled - width: Image.width - height: Image.height + width: Face.width + height: Face.height color: "gray" clip: true Image { - id: Image + id: Face source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_to_fit_simple.qml b/examples/declarative/aspectratio/scale_to_fit_simple.qml index 4ee06ba..dcccd69 100644 --- a/examples/declarative/aspectratio/scale_to_fit_simple.qml +++ b/examples/declarative/aspectratio/scale_to_fit_simple.qml @@ -1,19 +1,19 @@ import Qt 4.6 // Here, we implement "Scale to Fit" behaviour, using the -// preserveAspect property. +// fillMode property. // Rectangle { // default size: whole image, unscaled - width: Image.width - height: Image.height + width: Face.width + height: Face.height color: "gray" clip: true Image { - id: Image + id: Face source: "pics/face.png" - fillMode: "PreserveAspect" + fillMode: "PreserveAspectFit" anchors.fill: parent } } |