-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqbayesnode.h
68 lines (56 loc) · 1.47 KB
/
qbayesnode.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
61
62
63
64
65
66
67
68
/**
* \author trungvv1
*
* \date 3/25/2015
* \class MyBayesNode
*
* \brief write something about your class
*
*
*/
#ifndef MYBAYESNODE_H
#define MYBAYESNODE_H
#include <QObject>
#include <QGraphicsItem>
#include <QFontMetricsF>
class QBayesNode : public QObject, public QGraphicsItem
{
Q_OBJECT
public:
static const qreal RADIUS;
QBayesNode(uint mIndex, QString mLabel);
~QBayesNode();
uint getIndex() const;
void setIndex(uint value);
void setLabel(QString mLabel);
QString getLabel() const;
bool getIsEvidence() const;
void setIsEvidence(bool value);
bool getIsSelected() const;
void setIsSelected(bool value);
uint getEvidenceValue() const;
void setEvidenceValue(uint value);
QString toString() const;
bool operator <(const QBayesNode& other) const;
signals:
void positionChanged(QPointF value);
void nodeDeleted();
protected:
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
void keyReleaseEvent(QKeyEvent *event);
private:
uint mIndex;
QString mLabel;
bool mIsEvidence;
uint mEvidenceValue;
bool mIsSelected;
/// auxiliary member
QFont mFont;
QFontMetricsF *mFontMetrics;
QColor mNormalColor, mEvidenceColor;
QColor mNormalTextColor, mEvidenceTextColor;
QRectF mRect, mLabelRect;
};
#endif // MYBAYESNODE_H