summaryrefslogtreecommitdiffstats
path: root/examples/declarative/aspectratio/scale_to_fit_simple.qml
blob: 4ee06ba4a1928164344f1a58dd5f13f3e94920ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import Qt 4.6

// Here, we implement "Scale to Fit" behaviour, using the
// preserveAspect property.
//
Rectangle {
    // default size: whole image, unscaled
    width: Image.width
    height: Image.height
    color: "gray"
    clip: true

    Image {
        id: Image
        source: "pics/face.png"
        fillMode: "PreserveAspect"
        anchors.fill: parent
    }
}