5import QGroundControl.Controls
8 property color color: qgcPal.text
9 property alias contentHeight: _measureText.contentHeight
11 property string text: ""
12 property real maxWidth: _measureText.implicitWidth
16 implicitWidth: Math.min(_measureText.implicitWidth, maxWidth)
17 implicitHeight: _measureText.implicitHeight
18 font.pointSize: ScreenTools.defaultFontPointSize
19 font.family: ScreenTools.normalFontFamily
21 property bool _scrollMarquee: _measureText.implicitWidth > maxWidth
22 property real _scrollWidth: _measureText.implicitWidth + _measureBlanks.implicitWidth
23 property int _scrollDuration: _root.text.length * 500
24 property real _innerText1StartX: 0
25 property real _innerText2StartX: _scrollWidth
26 property bool _componentCompleted: false
28 Component.onCompleted: {
29 _componentCompleted = true
31 _innerText1Animation.start()
32 _innerText2Animation.start()
36 on_ScrollWidthChanged: _recalcTimer.restart() // Wait for update storm to settle out before recalcing
43 if (!_componentCompleted) {
46 _innerText1Animation.stop()
47 _innerText2Animation.stop()
48 _innerText1.startX = _innerText1StartX
49 _innerText2.startX = _innerText2StartX
50 _innerText1.x = _innerText1.startX
51 _innerText2.x = _innerText2.startX
52 if (_measureText.implicitWidth > maxWidth) {
53 _innerText1Animation.start()
54 _innerText2Animation.start()
59 QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
63 anchors.verticalCenter: parent.verticalCenter
69 property real startX: _innerText1StartX
71 NumberAnimation on x {
72 id: _innerText1Animation
73 from: _innerText1.startX
74 to: _innerText1.startX -_scrollWidth
75 duration: _scrollDuration
78 _innerText2Animation.stop()
79 var text1StartX = _innerText1.startX
80 var text2StartX = _innerText2.startX
81 _innerText1.startX = text2StartX
82 _innerText2.startX = text1StartX
84 _innerText2Animation.start()
91 anchors.verticalCenter: parent.verticalCenter
96 visible: _scrollMarquee
98 property real startX: _innerText2StartX
100 NumberAnimation on x {
101 id: _innerText2Animation
102 from: _innerText2.startX
103 to: _innerText2.startX -_scrollWidth
104 duration: _scrollDuration