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
4#ifndef QDESIGNER_ACTIONS_H
5#define QDESIGNER_ACTIONS_H
6
8
9#include <QtCore/qobject.h>
10#include <QtCore/qpointer.h>
11
12#include <memory>
13
15
17
18class QTimer;
19class QAction;
20class QActionGroup;
21class QDesignerFormEditorInterface;
22class QDesignerFormWindowInterface;
23class AppFontDialog;
24
25class QRect;
26class QWidget;
27class QPixmap;
28class QPrinter;
29class QMenu;
30
31namespace qdesigner_internal {
32 class PreviewConfiguration;
33 class PreviewManager;
34 enum class UicLanguage;
35}
36
37class HelpClient;
38struct Options;
39
41{
43public:
46
48 QDesignerFormEditorInterface *core() const;
49
50 bool saveForm(QDesignerFormWindowInterface *fw);
51 bool readInForm(const QString &fileName);
52 bool writeOutForm(QDesignerFormWindowInterface *formWindow, const QString &fileName, bool check = true);
53
54 QActionGroup *fileActions() const;
55 QActionGroup *recentFilesActions() const;
56 QActionGroup *editActions() const;
57 QActionGroup *formActions() const;
58 QActionGroup *settingsActions() const;
59 QActionGroup *windowActions() const;
60 QActionGroup *toolActions() const;
61 QActionGroup *helpActions() const;
62 QActionGroup *uiMode() const;
63 QActionGroup *styleActions() const;
64 // file actions
65 QAction *openFormAction() const;
66 QAction *closeFormAction() const;
67 // window actions
68 QAction *minimizeAction() const;
69 // edit mode actions
70 QAction *editWidgets() const;
71 // form actions
72 QAction *previewFormAction() const;
73 QAction *viewCodeAction() const;
74
75 void setBringAllToFrontVisible(bool visible);
76 void setWindowListSeparatorVisible(bool visible);
77
78 bool openForm(QWidget *parent);
79
80 QString uiExtension() const;
81
82 // Boolean dynamic property set on actions to
83 // show them in the default toolbar layout
84 static const char *defaultToolbarPropertyName;
85
86public slots:
88 void createForm();
89 void slotOpenForm();
90 void helpRequested(const QString &manual, const QString &document);
91
93 void useBigIcons(bool);
94
95private slots:
96 void saveForm();
97 void saveFormAs();
98 void saveAllForms();
99 void saveFormAsTemplate();
100 void notImplementedYet();
101 static void shutdown();
102 void editWidgetsSlot();
103 void openRecentForm();
104 void clearRecentFiles();
105 void closeForm();
106 void showDesignerHelp();
107 void aboutDesigner();
108 void showWidgetSpecificHelp();
109 void backupForms();
110 void showNewFormDialog(const QString &fileName);
111 void showPreferencesDialog();
112 void showAppFontDialog();
113 void savePreviewImage();
114 void printPreviewImage();
115 void updateCloseAction();
116 void formWindowCountChanged();
117 void formWindowSettingsChanged(QDesignerFormWindowInterface *fw);
118
119private:
120 QAction *createRecentFilesMenu();
121 bool saveFormAs(QDesignerFormWindowInterface *fw);
122 void updateRecentFileActions();
123 void addRecentFile(const QString &fileName);
124 void showHelp(const QString &help);
125 void closePreview();
126 QRect fixDialogRect(const QRect &rect) const;
127 void showStatusBarMessage(const QString &message) const;
128 QActionGroup *createHelpActions();
129 bool ensureBackupDirectories();
130 QPixmap createPreviewPixmap(QDesignerFormWindowInterface *fw);
131 qdesigner_internal::PreviewConfiguration previewConfiguration();
132 void viewCode(qdesigner_internal::UicLanguage language);
133
134 enum { MaxRecentFiles = 10 };
135 QDesignerWorkbench *m_workbench;
136 QDesignerFormEditorInterface *m_core;
137 QDesignerSettings m_settings;
138 std::unique_ptr<HelpClient> m_helpClient;
139 QString m_openDirectory;
140 QString m_saveDirectory;
141
142
143 QString m_backupPath;
144 QString m_backupTmpPath;
145
146 QTimer* m_backupTimer;
147
148 QActionGroup *m_fileActions;
149 QActionGroup *m_recentFilesActions;
150 QActionGroup *m_editActions;
151 QActionGroup *m_formActions;
152 QActionGroup *m_settingsActions;
153 QActionGroup *m_windowActions;
154 QActionGroup *m_toolActions;
155 QActionGroup *m_helpActions = nullptr;
156 QActionGroup *m_styleActions = nullptr;
157
158 QAction *m_editWidgetsAction;
159
160 QAction *m_newFormAction;
161 QAction *m_openFormAction;
162 QAction *m_saveFormAction;
163 QAction *m_saveFormAsAction;
164 QAction *m_saveAllFormsAction;
165 QAction *m_saveFormAsTemplateAction;
166 QAction *m_closeFormAction;
167 QAction *m_savePreviewImageAction;
168 QAction *m_printPreviewAction;
169
170 QAction *m_quitAction;
171
172 QAction *m_previewFormAction = nullptr;
173 QAction *m_viewCppCodeAction;
174 QAction *m_viewPythonCodeAction;
175
176 QAction *m_minimizeAction;
177 QAction *m_bringAllToFrontSeparator;
178 QAction *m_bringAllToFrontAction;
179 QAction *m_windowListSeparatorAction;
180
181 QAction *m_preferencesAction;
182 QAction *m_appFontAction;
183
184 QPointer<AppFontDialog> m_appFontDialog;
185
186 QPrinter *m_printer = nullptr;
187
188 qdesigner_internal::PreviewManager *m_previewManager = nullptr;
189
190 std::unique_ptr<QMenu> m_recentMenu;
191};
192
193QT_END_NAMESPACE
194
195#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:46
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:47
QActionGroup * helpActions() const
QActionGroup * fileActions() const
QActionGroup * settingsActions() const
QAction * minimizeAction() const
QActionGroup * styleActions() 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:431
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)
@ DockedMode
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
#define qDesigner
Definition qdesigner.h:19
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)