1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Designer of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
21 | ** included in the packaging of this file. Please review the following |
22 | ** information to ensure the GNU General Public License requirements will |
23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
24 | ** |
25 | ** $QT_END_LICENSE$ |
26 | ** |
27 | ****************************************************************************/ |
28 | |
29 | #include "abstractformwindow.h" |
30 | #include "qtresourcemodel_p.h" |
31 | |
32 | #include <widgetfactory_p.h> |
33 | |
34 | #include <QtWidgets/qtabbar.h> |
35 | #include <QtWidgets/qsizegrip.h> |
36 | #include <QtWidgets/qabstractbutton.h> |
37 | #include <QtWidgets/qtoolbox.h> |
38 | #include <QtWidgets/qmenubar.h> |
39 | #include <QtWidgets/qmainwindow.h> |
40 | #include <QtWidgets/qdockwidget.h> |
41 | #include <QtWidgets/qtoolbar.h> |
42 | |
43 | #include <QtCore/qdebug.h> |
44 | |
45 | QT_BEGIN_NAMESPACE |
46 | |
47 | /*! |
48 | \class QDesignerFormWindowInterface |
49 | |
50 | \brief The QDesignerFormWindowInterface class allows you to query |
51 | and manipulate form windows appearing in Qt Designer's workspace. |
52 | |
53 | \inmodule QtDesigner |
54 | |
55 | QDesignerFormWindowInterface provides information about |
56 | the associated form window as well as allowing its properties to be |
57 | altered. The interface is not intended to be instantiated |
58 | directly, but to provide access to \QD's current form windows |
59 | controlled by \QD's \l {QDesignerFormWindowManagerInterface}{form |
60 | window manager}. |
61 | |
62 | If you are looking for the form window containing a specific |
63 | widget, you can use the static |
64 | QDesignerFormWindowInterface::findFormWindow() function: |
65 | |
66 | \snippet lib/tools_designer_src_lib_sdk_abstractformwindow.cpp 0 |
67 | |
68 | But in addition, you can access any of the current form windows |
69 | through \QD's form window manager: Use the |
70 | QDesignerFormEditorInterface::formWindowManager() function to |
71 | retrieve an interface to the manager. Once you have this |
72 | interface, you have access to all of \QD's current form windows |
73 | through the QDesignerFormWindowManagerInterface::formWindow() |
74 | function. For example: |
75 | |
76 | \snippet lib/tools_designer_src_lib_sdk_abstractformwindow.cpp 1 |
77 | |
78 | The pointer to \QD's current QDesignerFormEditorInterface object |
79 | (\c formEditor in the example above) is provided by the |
80 | QDesignerCustomWidgetInterface::initialize() function's |
81 | parameter. When implementing a custom widget plugin, you must |
82 | subclass the QDesignerCustomWidgetInterface class to expose your |
83 | plugin to \QD. |
84 | |
85 | Once you have the form window, you can query its properties. For |
86 | example, a plain custom widget plugin is managed by \QD only at |
87 | its top level, i.e. none of its child widgets can be resized in |
88 | \QD's workspace. But QDesignerFormWindowInterface provides you |
89 | with functions that enables you to control whether a widget should |
90 | be managed by \QD, or not: |
91 | |
92 | \snippet lib/tools_designer_src_lib_sdk_abstractformwindow.cpp 2 |
93 | |
94 | The complete list of functions concerning widget management is: |
95 | isManaged(), manageWidget() and unmanageWidget(). There is also |
96 | several associated signals: widgetManaged(), widgetRemoved(), |
97 | aboutToUnmanageWidget() and widgetUnmanaged(). |
98 | |
99 | In addition to controlling the management of widgets, you can |
100 | control the current selection in the form window using the |
101 | selectWidget(), clearSelection() and emitSelectionChanged() |
102 | functions, and the selectionChanged() signal. |
103 | |
104 | You can also retrieve information about where the form is stored |
105 | using absoluteDir(), its include files using includeHints(), and |
106 | its layout and pixmap functions using layoutDefault(), |
107 | layoutFunction() and pixmapFunction(). You can find out whether |
108 | the form window has been modified (but not saved) or not, using |
109 | the isDirty() function. You can retrieve its author(), its |
110 | contents(), its fileName(), associated comment() and |
111 | exportMacro(), its mainContainer(), its features(), its grid() and |
112 | its resourceFiles(). |
113 | |
114 | The interface provides you with functions and slots allowing you |
115 | to alter most of this information as well. The exception is the |
116 | directory storing the form window. Finally, there is several |
117 | signals associated with changes to the information mentioned above |
118 | and to the form window in general. |
119 | |
120 | \sa QDesignerFormWindowCursorInterface, |
121 | QDesignerFormEditorInterface, QDesignerFormWindowManagerInterface |
122 | */ |
123 | |
124 | /*! |
125 | \enum QDesignerFormWindowInterface::FeatureFlag |
126 | |
127 | This enum describes the features that are available and can be |
128 | controlled by the form window interface. These values are used |
129 | when querying the form window to determine which features it |
130 | supports: |
131 | |
132 | \value EditFeature Form editing |
133 | \value GridFeature Grid display and snap-to-grid facilities for editing |
134 | \value TabOrderFeature Tab order management |
135 | \value DefaultFeature Support for default features (form editing and grid) |
136 | |
137 | \sa hasFeature(), features() |
138 | */ |
139 | |
140 | /*! |
141 | \enum QDesignerFormWindowInterface::ResourceFileSaveMode |
142 | \since 5.0 |
143 | |
144 | This enum describes how resource files are saved. |
145 | |
146 | |
147 | \value SaveAllResourceFiles Save all resource files. |
148 | \value SaveOnlyUsedResourceFiles Save resource files used by form. |
149 | \value DontSaveResourceFiles Do not save resource files. |
150 | */ |
151 | |
152 | /*! |
153 | Constructs a form window interface with the given \a parent and |
154 | the specified window \a flags. |
155 | */ |
156 | QDesignerFormWindowInterface::QDesignerFormWindowInterface(QWidget *parent, Qt::WindowFlags flags) |
157 | : QWidget(parent, flags) |
158 | { |
159 | } |
160 | |
161 | /*! |
162 | Destroys the form window interface. |
163 | */ |
164 | QDesignerFormWindowInterface::~QDesignerFormWindowInterface() = default; |
165 | |
166 | /*! |
167 | Returns a pointer to \QD's current QDesignerFormEditorInterface |
168 | object. |
169 | */ |
170 | QDesignerFormEditorInterface *QDesignerFormWindowInterface::core() const |
171 | { |
172 | return nullptr; |
173 | } |
174 | |
175 | /*! |
176 | \fn QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QWidget *widget) |
177 | |
178 | Returns the form window interface for the given \a widget. |
179 | */ |
180 | |
181 | static inline bool stopFindAtTopLevel(const QObject *w, bool ) |
182 | { |
183 | // Do we need to go beyond top levels when looking for the form window? |
184 | // 1) A dialog has a window attribute at the moment it is created |
185 | // before it is properly embedded into a form window. The property |
186 | // sheet queries the layout attributes precisely at this moment. |
187 | // 2) In the case of floating docks and toolbars, we also need to go beyond the top level window. |
188 | // 3) In the case of menu editing, we don't want to block events from the |
189 | // Designer menu, so, we say stop. |
190 | // Note that there must be no false positives for dialogs parented on |
191 | // the form (for example, the "change object name" dialog), else, its |
192 | // events will be blocked. |
193 | |
194 | if (stopAtMenu && w->inherits(classname: "QDesignerMenu" )) |
195 | return true; |
196 | return !qdesigner_internal::WidgetFactory::isFormEditorObject(o: w); |
197 | } |
198 | |
199 | QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QWidget *w) |
200 | { |
201 | while (w != nullptr) { |
202 | if (QDesignerFormWindowInterface *fw = qobject_cast<QDesignerFormWindowInterface*>(object: w)) |
203 | return fw; |
204 | if (w->isWindow() && stopFindAtTopLevel(w, stopAtMenu: true)) |
205 | break; |
206 | |
207 | w = w->parentWidget(); |
208 | } |
209 | |
210 | return nullptr; |
211 | } |
212 | |
213 | /*! |
214 | \fn QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObject *object) |
215 | |
216 | Returns the form window interface for the given \a object. |
217 | |
218 | \since 4.4 |
219 | */ |
220 | |
221 | QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObject *object) |
222 | { |
223 | while (object != nullptr) { |
224 | if (QDesignerFormWindowInterface *fw = qobject_cast<QDesignerFormWindowInterface*>(object)) |
225 | return fw; |
226 | |
227 | QWidget *w = qobject_cast<QWidget *>(o: object); |
228 | // QDesignerMenu is a window, so stopFindAtTopLevel(w) returns 0. |
229 | // However, we want to find the form window for QActions of a menu. |
230 | // If this check is inside stopFindAtTopLevel(w), it will break designer |
231 | // menu editing (e.g. when clicking on items inside an opened menu) |
232 | if (w && w->isWindow() && stopFindAtTopLevel(w, stopAtMenu: false)) |
233 | break; |
234 | |
235 | object = object->parent(); |
236 | } |
237 | |
238 | return nullptr; |
239 | } |
240 | |
241 | /*! |
242 | \fn virtual QtResourceSet *QDesignerFormWindowInterface::resourceSet() const |
243 | |
244 | Returns the resource set used by the form window interface. |
245 | |
246 | \since 5.0 |
247 | \internal |
248 | */ |
249 | |
250 | /*! |
251 | \fn virtual void QDesignerFormWindowInterface::setResourceSet(QtResourceSet *resourceSet) |
252 | |
253 | Sets the resource set used by the form window interface to \a resourceSet. |
254 | |
255 | \since 5.0 |
256 | \internal |
257 | */ |
258 | |
259 | /*! |
260 | Returns the active resource (.qrc) file paths currently loaded in \QD. |
261 | \since 5.0 |
262 | \sa activateResourceFilePaths() |
263 | */ |
264 | |
265 | QStringList QDesignerFormWindowInterface::activeResourceFilePaths() const |
266 | { |
267 | return resourceSet()->activeResourceFilePaths(); |
268 | } |
269 | |
270 | /*! |
271 | Activates the resource (.qrc) file paths \a paths, returning the count of errors in \a errorCount and |
272 | error message in \a errorMessages. \QD loads the resources using the QResource class, |
273 | making them available for form editing. |
274 | |
275 | In IDE integrations, a list of the project's resource (.qrc) file can be activated, making |
276 | them available to \QD. |
277 | |
278 | \since 5.0 |
279 | \sa activeResourceFilePaths() |
280 | \sa QResource |
281 | */ |
282 | |
283 | void QDesignerFormWindowInterface::activateResourceFilePaths(const QStringList &paths, int *errorCount, QString *errorMessages) |
284 | { |
285 | resourceSet()->activateResourceFilePaths(paths, errorCount, errorMessages); |
286 | } |
287 | |
288 | /*! |
289 | \fn virtual QString QDesignerFormWindowInterface::fileName() const |
290 | |
291 | Returns the file name of the UI file that describes the form |
292 | currently being shown. |
293 | |
294 | \sa setFileName() |
295 | */ |
296 | |
297 | /*! |
298 | \fn virtual QDir QDesignerFormWindowInterface::absoluteDir() const |
299 | |
300 | Returns the absolute location of the directory containing the form |
301 | shown in the form window. |
302 | */ |
303 | |
304 | /*! |
305 | \fn virtual QString QDesignerFormWindowInterface::contents() const |
306 | |
307 | Returns details of the contents of the form currently being |
308 | displayed in the window. |
309 | */ |
310 | |
311 | /*! |
312 | \fn virtual QStringList QDesignerFormWindowInterface::checkContents() const |
313 | |
314 | Performs checks on the current form and returns a list of richtext warnings |
315 | about potential issues (for example, top level spacers on unlaid-out forms). |
316 | |
317 | IDE integrations can call this before handling starting a save operation. |
318 | |
319 | \since 5.0 |
320 | */ |
321 | |
322 | /*! |
323 | \fn virtual bool QDesignerFormWindowInterface::setContents(QIODevice *device, QString *errorMessage = 0) |
324 | |
325 | Sets the form's contents using data obtained from the given \a device and returns whether |
326 | loading succeeded. If it fails, the error message is returned in \a errorMessage. |
327 | |
328 | Data can be read from QFile objects or any other subclass of QIODevice. |
329 | */ |
330 | |
331 | /*! |
332 | \fn virtual Feature QDesignerFormWindowInterface::features() const |
333 | |
334 | Returns a combination of the features provided by the form window |
335 | associated with the interface. The value returned can be tested |
336 | against the \l Feature enum values to determine which features are |
337 | supported by the window. |
338 | |
339 | \sa setFeatures(), hasFeature() |
340 | */ |
341 | |
342 | /*! |
343 | \fn virtual bool QDesignerFormWindowInterface::hasFeature(Feature feature) const |
344 | |
345 | Returns true if the form window offers the specified \a feature; |
346 | otherwise returns false. |
347 | |
348 | \sa features() |
349 | */ |
350 | |
351 | /*! |
352 | \fn virtual QString QDesignerFormWindowInterface::author() const |
353 | |
354 | Returns details of the author or creator of the form currently |
355 | being displayed in the window. |
356 | */ |
357 | |
358 | /*! |
359 | \fn virtual void QDesignerFormWindowInterface::setAuthor(const QString &author) |
360 | |
361 | Sets the details for the author or creator of the form to the \a |
362 | author specified. |
363 | */ |
364 | |
365 | /*! |
366 | \fn virtual QString QDesignerFormWindowInterface::comment() const |
367 | |
368 | Returns comments about the form currently being displayed in the window. |
369 | */ |
370 | |
371 | /*! |
372 | \fn virtual void QDesignerFormWindowInterface::setComment(const QString &comment) |
373 | |
374 | Sets the information about the form to the \a comment |
375 | specified. This information should be a human-readable comment |
376 | about the form. |
377 | */ |
378 | |
379 | /*! |
380 | \fn virtual void QDesignerFormWindowInterface::layoutDefault(int *margin, int *spacing) |
381 | |
382 | Fills in the default margin and spacing for the form's default |
383 | layout in the \a margin and \a spacing variables specified. |
384 | */ |
385 | |
386 | /*! |
387 | \fn virtual void QDesignerFormWindowInterface::setLayoutDefault(int margin, int spacing) |
388 | |
389 | Sets the default \a margin and \a spacing for the form's layout. |
390 | |
391 | \sa layoutDefault() |
392 | */ |
393 | |
394 | /*! |
395 | \fn virtual void QDesignerFormWindowInterface::layoutFunction(QString *margin, QString *spacing) |
396 | |
397 | Fills in the current margin and spacing for the form's layout in |
398 | the \a margin and \a spacing variables specified. |
399 | */ |
400 | |
401 | /*! |
402 | \fn virtual void QDesignerFormWindowInterface::setLayoutFunction(const QString &margin, const QString &spacing) |
403 | |
404 | Sets the \a margin and \a spacing for the form's layout. |
405 | |
406 | The default layout properties will be replaced by the |
407 | corresponding layout functions when \c uic generates code for the |
408 | form, that is, if the functions are specified. This is useful when |
409 | different environments requires different layouts for the same |
410 | form. |
411 | |
412 | \sa layoutFunction() |
413 | */ |
414 | |
415 | /*! |
416 | \fn virtual QString QDesignerFormWindowInterface::pixmapFunction() const |
417 | |
418 | Returns the name of the function used to load pixmaps into the |
419 | form window. |
420 | |
421 | \sa setPixmapFunction() |
422 | */ |
423 | |
424 | /*! |
425 | \fn virtual void QDesignerFormWindowInterface::setPixmapFunction(const QString &pixmapFunction) |
426 | |
427 | Sets the function used to load pixmaps into the form window |
428 | to the given \a pixmapFunction. |
429 | |
430 | \sa pixmapFunction() |
431 | */ |
432 | |
433 | /*! |
434 | \fn virtual QString QDesignerFormWindowInterface::exportMacro() const |
435 | |
436 | Returns the export macro associated with the form currently being |
437 | displayed in the window. The export macro is used when the form |
438 | is compiled to create a widget plugin. |
439 | |
440 | \sa {Creating Custom Widgets for Qt Designer} |
441 | */ |
442 | |
443 | /*! |
444 | \fn virtual void QDesignerFormWindowInterface::setExportMacro(const QString &exportMacro) |
445 | |
446 | Sets the form window's export macro to \a exportMacro. The export |
447 | macro is used when building a widget plugin to export the form's |
448 | interface to other components. |
449 | */ |
450 | |
451 | /*! |
452 | \fn virtual QStringList QDesignerFormWindowInterface::includeHints() const |
453 | |
454 | Returns a list of the header files that will be included in the |
455 | form window's associated UI file. |
456 | |
457 | Header files may be local, i.e. relative to the project's |
458 | directory, \c "mywidget.h", or global, i.e. part of Qt or the |
459 | compilers standard libraries: \c <QtGui/QWidget>. |
460 | |
461 | \sa setIncludeHints() |
462 | */ |
463 | |
464 | /*! |
465 | \fn virtual void QDesignerFormWindowInterface::setIncludeHints(const QStringList &includeHints) |
466 | |
467 | Sets the header files that will be included in the form window's |
468 | associated UI file to the specified \a includeHints. |
469 | |
470 | Header files may be local, i.e. relative to the project's |
471 | directory, \c "mywidget.h", or global, i.e. part of Qt or the |
472 | compilers standard libraries: \c <QtGui/QWidget>. |
473 | |
474 | \sa includeHints() |
475 | */ |
476 | |
477 | /*! |
478 | \fn virtual QDesignerFormWindowCursorInterface *QDesignerFormWindowInterface::cursor() const |
479 | |
480 | Returns the cursor interface used by the form window. |
481 | */ |
482 | |
483 | /*! |
484 | \fn virtual int QDesignerFormWindowInterface::toolCount() const |
485 | |
486 | Returns the number of tools available. |
487 | |
488 | \internal |
489 | */ |
490 | |
491 | /*! |
492 | \fn virtual int QDesignerFormWindowInterface::currentTool() const |
493 | |
494 | Returns the index of the current tool in use. |
495 | |
496 | \sa setCurrentTool() |
497 | |
498 | \internal |
499 | */ |
500 | |
501 | /*! |
502 | \fn virtual void QDesignerFormWindowInterface::setCurrentTool(int index) |
503 | |
504 | Sets the current tool to be the one with the given \a index. |
505 | |
506 | \sa currentTool() |
507 | |
508 | \internal |
509 | */ |
510 | |
511 | /*! |
512 | \fn virtual QDesignerFormWindowToolInterface *QDesignerFormWindowInterface::tool(int index) const |
513 | |
514 | Returns an interface to the tool with the given \a index. |
515 | |
516 | \internal |
517 | */ |
518 | |
519 | /*! |
520 | \fn virtual void QDesignerFormWindowInterface::registerTool(QDesignerFormWindowToolInterface *tool) |
521 | |
522 | Registers the given \a tool with the form window. |
523 | |
524 | \internal |
525 | */ |
526 | |
527 | /*! |
528 | \fn virtual QPoint QDesignerFormWindowInterface::grid() const = 0 |
529 | |
530 | Returns the grid spacing used by the form window. |
531 | |
532 | \sa setGrid() |
533 | */ |
534 | |
535 | /*! |
536 | \fn virtual QWidget *QDesignerFormWindowInterface::mainContainer() const |
537 | |
538 | Returns the main container widget for the form window. |
539 | |
540 | \sa setMainContainer() |
541 | \internal |
542 | */ |
543 | |
544 | /*! |
545 | \fn virtual QWidget *QDesignerFormWindowInterface::formContainer() const |
546 | |
547 | Returns the form the widget containing the main container widget. |
548 | |
549 | \since 5.0 |
550 | */ |
551 | |
552 | /*! |
553 | \fn virtual void QDesignerFormWindowInterface::setMainContainer(QWidget *mainContainer) |
554 | |
555 | Sets the main container widget on the form to the specified \a |
556 | mainContainer. |
557 | |
558 | \sa mainContainerChanged() |
559 | */ |
560 | |
561 | /*! |
562 | \fn virtual bool QDesignerFormWindowInterface::isManaged(QWidget *widget) const |
563 | |
564 | Returns true if the specified \a widget is managed by the form |
565 | window; otherwise returns false. |
566 | |
567 | \sa manageWidget() |
568 | */ |
569 | |
570 | /*! |
571 | \fn virtual bool QDesignerFormWindowInterface::isDirty() const |
572 | |
573 | Returns true if the form window is "dirty" (modified but not |
574 | saved); otherwise returns false. |
575 | |
576 | \sa setDirty() |
577 | */ |
578 | |
579 | /*! |
580 | \fn virtual QUndoStack *QDesignerFormWindowInterface::commandHistory() const |
581 | |
582 | Returns an object that can be used to obtain the commands used so |
583 | far in the construction of the form. |
584 | |
585 | \internal |
586 | */ |
587 | |
588 | /*! |
589 | \fn virtual void QDesignerFormWindowInterface::beginCommand(const QString &description) |
590 | |
591 | Begins execution of a command with the given \a |
592 | description. Commands are executed between beginCommand() and |
593 | endCommand() function calls to ensure that they are recorded on |
594 | the undo stack. |
595 | |
596 | \sa endCommand() |
597 | |
598 | \internal |
599 | */ |
600 | |
601 | /*! |
602 | \fn virtual void QDesignerFormWindowInterface::endCommand() |
603 | |
604 | Ends execution of the current command. |
605 | |
606 | \sa beginCommand() |
607 | |
608 | \internal |
609 | */ |
610 | |
611 | /*! |
612 | \fn virtual void QDesignerFormWindowInterface::simplifySelection(QList<QWidget*> *widgets) const |
613 | |
614 | Simplifies the selection of widgets specified by \a widgets. |
615 | |
616 | \sa selectionChanged() |
617 | \internal |
618 | */ |
619 | |
620 | /*! |
621 | \fn virtual void QDesignerFormWindowInterface::emitSelectionChanged() |
622 | |
623 | Emits the selectionChanged() signal. |
624 | |
625 | \sa selectWidget(), clearSelection() |
626 | */ |
627 | |
628 | /*! |
629 | \fn virtual QStringList QDesignerFormWindowInterface::resourceFiles() const |
630 | |
631 | Returns a list of paths to resource files that are currently being |
632 | used by the form window. |
633 | |
634 | \sa addResourceFile(), removeResourceFile() |
635 | */ |
636 | |
637 | /*! |
638 | \fn virtual void QDesignerFormWindowInterface::addResourceFile(const QString &path) |
639 | |
640 | Adds the resource file at the given \a path to those used by the form. |
641 | |
642 | \sa resourceFiles(), resourceFilesChanged() |
643 | */ |
644 | |
645 | /*! |
646 | \fn virtual void QDesignerFormWindowInterface::removeResourceFile(const QString &path) |
647 | |
648 | Removes the resource file at the specified \a path from the list |
649 | of those used by the form. |
650 | |
651 | \sa resourceFiles(), resourceFilesChanged() |
652 | */ |
653 | |
654 | /*! |
655 | \fn virtual void QDesignerFormWindowInterface::ensureUniqueObjectName(QObject *object) |
656 | |
657 | Ensures that the specified \a object has a unique name amongst the |
658 | other objects on the form. |
659 | |
660 | \internal |
661 | */ |
662 | |
663 | // Slots |
664 | |
665 | /*! |
666 | \fn virtual void QDesignerFormWindowInterface::manageWidget(QWidget *widget) |
667 | |
668 | Instructs the form window to manage the specified \a widget. |
669 | |
670 | \sa isManaged(), unmanageWidget(), widgetManaged() |
671 | */ |
672 | |
673 | /*! |
674 | \fn virtual void QDesignerFormWindowInterface::unmanageWidget(QWidget *widget) |
675 | |
676 | Instructs the form window not to manage the specified \a widget. |
677 | |
678 | \sa aboutToUnmanageWidget(), widgetUnmanaged() |
679 | */ |
680 | |
681 | /*! |
682 | \fn virtual void QDesignerFormWindowInterface::setFeatures(Feature features) |
683 | |
684 | Enables the specified \a features for the form window. |
685 | |
686 | \sa features(), featureChanged() |
687 | */ |
688 | |
689 | /*! |
690 | \fn virtual void QDesignerFormWindowInterface::setDirty(bool dirty) |
691 | |
692 | If \a dirty is true, the form window is marked as dirty, meaning |
693 | that it is modified but not saved. If \a dirty is false, the form |
694 | window is considered to be unmodified. |
695 | |
696 | \sa isDirty() |
697 | */ |
698 | |
699 | /*! |
700 | \fn virtual void QDesignerFormWindowInterface::clearSelection(bool update) |
701 | |
702 | Clears the current selection in the form window. If \a update is |
703 | true, the emitSelectionChanged() function is called, emitting the |
704 | selectionChanged() signal. |
705 | |
706 | \sa selectWidget() |
707 | */ |
708 | |
709 | /*! |
710 | \fn virtual void QDesignerFormWindowInterface::selectWidget(QWidget *widget, bool select) |
711 | |
712 | If \a select is true, the given \a widget is selected; otherwise |
713 | the \a widget is deselected. |
714 | |
715 | \sa clearSelection(), selectionChanged() |
716 | */ |
717 | |
718 | /*! |
719 | \fn virtual void QDesignerFormWindowInterface::setGrid(const QPoint &grid) |
720 | |
721 | Sets the grid size for the form window to the point specified by |
722 | \a grid. In this function, the coordinates in the QPoint are used |
723 | to specify the dimensions of a rectangle in the grid. |
724 | |
725 | \sa grid() |
726 | */ |
727 | |
728 | /*! |
729 | \fn virtual void QDesignerFormWindowInterface::setFileName(const QString &fileName) |
730 | |
731 | Sets the file name for the form to the given \a fileName. |
732 | |
733 | \sa fileName(), fileNameChanged() |
734 | */ |
735 | |
736 | /*! |
737 | \fn virtual bool QDesignerFormWindowInterface::setContents(const QString &contents) |
738 | |
739 | Sets the contents of the form using data read from the specified |
740 | \a contents string and returns whether the operation succeeded. |
741 | |
742 | \sa contents() |
743 | */ |
744 | |
745 | /*! |
746 | \fn virtual void QDesignerFormWindowInterface::editWidgets() |
747 | |
748 | Switches the form window into editing mode. |
749 | |
750 | \sa {Qt Designer's Form Editing Mode} |
751 | |
752 | \internal |
753 | */ |
754 | |
755 | // Signals |
756 | |
757 | /*! |
758 | \fn void QDesignerFormWindowInterface::mainContainerChanged(QWidget *mainContainer) |
759 | |
760 | This signal is emitted whenever the main container changes. |
761 | The new container is specified by \a mainContainer. |
762 | |
763 | \sa setMainContainer() |
764 | */ |
765 | |
766 | /*! |
767 | \fn void QDesignerFormWindowInterface::toolChanged(int toolIndex) |
768 | |
769 | This signal is emitted whenever the current tool changes. |
770 | The specified \a toolIndex is the index of the new tool in the list of |
771 | tools in the widget box. |
772 | |
773 | \internal |
774 | */ |
775 | |
776 | /*! |
777 | \fn void QDesignerFormWindowInterface::fileNameChanged(const QString &fileName) |
778 | |
779 | This signal is emitted whenever the file name of the form changes. |
780 | The new file name is specified by \a fileName. |
781 | |
782 | \sa setFileName() |
783 | */ |
784 | |
785 | /*! |
786 | \fn void QDesignerFormWindowInterface::featureChanged(Feature feature) |
787 | |
788 | This signal is emitted whenever a feature changes in the form. |
789 | The new feature is specified by \a feature. |
790 | |
791 | \sa setFeatures() |
792 | */ |
793 | |
794 | /*! |
795 | \fn void QDesignerFormWindowInterface::selectionChanged() |
796 | |
797 | This signal is emitted whenever the selection in the form changes. |
798 | |
799 | \sa selectWidget(), clearSelection() |
800 | */ |
801 | |
802 | /*! |
803 | \fn void QDesignerFormWindowInterface::geometryChanged() |
804 | |
805 | This signal is emitted whenever the form's geometry changes. |
806 | */ |
807 | |
808 | /*! |
809 | \fn void QDesignerFormWindowInterface::resourceFilesChanged() |
810 | |
811 | This signal is emitted whenever the list of resource files used by the |
812 | form changes. |
813 | |
814 | \sa resourceFiles() |
815 | */ |
816 | |
817 | /*! |
818 | \fn ResourceFileSaveMode QDesignerFormWindowInterface::resourceFileSaveMode() const |
819 | |
820 | Returns the resource file save mode behavior. |
821 | |
822 | \sa setResourceFileSaveMode() |
823 | */ |
824 | |
825 | /*! |
826 | \fn void QDesignerFormWindowInterface::setResourceFileSaveMode(ResourceFileSaveMode behavior) |
827 | |
828 | Sets the resource file save mode \a behavior. |
829 | |
830 | \sa resourceFileSaveMode() |
831 | */ |
832 | |
833 | /*! |
834 | \fn void QDesignerFormWindowInterface::widgetManaged(QWidget *widget) |
835 | |
836 | This signal is emitted whenever a widget on the form becomes managed. |
837 | The newly managed widget is specified by \a widget. |
838 | |
839 | \sa manageWidget() |
840 | */ |
841 | |
842 | /*! |
843 | \fn void QDesignerFormWindowInterface::widgetUnmanaged(QWidget *widget) |
844 | |
845 | This signal is emitted whenever a widget on the form becomes unmanaged. |
846 | The newly released widget is specified by \a widget. |
847 | |
848 | \sa unmanageWidget(), aboutToUnmanageWidget() |
849 | */ |
850 | |
851 | /*! |
852 | \fn void QDesignerFormWindowInterface::aboutToUnmanageWidget(QWidget *widget) |
853 | |
854 | This signal is emitted whenever a widget on the form is about to |
855 | become unmanaged. When this signal is emitted, the specified \a |
856 | widget is still managed, and a widgetUnmanaged() signal will |
857 | follow, indicating when it is no longer managed. |
858 | |
859 | \sa unmanageWidget(), isManaged() |
860 | */ |
861 | |
862 | /*! |
863 | \fn void QDesignerFormWindowInterface::activated(QWidget *widget) |
864 | |
865 | This signal is emitted whenever a widget is activated on the form. |
866 | The activated widget is specified by \a widget. |
867 | */ |
868 | |
869 | /*! |
870 | \fn void QDesignerFormWindowInterface::changed() |
871 | |
872 | This signal is emitted whenever a form is changed. |
873 | */ |
874 | |
875 | /*! |
876 | \fn void QDesignerFormWindowInterface::widgetRemoved(QWidget *widget) |
877 | |
878 | This signal is emitted whenever a widget is removed from the form. |
879 | The widget that was removed is specified by \a widget. |
880 | */ |
881 | |
882 | /*! |
883 | \fn void QDesignerFormWindowInterface::objectRemoved(QObject *object) |
884 | |
885 | This signal is emitted whenever an object (such as |
886 | an action or a QButtonGroup) is removed from the form. |
887 | The object that was removed is specified by \a object. |
888 | |
889 | \since 4.5 |
890 | */ |
891 | |
892 | QT_END_NAMESPACE |
893 | |