summaryrefslogtreecommitdiffstats
path: root/demo3/vertical/restriction/app/main.qml
blob: 15369cf62f9ad7c1e83c0615991847170638813f (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import QtQuick 2.6
import QtQuick.Controls 2.0

ApplicationWindow {
    id: root

    color: "#00000000"
   
    Label {
        id: message
        anchors.top: parent.top
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.bottom: parent.bottom
        anchors.margins: 20
        font.pixelSize: 75
        wrapMode: Text.WordWrap
        horizontalAlignment: Text.AlignHCenter
        verticalAlignment: Text.AlignVCenter
        color: "white"
        text: "Only the video’s sound will be available while driving."
    }

    background : Image {
        id: backgroundImg
        anchors.fill: parent
        anchors.topMargin: 0
        anchors.bottomMargin: 0

        visible: true
        fillMode: Image.Stretch
        source: 'images/black_normal.png'

        state: "begin"
        states: [
            State {
                name: "begin"
                PropertyChanges { target: backgroundImg; opacity: 0.25 }
            },
            State {
                name: "end"
                PropertyChanges { target: backgroundImg; opacity: 0.75 }
            }
        ]

        transitions: [
            Transition {
                from: "begin"; to: "end"
                PropertyAnimation {target: backgroundImg; properties: "opacity"; duration: 2000}
            }
        ]
    }

    function showImage(area) {
        if (area === 'normal') {
            backgroundImg.source = 'images/black_normal.png'
        } else {
            backgroundImg.source = 'images/black_split.png'
        }
        backgroundImg.state = "end"
    }

    
    function hideImage() {
        backgroundImg.state = "begin"
    }
}