-
Notifications
You must be signed in to change notification settings - Fork 0
/
measurebox.h
42 lines (34 loc) · 1.21 KB
/
measurebox.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
#ifndef MEASUREBOX_H
#define MEASUREBOX_H
#include <QtGui>
#include <QGraphicsRectItem>
#include <QGraphicsView>
#include <QGraphicsSceneMouseEvent>
class MeasureBox : public QGraphicsRectItem {
int instrumentId;
int measureNumber;
public:
MeasureBox();
void mousePressEvent(QGraphicsSceneMouseEvent *event) {
if(event->button() == Qt::LeftButton) {
if(event->modifiers() == Qt::ShiftModifier) {
} else if(event->modifiers() == Qt::AltModifier){
} else {
qDebug() << "Custom item left clicked.";
QGraphicsItem::mousePressEvent(event);
event->accept();
setBrush(QColor(Qt::black));
}
} else if(event->button() == Qt::RightButton) {
qDebug() << "Custom item right clicked.";
event->ignore();
}
}
int type() const {
// Enable the use of qgraphicsitem_cast with this item.
return UserType+1;
}
int getInstrumentId() {return instrumentId;}
int getMeasureNumber() {return measureNumber;}
};
#endif // MEASUREBOX_H