-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpaintwidget.h
More file actions
42 lines (33 loc) · 951 Bytes
/
Copy pathpaintwidget.h
File metadata and controls
42 lines (33 loc) · 951 Bytes
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
#ifndef PAINTWIDGET_H
#define PAINTWIDGET_H
#include <QWidget>
class PaintWidget : public QWidget {
Q_OBJECT
public:
PaintWidget(QWidget *parent = nullptr);
~PaintWidget();
private slots:
void ShowMessage();
void UpdateEllipsePosition();
protected:
virtual void mousePressEvent(QMouseEvent *event);
virtual void paintEvent(QPaintEvent *event);
virtual void mouseMoveEvent(QMouseEvent *event);
virtual void mouseReleaseEvent(QMouseEvent *event);
virtual void resizeEvent(QResizeEvent *event);
virtual void keyPressEvent(QKeyEvent *event);
private:
void DrawWeb(QPainter *painter);
void DrawEllipse(QPainter *painter);
void AddToTimerInterval(int milliseconds);
void DrawSpider(QPainter *painter);
void ShowMousePosition();
private:
QTimer *ellipseMoveTimer_;
QRect windowRect_;
QPoint cursorPosition_;
QPoint ellipsePosition_;
bool isDrawingWeb_;
int timeInterval_;
};
#endif // PAINTWIDGET_H