-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindicator.cpp
37 lines (31 loc) · 947 Bytes
/
indicator.cpp
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
#include "indicator.h"
#include "feedbackwindow.h"
#include <QPoint>
#define INCREMENT 25
#define START_X 23
#define START_Y 20
#define LABEL_Y 0
#define INDICATOR_WIDTH 2
#define INDICATOR_HEIGHT 32
#define LABEL_PADDING 10
Indicator::Indicator(QWidget *parent) :
QWidget(parent)
{
line = new QFrame(parent);
label = new QLabel(parent);
}
void Indicator::PlaceIndicator(int note, double distance)
{
if (note == -1) return;
//to place the vertical line
line->setGeometry(QRect(START_X + INCREMENT * note + distance * INCREMENT, START_Y, INDICATOR_WIDTH, INDICATOR_HEIGHT));
line->setFrameShape(QFrame::VLine);
line->setFrameShadow(QFrame::Plain);
line->setLineWidth(3);
line->show();
label->setText(QString("YOU"));
label->setLineWidth(3);
QPoint* qpoint = new QPoint(START_X + INCREMENT * note + distance * INCREMENT - LABEL_PADDING, LABEL_Y);
label->move(*qpoint);
label->show();
}