summaryrefslogtreecommitdiffstats
path: root/basicsuite/Qt5 Cinematic Demo/content/RatingsItem.qml
blob: 6d2248901b32e5cfa84872280dc0009bdc618eda (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
import QtQuick 2.0

Item {
    property real rating: 5.0

    width: emptyRatingStarsImage.width + ratingTextItem.paintedWidth + 4
    height: 32

    // TODO: Implement ratings in shader + animations, instead of clipping trick
    Image {
        id: emptyRatingStarsImage
        source: "images/stars2.png"
    }
    Item {
        id: ratingImageItem
        height: 32
        width: (36 * rating) - 2
        clip: true
        Image {
            source: "images/stars.png"
        }
    }
    Text {
        id: ratingTextItem
        anchors.left: emptyRatingStarsImage.right
        anchors.leftMargin: 4
        anchors.verticalCenter: ratingImageItem.verticalCenter
        color: "#ffffff"
        font.pixelSize: settings.fontM
        text: "(" + rating.toFixed(1) + ")"
    }
}