Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdesigner_actions.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3// Qt-Security score:significant reason:default
4
5#ifndef QDESIGNER_ACTIONS_H
6#define QDESIGNER_ACTIONS_H
7
9
10#include <QtCore/qobject.h>
11#include <QtCore/qmap.h>
12#include <QtCore/qpointer.h>
13
14#include <memory>
15
17
19
20class QTimer;
21class QAction;
22class QActionGroup;
23class QDesignerFormEditorInterface;
24class QDesignerFormWindowInterface;
25class AppFontDialog;
26
27class QRect;
28class QWidget;
29class QPixmap;
30class QPrinter;
31class QMenu;
32
33namespace qdesigner_internal {
34 class PreviewConfiguration;
35 class PreviewManager;
36 enum class UicLanguage;
37}
38
39class HelpClient;
40struct Options;
41
43{
45public:
48
50 QDesignerFormEditorInterface *core() const;
51
52 bool saveForm(QDesignerFormWindowInterface *fw);
53 bool readInForm(const QString &fileName);
54 bool writeOutForm(QDesignerFormWindowInterface *formWindow, const QString &fileName, bool check = true);
55
56 QActionGroup *fileActions() const;
57 QActionGroup *recentFilesActions() const;
58 QActionGroup *editActions() const;
59 QActionGroup *formActions() const;
60 QActionGroup *settingsActions() const;
61 QActionGroup *windowActions() const;
62 QActionGroup *toolActions() const;
63 QActionGroup *helpActions() const;
64 QActionGroup *uiMode() const;
65 QActionGroup *styleActions() const;
66 // file actions
67 QAction *openFormAction() const;
68 QAction *closeFormAction() const;
69 // window actions
70 QAction *minimizeAction() const;
71 // edit mode actions
72 QAction *editWidgets() const;
73 // form actions
74 QAction *previewFormAction() const;
75 QAction *viewCodeAction() const;
76
77 void setBringAllToFrontVisible(bool visible);
78 void setWindowListSeparatorVisible(bool visible);
79
80 bool openForm(QWidget *parent);
82
83 QString uiExtension() const;
84
85 // Boolean dynamic property set on actions to
86 // show them in the default toolbar layout
87 static const char *defaultToolbarPropertyName;
88
89public slots:
91 void createForm();
92 void slotOpenForm();
93 void helpRequested(const QString &manual, const QString &document);
94
96 void useBigIcons(bool);
97
98private slots:
99 void saveForm();
100 void saveFormAs();
101 void saveAllForms();
102 void saveFormAsTemplate();
103 void notImplementedYet();
104 static void shutdown();
105 void editWidgetsSlot();
106 void openRecentForm();
107 void clearRecentFiles();
108 void closeForm();
109 void showDesignerHelp();
110 void aboutDesigner();
111 void showWidgetSpecificHelp();
112 void backupForms();
113 void showNewFormDialog(const QString &fileName);
114 void showPreferencesDialog();
115 void showAppFontDialog();
116 void savePreviewImage();
117 void printPreviewImage();
118 void updateCloseAction();
119 void formWindowCountChanged();
120 void formWindowSettingsChanged(QDesignerFormWindowInterface *fw);
121
122private:
123 QAction *createRecentFilesMenu();
124 bool saveFormAs(QDesignerFormWindowInterface *fw);
125 void updateRecentFileActions();
126 void addRecentFile(const QString &fileName);
127 void showHelp(const QString &help);
128 void closePreview();
129 QRect fixDialogRect(const QRect &rect) const;
130 void showStatusBarMessage(const QString &message) const;
131 QActionGroup *createHelpActions();
132 bool ensureBackupDirectories();
133 QPixmap createPreviewPixmap(QDesignerFormWindowInterface *fw);
134 qdesigner_internal::PreviewConfiguration previewConfiguration();
135 void viewCode(qdesigner_internal::UicLanguage language);
136
137 enum { MaxRecentFiles = 10 };
138 QDesignerWorkbench *m_workbench;
139 QDesignerFormEditorInterface *m_core;
140 QDesignerSettings m_settings;
141 std::unique_ptr<HelpClient> m_helpClient;
142 QString m_openDirectory;
143 QString m_saveDirectory;
144
145
146 QString m_backupPath;
147
148 QTimer* m_backupTimer;
149
150 QActionGroup *m_fileActions;
151 QActionGroup *m_recentFilesActions;
152 QActionGroup *m_editActions;
153 QActionGroup *m_formActions;
154 QActionGroup *m_settingsActions;
155 QActionGroup *m_windowActions;
156 QActionGroup *m_toolActions;
157 QActionGroup *m_helpActions = nullptr;
158 QActionGroup *m_styleActions = nullptr;
159
160 QAction *m_editWidgetsAction;
161
162 QAction *m_newFormAction;
163 QAction *m_openFormAction;
164 QAction *m_saveFormAction;
165 QAction *m_saveFormAsAction;
166 QAction *m_saveAllFormsAction;
167 QAction *m_saveFormAsTemplateAction;
168 QAction *m_closeFormAction;
169 QAction *m_savePreviewImageAction;
170 QAction *m_printPreviewAction;
171
172 QAction *m_quitAction;
173
174 QAction *m_previewFormAction = nullptr;
175 QAction *m_viewCppCodeAction;
176 QAction *m_viewPythonCodeAction;
177
178 QAction *m_minimizeAction;
179 QAction *m_bringAllToFrontSeparator;
180 QAction *m_bringAllToFrontAction;
181 QAction *m_windowListSeparatorAction;
182
183 QAction *m_preferencesAction;
184 QAction *m_appFontAction;
185
186 QPointer<AppFontDialog> m_appFontDialog;
187
188 QPrinter *m_printer = nullptr;
189
190 qdesigner_internal::PreviewManager *m_previewManager = nullptr;
191
192 std::unique_ptr<QMenu> m_recentMenu;
193};
194
195QT_END_NAMESPACE
196
197#endif // QDESIGNER_ACTIONS_H
void restoreSettings(const QDesignerSettings &s, const DockWidgetList &dws, const QRect &desktopArea)
DockedMainWindow(QDesignerWorkbench *wb, QMenu *toolBarMenu, const DesignerToolWindowList &toolWindows)
DockWidgetList addToolWindows(const DesignerToolWindowList &toolWindows)
void saveSettings(QDesignerSettings &) const
QMdiSubWindow * createMdiSubWindow(QWidget *fw, Qt::WindowFlags f, const QKeySequence &designerCloseActionShortCut)
QMdiArea * mdiArea() const
void formWindowActivated(QDesignerFormWindow *)
bool event(QEvent *event) override
static QString mainWindowTitle()
CloseEventPolicy closeEventPolicy() const
Definition mainwindow.h:47
void closeEvent(QCloseEvent *e) override
This event handler is called with the given event when Qt receives a window close request for a top-l...
static int settingsVersion()
static QList< QToolBar * > createToolBars(const QDesignerActions *actions, bool singleToolBar)
void setCloseEventPolicy(CloseEventPolicy pol)
Definition mainwindow.h:48
QActionGroup * helpActions() const
QActionGroup * fileActions() const
QActionGroup * settingsActions() const
QAction * minimizeAction() const
QActionGroup * styleActions() const
QMap< QString, QString > pendingBackups() const
QActionGroup * editActions() const
QActionGroup * uiMode() const
QString uiExtension() const
QActionGroup * formActions() const
bool openForm(QWidget *parent)
QDesignerFormEditorInterface * core() const
QActionGroup * toolActions() const
QAction * previewFormAction() const
QActionGroup * windowActions() const
QAction * closeFormAction() const
void setWindowListSeparatorVisible(bool visible)
bool saveForm(QDesignerFormWindowInterface *fw)
QAction * editWidgets() const
QAction * openFormAction() const
QAction * viewCodeAction() const
QDesignerWorkbench * workbench() const
static const char * defaultToolbarPropertyName
void setBringAllToFrontVisible(bool visible)
QActionGroup * recentFilesActions() const
void setToolBarsState(UIMode mode, const QByteArray &mainWindowState)
void setMainWindowState(UIMode mode, const QByteArray &mainWindowState)
QByteArray toolBarsState(UIMode mode) const
void saveGeometryFor(const QWidget *w)
QDesignerActions * actionManager() const
friend class QWidget
Definition qpainter.h:432
The QtToolBarDialog class provides a dialog for customizing toolbars.
void setToolBarManager(QtToolBarManager *toolBarManager)
Connects the toolbar dialog to the given toolBarManager.
The QtToolBarManager class provides toolbar management for main windows.
QByteArray saveState(int version=0) const
Saves the state of the toolbar manager's toolbars.
void addAction(QAction *action, const QString &category)
Adds the given action to the given category in the manager's list of actions.
bool restoreState(const QByteArray &state, int version=0)
Restores the saved state of the toolbar manager's toolbars.
void setMainWindow(QMainWindow *mainWindow)
Sets the main window upon which the toolbar manager operates, to be the given mainWindow.
QByteArray saveState(int version=0) const
bool restoreState(const QByteArray &state, int version=0)
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
#define qDesigner
Definition qdesigner.h:20
static void addActionsToToolBar(const ActionList &actions, QToolBar *t)
static void addActionsToToolBarManager(const ActionList &al, const QString &title, QtToolBarManager *tbm)
static QToolBar * createToolBar(const QString &title, const QString &objectName, const ActionList &actions)
bool toolBarTitleLessThan(const QToolBar *t1, const QToolBar *t2)