~josephjamesmills/+junk/americanFootball_api_stuff

« back to all changes in this revision

Viewing changes to MarQ.qml

  • Committer: Joseph Mills
  • Date: 2013-12-15 15:25:28 UTC
  • Revision ID: josephjamesmills@gmail.com-20131215152528-vke40bcaabivhpm9
for dude to pull stuff out

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.0
 
2
Rectangle{
 
3
    width: parent.width
 
4
    height: marqueeText.height + padding
 
5
    clip: true
 
6
    color: "transparent"
 
7
    // text to be displayed by the Marquee
 
8
    property string text
 
9
    // top/bottom text padding
 
10
    property int padding : 10
 
11
    // the font size used by the Marquee
 
12
    property int fontSize : 44
 
13
    // the scrolling animation interval
 
14
    property int interval : 100
 
15
    // the text color
 
16
    property color textColor: "white"
 
17
    Text {
 
18
        anchors.verticalCenter: parent.verticalCenter
 
19
        id: marqueeText
 
20
        font.pointSize: fontSize
 
21
        color: textColor
 
22
        text: parent.text
 
23
        x:parent.width
 
24
    }
 
25
    Timer {
 
26
        interval: parent.interval
 
27
        onTriggered: moveMarquee()
 
28
        running: true
 
29
        repeat: true
 
30
    }
 
31
    function moveMarquee()
 
32
    {
 
33
        if(marqueeText.x + marqueeText.width < 0)
 
34
        {
 
35
            marqueeText.x = marqueeText.parent.width;
 
36
        }
 
37
        marqueeText.x -= 10;
 
38
    }
 
39
}