-
Notifications
You must be signed in to change notification settings - Fork 0
/
graphwidget.h
43 lines (32 loc) · 902 Bytes
/
graphwidget.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
#ifndef GRAPHWIDGET_H
#define GRAPHWIDGET_H
#include <QGraphicsView>
#include <QTableWidget>
#include <QString>
class Node;
class GraphWidget : public QGraphicsView
{
Q_OBJECT
public:
GraphWidget(QTableWidget *table, int numNodes, QWidget *parent = 0);
void itemMoved();
void startSim(QString alg, int start, int end, bool full);
public slots:
void shuffle();
void zoomIn();
void zoomOut();
protected:
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
#ifndef QT_NO_WHEELEVENT
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
#endif
void drawBackground(QPainter *painter, const QRectF &rect) Q_DECL_OVERRIDE;
void scaleView(qreal scaleFactor);
private:
int minDistance(int dist[], bool sptSet[]);
QList<Node *> nodes;
QTableWidget* graph;
int timerId;
int numNodes;
};
#endif