-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathmainwindow.h
76 lines (64 loc) · 1.96 KB
/
mainwindow.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
69
70
71
72
73
74
75
76
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QVector>
#include <QGraphicsDropShadowEffect>
#include "slidepage.h"
#include "mycanvas.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
private:
int cornerRadius = 20;
QWidget *border = nullptr;
QWidget *defaultPage;
QGraphicsDropShadowEffect *windowShadow;
QColor mainBackGround = QColor(251, 251, 251);
QLineEdit *canvasTitle = nullptr;
QLineEdit *canvasDesc = nullptr;
customIcon *settingsIcon = nullptr;
customIcon *layersIcon = nullptr;
QWidget *canvasDisplay = nullptr;
QVector<SlidePage*> pageList;
SlidePage *createNewPage = nullptr;
SlidePage *defaultSettingsPage = nullptr;
SlidePage *curSettingsPage = nullptr;
SlidePage *layersPage = nullptr;
singleSelectGroup *layerSel = nullptr;
QVector<MyCanvas*> canvasList;
MyCanvas *curCanvas = nullptr;
void selectCanvas(MyCanvas *canvas);
void deleteCanvas(MyCanvas *canvas);
void Init();
enum {AT_LEFT = 1, AT_TOP = 2, AT_RIGHT = 4, AT_BOTTOM = 8,
AT_TOP_LEFT = 3, AT_TOP_RIGHT = 6, AT_BOTTOM_LEFT = 9, AT_BOTTOM_RIGHT = 12};
bool mousePressed = false;
int mouseState;
QPoint lastPos;
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event){
mousePressed = false;
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
if(event->globalPosition().y() < 2)
controlWindowScale();
#else
if(event->globalPos().y() < 2)
controlWindowScale();
#endif
}
void resizeEvent(QResizeEvent *event);
bool maximized = false;
QRect lastGeometry;
void controlWindowScale();
MyCanvas* loadCanvas(const QString &path);
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H