summaryrefslogtreecommitdiff
path: root/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtImage.qml
blob: 89e57bbf0e90a75c772103a3b1e8e8da31d83071 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 2.0
import com.ford.hmiframework 1.0

Image {
    property string bitmap: ""
    property bool themed: false

    fillMode: Image.PreserveAspectFit
    asynchronous: true

    onBitmapChanged: {
        applyThemedImage();
    }

    function applyThemedImage() {
        if (bitmap !== "") {
            if (themed) {
                source = FThemeProvider.resourcePath + "/" + FThemeProvider.getFileSubPath(bitmap) + bitmap;
            }
            else {
                source = FThemeProvider.resourcePath + "/" + bitmap;
            }
        }
        else {
            source = "";
        }
    }

    Component.onCompleted: {
        if (themed)
        {
            FThemeProvider.themeChanged.connect(applyThemedImage);
        }
    }

    Component.onDestruction: {
        if (themed)
        {
            FThemeProvider.themeChanged.disconnect(applyThemedImage);
        }
    }
}