Home · All Classes · Modules

QDesignerFormWindowInterface Class Reference
[QtDesigner module]

The QDesignerFormWindowInterface class allows you to query and manipulate form windows appearing in Qt Designer's workspace. More...

Inherits QWidget.

Types

Methods

Static Methods

Qt Signals


Detailed Description

The QDesignerFormWindowInterface class allows you to query and manipulate form windows appearing in Qt Designer's workspace.

QDesignerFormWindowInterface provides information about the associated form window as well as allowing its properties to be altered. The interface is not intended to be instantiated directly, but to provide access to Qt Designer's current form windows controlled by Qt Designer's form window manager.

If you are looking for the form window containing a specific widget, you can use the static QDesignerFormWindowInterface.findFormWindow() function:

     QDesignerFormWindowInterface *formWindow;
     formWindow = QDesignerFormWindowInterface.findFormWindow(myWidget);

But in addition, you can access any of the current form windows through Qt Designer's form window manager: Use the QDesignerFormEditorInterface.formWindowManager() function to retrieve an interface to the manager. Once you have this interface, you have access to all of Qt Designer's current form windows through the QDesignerFormWindowManagerInterface.formWindow() function. For example:

     QList<QDesignerFormWindowInterface *> forms;
     QDesignerFormWindowInterface *formWindow;

     QDesignerFormWindowManagerInterface *manager = formEditor->formWindowManager();

     for (int i = 0; i < manager->formWindowCount(); i++) {
         formWindow = manager->formWindow(i);
         forms.append(formWindow);
     }

The pointer to Qt Designer's current QDesignerFormEditorInterface object (formEditor in the example above) is provided by the QDesignerCustomWidgetInterface.initialize() function's parameter. When implementing a custom widget plugin, you must subclass the QDesignerCustomWidgetInterface class to expose your plugin to Qt Designer.

Once you have the form window, you can query its properties. For example, a plain custom widget plugin is managed by Qt Designer only at its top level, i.e. none of its child widgets can be resized in Qt Designer's workspace. But QDesignerFormWindowInterface provides you with functions that enables you to control whether a widget should be managed by Qt Designer, or not:

         if (formWindow->isManaged(myWidget))
             formWindow->manageWidget(myWidget->childWidget);

The complete list of functions concerning widget management is: isManaged(), manageWidget() and unmanageWidget(). There is also several associated signals: widgetManaged(), widgetRemoved(), aboutToUnmanageWidget() and widgetUnmanaged().

In addition to controlling the management of widgets, you can control the current selection in the form window using the selectWidget(), clearSelection() and emitSelectionChanged() functions, and the selectionChanged() signal.

You can also retrieve information about where the form is stored using absoluteDir(), its include files using includeHints(), and its layout and pixmap functions using layoutDefault(), layoutFunction() and pixmapFunction(). You can find out whether the form window has been modified (but not saved) or not, using the isDirty() function. You can retrieve its author(), its contents(), its fileName(), associated comment() and exportMacro(), its mainContainer(), its features(), its grid() and its resourceFiles().

The interface provides you with functions and slots allowing you to alter most of this information as well. The exception is the directory storing the form window. Finally, there is several signals associated with changes to the information mentioned above and to the form window in general.


Type Documentation

QDesignerFormWindowInterface.FeatureFlag

This enum describes the features that are available and can be controlled by the form window interface. These values are used when querying the form window to determine which features it supports:

Constant Value Description
QDesignerFormWindowInterface.EditFeature 0x01 Form editing
QDesignerFormWindowInterface.GridFeature 0x02 Grid display and snap-to-grid facilities for editing
QDesignerFormWindowInterface.TabOrderFeature 0x04 Tab order management
QDesignerFormWindowInterface.DefaultFeature EditFeature | GridFeature Support for default features (form editing and grid)

The Feature type is a typedef for QFlags<FeatureFlag>. It stores an OR combination of FeatureFlag values.

See also hasFeature() and features().


Method Documentation

QDesignerFormWindowInterface.__init__ (self, QWidget parent = None, Qt.WindowFlags flags = 0)

The parent argument, if not None, causes self to be owned by Qt instead of PyQt.

Constructs a form window interface with the given parent and the specified window flags.

QDir QDesignerFormWindowInterface.absoluteDir (self)

This method is abstract and should be reimplemented in any sub-class.

Returns the absolute location of the directory containing the form shown in the form window.

QDesignerFormWindowInterface.addResourceFile (self, QString path)

This method is abstract and should be reimplemented in any sub-class.

Adds the resource file at the given path to those used by the form.

See also resourceFiles() and resourceFilesChanged().

QString QDesignerFormWindowInterface.author (self)

This method is abstract and should be reimplemented in any sub-class.

Returns details of the author or creator of the form currently being displayed in the window.

See also setAuthor().

QDesignerFormWindowInterface.clearSelection (self, bool update = True)

This method is also a Qt slot with the C++ signature void clearSelection(bool = 1).

This method is abstract and should be reimplemented in any sub-class.

Clears the current selection in the form window. If update is true, the emitSelectionChanged() function is called, emitting the selectionChanged() signal.

See also selectWidget().

QString QDesignerFormWindowInterface.comment (self)

This method is abstract and should be reimplemented in any sub-class.

Returns comments about the form currently being displayed in the window.

See also setComment().

QString QDesignerFormWindowInterface.contents (self)

This method is abstract and should be reimplemented in any sub-class.

Returns details of the contents of the form currently being displayed in the window.

See also setContents().

QDesignerFormEditorInterface QDesignerFormWindowInterface.core (self)

Returns a pointer to Qt Designer's current QDesignerFormEditorInterface object.

QDesignerFormWindowCursorInterface QDesignerFormWindowInterface.cursor (self)

This method is abstract and should be reimplemented in any sub-class.

Returns the cursor interface used by the form window.

QDesignerFormWindowInterface.emitSelectionChanged (self)

This method is abstract and should be reimplemented in any sub-class.

Emits the selectionChanged() signal.

See also selectWidget() and clearSelection().

QString QDesignerFormWindowInterface.exportMacro (self)

This method is abstract and should be reimplemented in any sub-class.

Returns the export macro associated with the form currently being displayed in the window. The export macro is used when the form is compiled to create a widget plugin.

See also setExportMacro() and Creating Custom Widgets for Qt Designer.

Feature QDesignerFormWindowInterface.features (self)

This method is abstract and should be reimplemented in any sub-class.

Returns a combination of the features provided by the form window associated with the interface. The value returned can be tested against the Feature enum values to determine which features are supported by the window.

See also setFeatures() and hasFeature().

QString QDesignerFormWindowInterface.fileName (self)

This method is abstract and should be reimplemented in any sub-class.

Returns the file name of the UI file that describes the form currently being shown.

See also setFileName().

QDesignerFormWindowInterface QDesignerFormWindowInterface.findFormWindow (QWidget w)

Returns the form window interface for the given widget.

QDesignerFormWindowInterface QDesignerFormWindowInterface.findFormWindow (QObject obj)

Returns the form window interface for the given object.

This function was introduced in Qt 4.4.

QPoint QDesignerFormWindowInterface.grid (self)

This method is abstract and should be reimplemented in any sub-class.

Returns the grid spacing used by the form window.

See also setGrid().

bool QDesignerFormWindowInterface.hasFeature (self, Feature f)

This method is abstract and should be reimplemented in any sub-class.

Returns true if the form window offers the specified feature; otherwise returns false.

See also features().

QStringList QDesignerFormWindowInterface.includeHints (self)

This method is abstract and should be reimplemented in any sub-class.

Returns a list of the header files that will be included in the form window's associated UI file.

Header files may be local, i.e. relative to the project's directory, "mywidget.h", or global, i.e. part of Qt or the compilers standard libraries: <QtGui/QWidget>.

See also setIncludeHints().

bool QDesignerFormWindowInterface.isDirty (self)

This method is abstract and should be reimplemented in any sub-class.

Returns true if the form window is "dirty" (modified but not saved); otherwise returns false.

See also setDirty().

bool QDesignerFormWindowInterface.isManaged (self, QWidget widget)

This method is abstract and should be reimplemented in any sub-class.

Returns true if the specified widget is managed by the form window; otherwise returns false.

See also manageWidget().

(int margin, int spacing) QDesignerFormWindowInterface.layoutDefault (self)

This method is abstract and should be reimplemented in any sub-class.

Fills in the default margin and spacing for the form's default layout in the margin and spacing variables specified.

See also setLayoutDefault().

(QString margin, QString spacing) QDesignerFormWindowInterface.layoutFunction (self)

This method is abstract and should be reimplemented in any sub-class.

Fills in the current margin and spacing for the form's layout in the margin and spacing variables specified.

See also setLayoutFunction().

QWidget QDesignerFormWindowInterface.mainContainer (self)

This method is abstract and should be reimplemented in any sub-class.

Returns the main container widget for the form window.

See also setMainContainer().

QDesignerFormWindowInterface.manageWidget (self, QWidget widget)

This method is also a Qt slot with the C++ signature void manageWidget( ::QWidget*).

This method is abstract and should be reimplemented in any sub-class.

Instructs the form window to manage the specified widget.

See also isManaged(), unmanageWidget(), and widgetManaged().

QString QDesignerFormWindowInterface.pixmapFunction (self)

This method is abstract and should be reimplemented in any sub-class.

Returns the name of the function used to load pixmaps into the form window.

See also setPixmapFunction().

QDesignerFormWindowInterface.removeResourceFile (self, QString path)

This method is abstract and should be reimplemented in any sub-class.

Removes the resource file at the specified path from the list of those used by the form.

See also resourceFiles() and resourceFilesChanged().

QStringList QDesignerFormWindowInterface.resourceFiles (self)

This method is abstract and should be reimplemented in any sub-class.

Returns a list of paths to resource files that are currently being used by the form window.

See also addResourceFile() and removeResourceFile().

QDesignerFormWindowInterface.selectWidget (self, QWidget widget, bool select = True)

This method is also a Qt slot with the C++ signature void selectWidget( ::QWidget*,bool = 1).

This method is abstract and should be reimplemented in any sub-class.

If select is true, the given widget is selected; otherwise the widget is deselected.

See also clearSelection() and selectionChanged().

QDesignerFormWindowInterface.setAuthor (self, QString author)

This method is abstract and should be reimplemented in any sub-class.

Sets the details for the author or creator of the form to the author specified.

See also author().

QDesignerFormWindowInterface.setComment (self, QString comment)

This method is abstract and should be reimplemented in any sub-class.

Sets the information about the form to the comment specified. This information should be a human-readable comment about the form.

See also comment().

QDesignerFormWindowInterface.setContents (self, QIODevice dev)

This method is abstract and should be reimplemented in any sub-class.

Sets the form's contents using data obtained from the given device.

Data can be read from QFile objects or any other subclass of QIODevice.

See also contents().

QDesignerFormWindowInterface.setContents (self, QString contents)

This method is also a Qt slot with the C++ signature void setContents(const QString&).

This method is abstract and should be reimplemented in any sub-class.

Sets the contents of the form using data read from the specified contents string.

See also contents().

QDesignerFormWindowInterface.setDirty (self, bool dirty)

This method is also a Qt slot with the C++ signature void setDirty(bool).

This method is abstract and should be reimplemented in any sub-class.

If dirty is true, the form window is marked as dirty, meaning that it is modified but not saved. If dirty is false, the form window is considered to be unmodified.

See also isDirty().

QDesignerFormWindowInterface.setExportMacro (self, QString exportMacro)

This method is abstract and should be reimplemented in any sub-class.

Sets the form window's export macro to exportMacro. The export macro is used when building a widget plugin to export the form's interface to other components.

See also exportMacro().

QDesignerFormWindowInterface.setFeatures (self, Feature f)

This method is also a Qt slot with the C++ signature void setFeatures( ::QDesignerFormWindowInterface::Feature).

This method is abstract and should be reimplemented in any sub-class.

Enables the specified features for the form window.

See also features() and featureChanged().

QDesignerFormWindowInterface.setFileName (self, QString fileName)

This method is also a Qt slot with the C++ signature void setFileName(const QString&).

This method is abstract and should be reimplemented in any sub-class.

Sets the file name for the form to the given fileName.

See also fileName() and fileNameChanged().

QDesignerFormWindowInterface.setGrid (self, QPoint grid)

This method is also a Qt slot with the C++ signature void setGrid(const ::QPoint&).

This method is abstract and should be reimplemented in any sub-class.

Sets the grid size for the form window to the point specified by grid. In this function, the coordinates in the QPoint are used to specify the dimensions of a rectangle in the grid.

See also grid().

QDesignerFormWindowInterface.setIncludeHints (self, QStringList includeHints)

This method is abstract and should be reimplemented in any sub-class.

Sets the header files that will be included in the form window's associated UI file to the specified includeHints.

Header files may be local, i.e. relative to the project's directory, "mywidget.h", or global, i.e. part of Qt or the compilers standard libraries: <QtGui/QWidget>.

See also includeHints().

QDesignerFormWindowInterface.setLayoutDefault (self, int margin, int spacing)

This method is abstract and should be reimplemented in any sub-class.

Sets the default margin and spacing for the form's layout.

See also layoutDefault().

QDesignerFormWindowInterface.setLayoutFunction (self, QString margin, QString spacing)

This method is abstract and should be reimplemented in any sub-class.

Sets the margin and spacing for the form's layout.

The default layout properties will be replaced by the corresponding layout functions when uic generates code for the form, that is, if the functions are specified. This is useful when different environments requires different layouts for the same form.

See also layoutFunction().

QDesignerFormWindowInterface.setMainContainer (self, QWidget mainContainer)

This method is abstract and should be reimplemented in any sub-class.

Sets the main container widget on the form to the specified mainContainer.

See also mainContainer() and mainContainerChanged().

QDesignerFormWindowInterface.setPixmapFunction (self, QString pixmapFunction)

This method is abstract and should be reimplemented in any sub-class.

Sets the function used to load pixmaps into the form window to the given pixmapFunction.

See also pixmapFunction().

QDesignerFormWindowInterface.unmanageWidget (self, QWidget widget)

This method is also a Qt slot with the C++ signature void unmanageWidget( ::QWidget*).

This method is abstract and should be reimplemented in any sub-class.

Instructs the form window not to manage the specified widget.

See also aboutToUnmanageWidget() and widgetUnmanaged().


Qt Signal Documentation

void aboutToUnmanageWidget ( ::QWidget*)

This is the default overload of this signal.

This signal is emitted whenever a widget on the form is about to become unmanaged. When this signal is emitted, the specified widget is still managed, and a widgetUnmanaged() signal will follow, indicating when it is no longer managed.

See also unmanageWidget() and isManaged().

void activated ( ::QWidget*)

This is the default overload of this signal.

This signal is emitted whenever a widget is activated on the form. The activated widget is specified by widget.

void changed ()

This is the default overload of this signal.

This signal is emitted whenever a form is changed.

void featureChanged ( ::QDesignerFormWindowInterface::Feature)

This is the default overload of this signal.

This signal is emitted whenever a feature changes in the form. The new feature is specified by feature.

See also setFeatures().

void fileNameChanged (const QString&)

This is the default overload of this signal.

This signal is emitted whenever the file name of the form changes. The new file name is specified by fileName.

See also setFileName().

void geometryChanged ()

This is the default overload of this signal.

This signal is emitted whenever the form's geometry changes.

void mainContainerChanged ( ::QWidget*)

This is the default overload of this signal.

This signal is emitted whenever the main container changes. The new container is specified by mainContainer.

See also setMainContainer().

void objectRemoved ( ::QObject*)

This is the default overload of this signal.

This signal is emitted whenever an object (such as an action or a QButtonGroup) is removed from the form. The object that was removed is specified by object.

This function was introduced in Qt 4.5.

void resourceFilesChanged ()

This is the default overload of this signal.

This signal is emitted whenever the list of resource files used by the form changes.

See also resourceFiles().

void selectionChanged ()

This is the default overload of this signal.

This signal is emitted whenever the selection in the form changes.

See also selectWidget() and clearSelection().

void widgetManaged ( ::QWidget*)

This is the default overload of this signal.

This signal is emitted whenever a widget on the form becomes managed. The newly managed widget is specified by widget.

See also manageWidget().

void widgetRemoved ( ::QWidget*)

This is the default overload of this signal.

This signal is emitted whenever a widget is removed from the form. The widget that was removed is specified by widget.

void widgetUnmanaged ( ::QWidget*)

This is the default overload of this signal.

This signal is emitted whenever a widget on the form becomes unmanaged. The newly released widget is specified by widget.

See also unmanageWidget() and aboutToUnmanageWidget().


PyQt 4.12.1 for X11Copyright © Riverbank Computing Ltd and The Qt Company 2015Qt 4.8.7