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