summaryrefstree
path: root/usr/bin/qml/com/neusoft/auto/widgets/HMILableRoll.qml
blob: ccb054f6e15f8b49f8c643a3580228cf4fcf9fad (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
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 int font_not_change:2
//    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
        wtitesize:font_not_change
        horizontalAlignment: Label.AlignLeft
        verticalAlignment: Label.AlignBottom//liang hang gun dong 2017/3/28 cxx
//        elide:Text.ElideRight
        onTextChanged: {
            contentTextId.visible = false
            flag = false
            //animText.from = 0
            animText.loops = 0
            animText.running = false
            run_ctrl.running = true

        }

        Timer{
            id:run_ctrl
            interval: 30
            running: false
            onTriggered: {
                if(rectText.width<contentTextId.contentWidth)
                {
                    animText.from = 0
                    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"
	    //modify by Jiyulong for #159687 start 2017/4/17
            duration:(flag== false)?((8*(contentTextId.contentWidth+rectText.width)*contentTextId.contentWidth )/(contentTextId.contentWidth+rectText.width)) :8*(contentTextId.contentWidth+rectText.width)	//Fod 20170327 #159687 cxx begin
	    //modify by Jiyulong for #159687 end
//            loops:Animation.Infinite
            from:0
            to:(0-contentTextId.contentWidth)
            //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+2//+2 95ee9f635bd7050246d72f7ebbab48fe (1).gif
                }
                test.running = true

            }
            onStopped: {
                if(true == flag)
                {
                    contentTextId.visible = false
                    repeat_ctrl.running = true
                }
            }


        }


        Timer{
            id:test
            interval: 50
            running: false
            onTriggered: {
                if(false == contentTextId.visible)
                {
                    contentTextId.visible = true
                }
            }
        }
    }
//ADD 20170120 #145015 yx begin
    Connections{
        target:main_play_window
        onRollfromstart:
        {
            if(rectText.width<contentTextId.contentWidth)
            {
                contentTextId.visible = false
                flag = false
                //animText.from = 0
                animText.loops = 0
                animText.running = false
                run_ctrl.running = true
            }
        }
    }
//ADD 20170120 #145015 yx end
}