forked from hBuzzy/Task2_Spider
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwidget.h
More file actions
48 lines (41 loc) · 1.12 KB
/
Copy pathwidget.h
File metadata and controls
48 lines (41 loc) · 1.12 KB
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
// widget.h
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include "spider.h"
class Widget : public QWidget {
Q_OBJECT
public:
Widget(QWidget *parent = nullptr);
~Widget();
protected:
void paintEvent(QPaintEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
private slots:
void moveSpider();
void setSpeedSliderChanged(int value);
void updateSpiderPositionChanged(const QPoint &position);
void updateThreshold(int value);
void updateLineWidth(int value);
void setCursorStyle();
private:
Spider *spider_;
int speed_;
QTimer *timer_;
bool isdrawing_;
QPoint center_;
int lineWidth_;
QColor lineColor_;
bool isLeftKeyPressed_;
bool isRightKeyPressed_;
bool isUpKeyPressed_;
bool isDownKeyPressed_;
bool isLeftUpDiagonalPressed_;
bool isRightUpDiagonalPressed_;
bool isLeftDownDiagonalPressed_;
bool isRightDownDiagonalPressed_;
};
#endif // WIDGET_H