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. Qlabel scrolling text
Qt 6.11 is out! See what's new in the release blog

Qlabel scrolling text

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 3.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.
  • S Offline
    S Offline
    sagar.vekariya
    wrote on last edited by
    #1

    i have a problem in QLabel.
    my string length is larger then QLabel length so when displaying that label only that part appears.
    i have to make QLabel that show string animated just like a marquee in Html in QLabel boundary.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jens
      wrote on last edited by
      #2

      Keep in mind that moving UI elements tend to be rather distracting. Perhaps a tool tip / popup is a better solution to your problem. Anyway here is a simple marquee

      @
      import QtQuick 2.0
      import QtQuick.Controls 1.0

      Rectangle {
      width: 360
      height: 360
      Rectangle {
      id: marquee
      width: 100
      height: label.height
      color: "white"
      clip: true
      border.color: "lightgray"
      anchors.centerIn: parent
      Label {
      id: label
      x: 2
      text: "Hello I am a very long label"
      property int scrollLength: (label.implicitWidth - marquee.width) + 4
      SequentialAnimation on x {
      loops: Animation.Infinite
      NumberAnimation { to: -label.scrollLength ; duration: 2000 ; easing.type: Easing.OutSine}
      PauseAnimation { duration: 1000 }
      NumberAnimation { to: 2 ; duration: 2000 ; easing.type: Easing.OutSine}
      PauseAnimation { duration: 1000 }
      }
      }
      }
      }
      @

      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