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