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