-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathticker.h
More file actions
40 lines (31 loc) · 746 Bytes
/
ticker.h
File metadata and controls
40 lines (31 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef TICKER_H
#define TICKER_H
#include <QWidget>
#include <QFont>
#include <QDesktopWidget>
class Ticker : public QWidget
{
Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText)
public:
Ticker(QWidget *parent = 0);
void setText(const QString &newText);
QString text() const { return myText; }
QSize sizeHint() const;
protected:
void paintEvent(QPaintEvent *event);
void timerEvent(QTimerEvent *event);
void showEvent(QShowEvent *event);
void hideEvent(QHideEvent *event);
private:
QString myText;
int offset;
int myTimerId;
QRect screenRect;
QDesktopWidget *desktopWidget;
int space, startPos;
int textWidth, x;
QFontMetrics *fm;
QFont *font;
};
#endif