-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqbayesedge.h
60 lines (47 loc) · 1.31 KB
/
qbayesedge.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
51
52
53
54
55
56
57
58
59
60
/**
* \author trungvv1
*
* \date 3/26/2015
* \class MyBayesEdge
*
* \brief write something about your class
*
*
*/
#ifndef MYBAYESEDGE_H
#define MYBAYESEDGE_H
#include <QObject>
#include <QGraphicsItem>
#include <QPointF>
class QBayesNode;
class QBayesEdge : public QObject, public QGraphicsItem
{
Q_OBJECT
public:
QBayesEdge(QBayesNode* mParentNode, QBayesNode* mChildNode, QPointF mParentPoint, QPointF mChildPoint);
~QBayesEdge();
void setLine();
QBayesNode* getParentNode() const;
QBayesNode* getChildNode() const;
QString toString() const;
public slots:
void onParentNodePositionChanged(QPointF value);
void onChildNodePositionChanged(QPointF value);
void onNodeDeleted();
signals:
void edgeDeleted();
protected:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
void keyReleaseEvent(QKeyEvent *event);
QPainterPath shape();
QRectF boundingRect() const;
void mousePressEvent(QGraphicsSceneMouseEvent *event);
private:
const qreal ARROW_WIDTH = 10;
QBayesNode *mParentNode, *mChildNode;
bool mIsSelected;
QPointF mParentPoint, mChildPoint;
QPointF mStartPoint, mEndPoint, mArrow1, mArrow2;
};
#endif // MYBAYESEDGE_H