-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode.h
executable file
·48 lines (41 loc) · 974 Bytes
/
node.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
#ifndef NODE_H
#define NODE_H
#include <iostream>
#include <QGraphicsEllipseItem>
#include <QPainter>
//struct node // the structure for representing tree nodes
//{
// int key;
// unsigned char height;
// node* left;
// node* right;
// node(int k) { key = k; left = right = NULL; height = 1; }
//};
class node : public QGraphicsEllipseItem
{
private:
int _key, _height;
node* _left, *_right, *_parent;
qreal _radius;
public:
node(int key);
node();
~node();
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
qreal getRadius();
QRectF boundingRect() const;
void setKey(int);
void setHeight(int h);
void setLeft(node*);
void setRight(node*);
void setParent(node*);
bool isLeft();
bool isRight();
node* getLeft();
node* getRight();
node* getParent();
int getHeight();
int getKey();
QPainterPath shape() const;
};
#endif // NODE_H