CCIMXDesktop
 
Loading...
Searching...
No Matches
ScrollingLabel.h
1#ifndef SCROLLINGLABEL_H
2#define SCROLLINGLABEL_H
3#include <QTimer>
4#include <QWidget>
5class QPropertyAnimation;
6namespace Ui {
8}
9
15class ScrollingLabel : public QWidget {
16 Q_OBJECT
17
18public:
22 static constexpr const int ANIMATION_INTERVAL = 100;
28 static constexpr const short STEP_SHORT = 2;
34 explicit ScrollingLabel(QWidget* parent = nullptr);
35
40 void setText(const QString& text);
42
43protected:
48 void resizeEvent(QResizeEvent*) override {
49 updateScroll();
50 }
51private slots:
52 void scrollText();
53 void updateScroll();
54
55private:
56 Ui::ScrollingLabel* ui;
57 QTimer timer;
58 int offset { 0 };
59};
60
61#endif // SCROLLINGLABEL_H
The ScrollingLabel class provides the scrolling label.
Definition ScrollingLabel.h:15
static constexpr const short STEP_SHORT
STEP_SHORT the step short everytime the animations make the text scroll in pix level so,...
Definition ScrollingLabel.h:28
void setText(const QString &text)
setText set the text of the label
Definition ScrollingLabel.cpp:13
void resizeEvent(QResizeEvent *) override
resize hooks
Definition ScrollingLabel.h:48
static constexpr const int ANIMATION_INTERVAL
ANIMATION_INTERVAL the animation interval.
Definition ScrollingLabel.h:22