summaryrefslogtreecommitdiffstats
path: root/examples/declarative/aspectratio/scale_to_fit_simple.qml
blob: 5381bb4dad0983bed307cb9f32fc2152cc001930 (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.
//
Rect {
    // 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
    }
}