-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdynamicpage.h
More file actions
executable file
·64 lines (50 loc) · 1.62 KB
/
dynamicpage.h
File metadata and controls
executable file
·64 lines (50 loc) · 1.62 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#pragma once
#include "dynamicwindow.h"
#include <QAction>
#include <QSplitter>
#include <QWidget>
class DynamicPage : public QWidget {
Q_OBJECT
public:
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
explicit DynamicPage(QWidget *parent = nullptr);
~DynamicPage() override;
void closePage();
QString name() const;
void setName(const QString &name);
QToolBar *toolBar() const;
signals:
void nameChanged(const QString &name);
public slots:
void splitHorizontal();
void splitVertical();
void closeWindow();
void switchWindowSize();
void fillWindow();
void restoreWindow();
void createWindow(const QString &typeName);
bool eventFilter(QObject *watched, QEvent *event) override;
void renamePage();
private:
QWidget *initCreatorWindow(QWidget *parent = nullptr);
private:
QString m_name;
QToolBar *m_toolBar = nullptr;
QAction *m_closeAction = nullptr;
QAction *m_fullScreenAction = nullptr;
QAction *m_resetScreenAction = nullptr;
QAction *m_verticalSplitAction = nullptr;
QAction *m_horizontalSplitAction = nullptr;
QAction *m_separator = nullptr;
QAction *m_subToolBar = nullptr;
QMap<QToolBar *, QAction *> m_subToolBars;
enum Mode { FULL_SCREEN, NORMAL } m_mode = NORMAL;
struct State {
QWidget *topWidget = nullptr;
QSplitter *parent = nullptr;
QWidget *current = nullptr;
int index = -1;
} m_state;
int m_index = 0;
const int m_iconFontSize = 11;
};