-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtimelinewidget.h
44 lines (33 loc) · 1.03 KB
/
timelinewidget.h
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
41
42
43
44
#ifndef TIMELINEWIDGET_H
#define TIMELINEWIDGET_H
#include <QWidget>
#include <QElapsedTimer>
class TimelineWidget : public QWidget
{
Q_OBJECT
public:
explicit TimelineWidget(QWidget *parent = 0);
inline double cursor() const { return mCursor; } // in seconds
protected:
bool inRange(double time);
int numSubTicks() const;
double intervalLength() const;
double pxPerSecond() const;
void paintEvent(QPaintEvent* ev) /* override */;
void mousePressEvent(QMouseEvent* ev) /* override */;
// void mouseReleaseEvent(QMouseEvent* ev) /* override */;
void wheelEvent(QWheelEvent* ev) /* override */;
signals:
void viewportChanged(double startTime, double length);
void cursorMoved(double time);
void timeClicked(double time);
public slots:
void setCursor(double time);
void setLength(double length);
private:
double mCursor; // in seconds
double mLength; // in seconds
double mViewOffset; // in seconds
double mViewLength; // in seconds
};
#endif // TIMELINEWIDGET_H