Looping threw model items with marquee



  • MarqueeText.qml
    @
    import QtQuick 1.0

    Rectangle {
    width: parent.width
    height: marqueeText.height + padding
    clip: true

    // text to be displayed by the Marquee
    property string text
    
    // top/bottom text padding
    property int padding : 10
    
    // the font size used by the Marquee
    property int fontSize : 16
    
    // the scrolling animation interval
    property int interval : 35
    
    // the text color
    property color textColor: "black"
    
    Text {
    //anchors.verticalCenter: parent.verticalCenter
    verticalAlignment: Text.AlignBottom
    id: marqueeText
    font.pointSize: fontSize
    font.bold: true; font.family: "Trebuchet MS"
    color: textColor
    text: parent.text
    x: parent.width
    }
    
    Timer {
    interval: parent.interval
    onTriggered: moveMarquee()
    running: true
    repeat: true
    }
    
    function moveMarquee()
    {
    if(marqueeText.x + marqueeText.width < 0)
    {
        marqueeText.x = marqueeText.parent.width;
    }
    marqueeText.x -= 1;
    }
    

    }

    @

    @
    Com.MarqueeText {
    id: runningString
    x: 76; y: 9
    width:887; height: 31
    text: "My Running String Here"
    color: "black"; textColor: "white"
    }
    @

    now i want to take the text from the model like XmlRole { name: "runningString"; query: "rString/string()" }

    now how can i make this update the text field once its out of scope

    like if x = -1 get the next item and if it has no items loop the ones that are there


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.