Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Looping threw model items with marquee
Qt 6.11 is out! See what's new in the release blog

Looping threw model items with marquee

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alcatraz
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved