Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
MainWindow.h
Go to the documentation of this file.
1#pragma once
2
3#include <QMainWindow>
6
7class QShortcut;
8
9class QAction;
10
11class QMenu;
12
13class QSettings;
14
15class QMdiArea;
16
17class QMdiSubWindow;
18
19namespace sf
20{
21
22class Application;
23
24class MainWindow : public QMainWindow
25{
26 Q_OBJECT
27
28 public:
29 explicit MainWindow(QSettings* settings, Application* application);
30
31 ~MainWindow() override;
32
33 MultiDocInterface* openFile(const QString& filename);
34
35 inline QMdiArea* getMdiArea() const;
36
37 void storeSettings(bool save);
38
39 protected:
40 void dragEnterEvent(QDragEnterEvent* event) override;
41
42 void dropEvent(QDropEvent* event) override;
43
44 void closeEvent(QCloseEvent* event) override;
45
46 private Q_SLOTS:
47
48 void newFile();
49
50 void open();
51
52 void save();
53
54 void saveAs();
55
56 void updateRecentFileActions();
57
58 void openRecentFile();
59
60 void cut();
61
62 void copy();
63
64 void paste();
65
66 void undo();
67
68 void redo();
69
70 void about();
71
72 void configModules();
73
74 void updateMenus();
75
76 void updateWindowMenu();
77
78 void createAppModuleMenus();
79
80 sf::MultiDocInterface* createMdiChild(const QString& filename = QString());
81
82 void switchLayoutDirection();
83
84 void mdiSubActivated(QMdiSubWindow*);
85
86 private:
87 enum
88 {
89 MaxRecentFiles = 10
90 };
91
92 void createActions();
93
94 void createStatusBar();
95
96 void createDockWindows();
97
98 MultiDocInterface* loadFile(const QString& filename);
99
100 void prependToRecentFiles(const QString& filename);
101
102 void setRecentFilesVisible(bool visible);
103
104 [[nodiscard]] MultiDocInterface* activeMdiChild() const;
105
106 [[nodiscard]] QMdiSubWindow* findMdiChild(const QString& filename) const;
107
108 void settingsPropertySheet();
109
110 void storeState(bool save);
111
112 void storeRecentFiles(bool save);
113
114 Application* _application;
115
116 QSettings* _settings;
117
118 QMdiArea* _mdiArea{};
119 QMenu* _menuSettings{};
120 QMenu* _menuView{};
121 QMenu* _menuTools{};
122 QMenu* _menuWindow{};
123
124 QAction* _actionNew{};
125 QAction* _actionOpen{};
126 QAction* _actionSave{};
127 QAction* _actionSaveAs{};
128 QAction* _actionRecentFile[MaxRecentFiles]{};
129 QAction* _actionRecentFileSeparator{};
130 QAction* _actionRecentFileSubMenu{};
131 QAction* _actionCut{};
132 QAction* _actionCopy{};
133 QAction* _actionPaste{};
134 QAction* _actionUndo{};
135 QAction* _actionRedo{};
136 QAction* _actionCloseWindow{};
137 QAction* _actionCloseWindows{};
138 QAction* _actionTileWindows{};
139 QAction* _actionCascadeWindows{};
140 QAction* _actionNextWindow{};
141 QAction* _actionPreviousWindow{};
142 QAction* _actionWindowMenuSeparator{};
143 QAction* _actionModuleConfig{};
144 QAction* _actionSettings{};
145 QAction* _actionDevelop{};
146
147 QStringList _recentFiles;
148
150
151 void createAppModuleToolBars();
152};
153
154inline QMdiArea* MainWindow::getMdiArea() const
155{
156 return _mdiArea;
157}
158
159}// namespace sf
QList< QDockWidget * > DockWidgetList
Type definition for containing dock widgets.
Definition AppModuleInterface.h:154
Definition Application.h:13
Definition MainWindow.h:25
void storeSettings(bool save)
void dropEvent(QDropEvent *event) override
void closeEvent(QCloseEvent *event) override
QMdiArea * getMdiArea() const
Definition MainWindow.h:154
MultiDocInterface * openFile(const QString &filename)
MainWindow(QSettings *settings, Application *application)
~MainWindow() override
void dragEnterEvent(QDragEnterEvent *event) override
Interface for MDI document widgets handling files.
Definition MultiDocInterface.h:41
Definition Application.h:10