-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultiregionwaveform.h
50 lines (38 loc) · 1.15 KB
/
multiregionwaveform.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
45
46
47
48
49
50
#ifndef MULTIREGIONWAVEFORM_H
#define MULTIREGIONWAVEFORM_H
#include "waveform.h"
class MultiRegionWaveform : public Waveform
{
public:
MultiRegionWaveform(QWidget *parent = nullptr);
void AddRegion (QString name, qint64 startMillis, qint64 endMillis, QColor color = QColor());
void ClearRegions ();
void DoneAddingRegions ();
virtual void reset ();
// Events we need to handle
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseReleaseEvent(QMouseEvent *event);
virtual void mouseMoveEvent(QMouseEvent *event);
struct Region {
qint64 startMillis;
qint64 endMillis;
int pixelStart;
int pixelWidth;
QColor penColor;
QColor brushColor;
QPen pen;
QBrush brush;
QGraphicsRectItem *rect;
QGraphicsTextItem *text;
};
private:
std::vector<Region> _regions;
QGraphicsItemGroup *_group;
// We are going to manually manage dragging for now:
const int SNAP_DISTANCE = 10; // pixels
bool _currentlyDraggingSelection;
int _dragStartX;
QTime _dragStartTime;
bool _locked;
};
#endif // MULTIREGIONWAVEFORM_H