summaryrefstree
path: root/usr/bin/qml_link/AppLink/Com/HMILableRoll.qml
blob: a9e4ba7375220cb37e7f32983d64a91845dbdae9 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import QtQuick 2.0
import Label 2.0

Item{
    property string rolltext: contentTextId.text
//    property alias rollTextId:contentTextId
//    property alias rollAnimationId:animText

    property int rollfont:animfont
    property alias anmitextposition:contentTextId.horizontalAlignment
    property bool flag:false
//    property bool rollswitch:animswitch

    id:rectText
    clip:true
    HMILabel
    {
        id:contentTextId
        width: rectText.width+5//contentTextId.contentWidth
        height: rectText.height
        color: "white"
        font.pixelSize: rollfont
        text:rolltext
        horizontalAlignment: Label.AlignLeft
//        elide:Text.ElideRight
        onTextChanged: {
            flag = false
            animText.from = 0
            animText.loops = 0
            animText.running = false
            contentTextId.visible = false
            run_ctrl.running = true

        }

        Timer{
            id:run_ctrl
            interval: 30
            running: false
            onTriggered: {
                if(rectText.width<contentTextId.contentWidth)
                {
                    animText.from = rectText.width
                    animText.loops = 1
                    animText.running = true
                }
                else
                {
                    animText.running = false
                }
                contentTextId.visible = true
                flag = true
            }
        }
        Timer{
            id:repeat_ctrl
            interval: 1
            running: false
            repeat: false
            onTriggered: {
                animText.running = true
                animText.loops = Animation.Infinite
                animText.from = rectText.width
            }
        }

        NumberAnimation
        {
            id:animText
            target: contentTextId
            property: "x"
            duration: 12*contentTextId.contentWidth
//            loops:Animation.Infinite
            from:0
            to:(0-contentTextId.contentWidth - 60)
            //running: (contentTextId.width>rectText.width)?true:false
            onRunningChanged: {
                if(running == false)
                {
//                    contentTextId.x=0
//                    contentTextId.width=rectText.width
                    if(rectText.width<contentTextId.contentWidth)
                    {
                       animText.from =  rectText.width
                    }
                }
                else
                {
                    contentTextId.width=contentTextId.contentWidth
                }
            }
            onStopped: {
                console.debug("### onStopped = "+flag)
                if(true == flag)
                {
                    repeat_ctrl.running = true
                }
            }


        }
    }
}