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