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
abstractformwindowmanager.cpp
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
5
6#include <QtCore/qmap.h>
7
9
10/*!
11 \class QDesignerFormWindowManagerInterface
12
13 \brief The QDesignerFormWindowManagerInterface class allows you to
14 manipulate the collection of form windows in \QD, and
15 control \QD's form editing actions.
16
17 \inmodule QtDesigner
18
19 QDesignerFormWindowManagerInterface is not intended to be
20 instantiated directly. \QD uses the form window manager to
21 control the various form windows in its workspace. You can
22 retrieve an interface to \QD's form window manager using
23 the QDesignerFormEditorInterface::formWindowManager()
24 function. For example:
25
26 \snippet lib/tools_designer_src_lib_sdk_abstractformwindowmanager.cpp 0
27
28 When implementing a custom widget plugin, a pointer to \QD's
29 current QDesignerFormEditorInterface object (\c formEditor in the
30 example above) is provided by the
31 QDesignerCustomWidgetInterface::initialize() function's parameter.
32 You must subclass the QDesignerCustomWidgetInterface to expose
33 your plugin to \QD.
34
35 The form window manager interface provides the createFormWindow()
36 function that enables you to create a new form window which you
37 can add to the collection of form windows that the manager
38 maintains, using the addFormWindow() slot. It also provides the
39 formWindowCount() function returning the number of form windows
40 currently under the manager's control, the formWindow() function
41 returning the form window associated with a given index, and the
42 activeFormWindow() function returning the currently selected form
43 window. The removeFormWindow() slot allows you to reduce the
44 number of form windows the manager must maintain, and the
45 setActiveFormWindow() slot allows you to change the form window
46 focus in \QD's workspace.
47
48 In addition, QDesignerFormWindowManagerInterface contains a
49 collection of functions that enables you to intervene and control
50 \QD's form editing actions. All these functions return the
51 original action, making it possible to propagate the function
52 further after intervention.
53
54 Finally, the interface provides three signals which are emitted
55 when a form window is added, when the currently selected form
56 window changes, or when a form window is removed, respectively. All
57 the signals carry the form window in question as their parameter.
58
59 \sa QDesignerFormEditorInterface, QDesignerFormWindowInterface
60*/
61
62/*!
63 \enum QDesignerFormWindowManagerInterface::Action
64
65 Specifies an action of \QD.
66
67 \sa action()
68
69 \since 5.0
70 \value CutAction Clipboard Cut
71 \value CopyAction Clipboard Copy
72 \value PasteAction Clipboard Paste
73 \value DeleteAction Clipboard Delete
74 \value SelectAllAction Select All
75 \value LowerAction Lower current widget
76 \value RaiseAction Raise current widget
77 \value UndoAction Undo
78 \value RedoAction Redo
79 \value HorizontalLayoutAction Lay out using QHBoxLayout
80 \value VerticalLayoutAction Lay out using QVBoxLayout
81 \value SplitHorizontalAction Lay out in horizontal QSplitter
82 \value SplitVerticalAction Lay out in vertical QSplitter
83 \value GridLayoutAction Lay out using QGridLayout
84 \value FormLayoutAction Lay out using QFormLayout
85 \value BreakLayoutAction Break existing layout
86 \value AdjustSizeAction Adjust size
87 \value SimplifyLayoutAction Simplify QGridLayout or QFormLayout
88 \value DefaultPreviewAction Create a preview in default style
89 \value FormWindowSettingsDialogAction Show dialog with form settings
90*/
91
92/*!
93 \enum QDesignerFormWindowManagerInterface::ActionGroup
94
95 Specifies an action group of \QD.
96
97 \sa actionGroup()
98 \since 5.0
99 \value StyledPreviewActionGroup Action group containing styled preview actions
100*/
101
102/*!
103 Constructs an interface with the given \a parent for the form window
104 manager.
105*/
106QDesignerFormWindowManagerInterface::QDesignerFormWindowManagerInterface(QObject *parent)
107 : QObject(parent)
108{
109}
110
111/*!
112 Destroys the interface for the form window manager.
113*/
114QDesignerFormWindowManagerInterface::~QDesignerFormWindowManagerInterface() = default;
115
116/*!
117 Allows you to intervene and control \QD's "cut" action. The function
118 returns the original action.
119
120 \sa QAction
121 \deprecated
122
123 Use action() instead.
124*/
125#if QT_CONFIG(clipboard)
126QAction *QDesignerFormWindowManagerInterface::actionCut() const
127{
128 return action(CutAction);
129}
130#endif
131
132/*!
133 Allows you to intervene and control \QD's "copy" action. The
134 function returns the original action.
135
136 \sa QAction
137 \deprecated
138
139 Use action() instead.
140*/
141#if QT_CONFIG(clipboard)
142QAction *QDesignerFormWindowManagerInterface::actionCopy() const
143{
144 return action(CopyAction);
145}
146#endif
147
148/*!
149 Allows you to intervene and control \QD's "paste" action. The
150 function returns the original action.
151
152 \sa QAction
153 \deprecated
154
155 Use action() instead.
156*/
157#if QT_CONFIG(clipboard)
158QAction *QDesignerFormWindowManagerInterface::actionPaste() const
159{
160 return action(PasteAction);
161}
162#endif
163
164/*!
165 Allows you to intervene and control \QD's "delete" action. The function
166 returns the original action.
167
168 \sa QAction
169 \deprecated
170
171 Use action() instead.
172*/
173QAction *QDesignerFormWindowManagerInterface::actionDelete() const
174{
175 return action(DeleteAction);
176}
177
178/*!
179 Allows you to intervene and control \QD's "select all" action. The
180 function returns the original action.
181
182 \sa QAction
183 \deprecated
184
185 Use action() instead.
186*/
187QAction *QDesignerFormWindowManagerInterface::actionSelectAll() const
188{
189 return action(SelectAllAction);
190}
191
192/*!
193 Allows you to intervene and control the action of lowering a form
194 window in \QD's workspace. The function returns the original
195 action.
196
197 \sa QAction
198 \deprecated
199
200 Use action() instead.
201*/
202
203QAction *QDesignerFormWindowManagerInterface::actionLower() const
204{
205 return action(LowerAction);
206}
207
208/*!
209 Allows you to intervene and control the action of raising of a
210 form window in \QD's workspace. The function returns the original
211 action.
212
213 \sa QAction
214 \deprecated
215
216 Use action() instead.
217*/
218QAction *QDesignerFormWindowManagerInterface::actionRaise() const
219{
220 return action(RaiseAction);
221}
222
223/*!
224 Allows you to intervene and control a request for horizontal
225 layout for a form window in \QD's workspace. The function returns
226 the original action.
227
228 \sa QAction
229 \deprecated
230
231 Use action() instead.
232*/
233QAction *QDesignerFormWindowManagerInterface::actionHorizontalLayout() const
234{
235 return action(HorizontalLayoutAction);
236}
237
238/*!
239 Allows you to intervene and control a request for vertical layout
240 for a form window in \QD's workspace. The function returns the
241 original action.
242
243 \sa QAction
244 \deprecated
245
246 Use action() instead.
247*/
248QAction *QDesignerFormWindowManagerInterface::actionVerticalLayout() const
249{
250 return action(VerticalLayoutAction);
251}
252
253/*!
254 Allows you to intervene and control \QD's "split horizontal"
255 action. The function returns the original action.
256
257 \sa QAction
258 \deprecated
259
260 Use action() instead.
261*/
262QAction *QDesignerFormWindowManagerInterface::actionSplitHorizontal() const
263{
264 return action(SplitHorizontalAction);
265}
266
267/*!
268 Allows you to intervene and control \QD's "split vertical"
269 action. The function returns the original action.
270
271 \sa QAction
272 \deprecated
273
274 Use action() instead.
275*/
276QAction *QDesignerFormWindowManagerInterface::actionSplitVertical() const
277{
278 return action(SplitVerticalAction);
279}
280
281/*!
282 Allows you to intervene and control a request for grid layout for
283 a form window in \QD's workspace. The function returns the
284 original action.
285
286 \sa QAction
287 \deprecated
288
289 Use action() instead.
290*/
291QAction *QDesignerFormWindowManagerInterface::actionGridLayout() const
292{
293 return action(GridLayoutAction);
294}
295
296/*!
297 Allows you to intervene and control \QD's "form layout" action. The
298 function returns the original action.
299
300 \sa QAction
301 \since 4.4
302 \deprecated
303
304 Use action() instead.
305*/
306
307QAction *QDesignerFormWindowManagerInterface::actionFormLayout() const
308{
309 return action(FormLayoutAction);
310}
311
312/*!
313 Allows you to intervene and control \QD's "break layout" action. The
314 function returns the original action.
315
316 \sa QAction
317 \deprecated
318
319 Use action() instead.
320*/
321QAction *QDesignerFormWindowManagerInterface::actionBreakLayout() const
322{
323 return action(BreakLayoutAction);
324}
325
326/*!
327 Allows you to intervene and control \QD's "adjust size" action. The
328 function returns the original action.
329
330 \sa QAction
331 \deprecated
332
333 Use action() instead.
334*/
335QAction *QDesignerFormWindowManagerInterface::actionAdjustSize() const
336{
337 return action(AdjustSizeAction);
338}
339
340/*!
341 Allows you to intervene and control \QD's "simplify layout" action. The
342 function returns the original action.
343
344 \sa QAction
345 \since 4.4
346 \deprecated
347
348 Use action() instead.
349*/
350
351QAction *QDesignerFormWindowManagerInterface::actionSimplifyLayout() const
352{
353 return action(SimplifyLayoutAction);
354}
355
356/*!
357 \fn virtual QDesignerFormWindowInterface *QDesignerFormWindowManagerInterface::activeFormWindow() const
358 Returns the currently active form window in \QD's workspace.
359
360 \sa setActiveFormWindow(), removeFormWindow()
361*/
362
363/*!
364 \fn virtual QDesignerFormEditorInterface *QDesignerFormWindowManagerInterface::core() const
365 Returns a pointer to \QD's current QDesignerFormEditorInterface
366 object.
367*/
368
369/*!
370 \fn virtual void QDesignerFormWindowManagerInterface::addFormWindow(QDesignerFormWindowInterface *formWindow)
371 Adds the given \a formWindow to the collection of windows that
372 \QD's form window manager maintains.
373
374 \sa formWindowAdded()
375*/
376
377/*!
378 \fn virtual void QDesignerFormWindowManagerInterface::removeFormWindow(QDesignerFormWindowInterface *formWindow)
379 Removes the given \a formWindow from the collection of windows that
380 \QD's form window manager maintains.
381
382 \sa formWindow(), formWindowRemoved()
383*/
384
385/*!
386 \fn virtual void QDesignerFormWindowManagerInterface::setActiveFormWindow(QDesignerFormWindowInterface *formWindow)
387 Sets the given \a formWindow to be the currently active form window in
388 \QD's workspace.
389
390 \sa activeFormWindow(), activeFormWindowChanged()
391*/
392
393/*!
394 \fn int QDesignerFormWindowManagerInterface::formWindowCount() const
395 Returns the number of form windows maintained by \QD's form window
396 manager.
397*/
398
399/*!
400 \fn QDesignerFormWindowInterface *QDesignerFormWindowManagerInterface::formWindow(int index) const
401 Returns the form window at the given \a index.
402
403 \sa setActiveFormWindow(), removeFormWindow()
404*/
405
406/*!
407 \fn QDesignerFormWindowInterface *QDesignerFormWindowManagerInterface::createFormWindow(QWidget *parent, Qt::WindowFlags flags)
408
409 Creates a form window with the given \a parent and the given window
410 \a flags.
411
412 \sa addFormWindow()
413*/
414
415/*!
416 \fn QPixmap QDesignerFormWindowManagerInterface::createPreviewPixmap() const
417
418 Creates a pixmap representing the preview of the currently active form.
419*/
420
421/*!
422 Allows you to intervene and control \QD's "undo" action. The
423 function returns the original action.
424
425 \sa QAction
426 \deprecated
427
428 Use action() instead.
429*/
430QAction *QDesignerFormWindowManagerInterface::actionUndo() const
431{
432 return action(UndoAction);
433}
434
435/*!
436 Allows you to intervene and control \QD's "redo" action. The
437 function returns the original action.
438
439 \sa QAction
440 \deprecated
441
442 Use action() instead.
443*/
444QAction *QDesignerFormWindowManagerInterface::actionRedo() const
445{
446 return action(RedoAction);
447}
448
449/*!
450 \fn void QDesignerFormWindowManagerInterface::formWindowAdded(QDesignerFormWindowInterface *formWindow)
451
452 This signal is emitted when a new form window is added to the
453 collection of windows that \QD's form window manager maintains. A
454 pointer to the new \a formWindow is passed as an argument.
455
456 \sa addFormWindow(), setActiveFormWindow()
457*/
458
459/*!
460 \fn void QDesignerFormWindowManagerInterface::formWindowSettingsChanged(QDesignerFormWindowInterface *formWindow)
461
462 This signal is emitted when the settings of the form window change. It can be used to update
463 window titles, etc. accordingly. A pointer to the \a formWindow is passed as an argument.
464
465 \sa FormWindowSettingsDialogAction
466*/
467
468/*!
469 \fn void QDesignerFormWindowManagerInterface::formWindowRemoved(QDesignerFormWindowInterface *formWindow)
470
471 This signal is emitted when a form window is removed from the
472 collection of windows that \QD's form window manager maintains. A
473 pointer to the removed \a formWindow is passed as an argument.
474
475 \sa removeFormWindow()
476*/
477
478/*!
479 \fn void QDesignerFormWindowManagerInterface::activeFormWindowChanged(QDesignerFormWindowInterface *formWindow)
480
481 This signal is emitted when the contents of the currently active
482 form window in \QD's workspace changed. A pointer to the currently
483 active \a formWindow is passed as an argument.
484
485 \sa activeFormWindow()
486*/
487
488/*!
489 \fn void QDesignerFormWindowManagerInterface::dragItems(const QList<QDesignerDnDItemInterface*> &item_list)
490
491 \internal
492*/
493
494/*!
495 \fn virtual QAction QDesignerFormWindowManagerInterface::action(Action action) const
496
497 Returns the action specified by the enumeration value \a action.
498
499 Obsoletes the action accessors of Qt 4.X.
500
501 \since 5.0
502*/
503
504/*!
505 \fn virtual QActionGroup *QDesignerFormWindowManagerInterface::actionGroup(ActionGroup actionGroup) const
506
507 Returns the action group specified by the enumeration value \a actionGroup.
508
509 \since 5.0
510*/
511
512/*!
513 \fn virtual void QDesignerFormWindowManagerInterface::showPreview()
514
515 Show a preview of the current form using the default parameters.
516
517 \since 5.0
518 \sa closeAllPreviews()
519*/
520
521/*!
522 \fn virtual void QDesignerFormWindowManagerInterface::closeAllPreviews()
523
524 Close all currently open previews.
525
526 \since 5.0
527 \sa showPreview()
528*/
529
530/*!
531 \fn virtual void QDesignerFormWindowManagerInterface::showPluginDialog()
532
533 Opens a dialog showing the plugins loaded by \QD's and its plugin load failures.
534
535 \since 5.0
536*/
537
538QT_END_NAMESPACE
Combined button and popup list for selecting options.