NodeItem.h
1019 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
#ifndef NODEITEM_H
#define NODEITEM_H
#include "stdafx.h"
class NodeItem
: public QGraphicsItem
{
private:
double x;
double y;
QColor color;
QString label;
int type;
int category;
double category_accuracy;
int year;
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
public:
NodeItem(double x, double y, QColor color, QString label, int type, int category,
double _accuracy, int year);
//getter setter
QString getLabel() {return label;}
int getType() { return type; }
int getCategory() { return category; }
double getAccuracy() { return category_accuracy; }
int getYear() { return year; }
void setColor(QColor color) {this->color=color;}
QRectF boundingRect() const override;
QPainterPath shape() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
};
#endif // NODEITEM_H