-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmarkerpoint.cpp
More file actions
53 lines (44 loc) · 924 Bytes
/
markerpoint.cpp
File metadata and controls
53 lines (44 loc) · 924 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
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "markerpoint.h"
#include "graphicsview.h"
int MarkerPoint::maxX = 0;
int MarkerPoint::maxY = 0;
MarkerPoint::MarkerPoint(GraphicsView *parent) : QPoint()
{
view = parent;
}
MarkerPoint::MarkerPoint(int x, int y, GraphicsView *parent) : QPoint(x,y)
{
view = parent;
}
MarkerPoint::MarkerPoint(double time, int freq, GraphicsView *parent) : QPoint()
{
view = parent;
time_ = time;
freq_ = freq;
refresh();
}
MarkerPoint::MarkerPoint(double time, int freq, const QString &str, GraphicsView *parent)
{
view = parent;
time_ = time;
freq_ = freq;
refresh();
setString(str);
}
void MarkerPoint::refresh()
{
setX( maxX * time_ / view->maxTime() );
setY( maxY - maxY * freq_ / view->maxFreq() );
}
void MarkerPoint::setString(const QString &v)
{
str = v;
}
void MarkerPoint::setMaxX(int v)
{
maxX = v;
}
void MarkerPoint::setMaxY(int v)
{
maxY = v;
}