QDesignerFormWindowInterface Class

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

Header: #include <QDesignerFormWindowInterface>
qmake: QT += designer
Inherits: QWidget

Public Types

enum FeatureFlag { EditFeature, GridFeature, TabOrderFeature, DefaultFeature }
enum ResourceFileSaveMode { SaveAllResourceFiles, SaveOnlyUsedResourceFiles, DontSaveResourceFiles }

Detailed Description

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.

See also QDesignerFormWindowCursorInterface, QDesignerFormEditorInterface, and QDesignerFormWindowManagerInterface.

Member Type Documentation

enum 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:

ConstantValueDescription
QDesignerFormWindowInterface::EditFeature0x01Form editing
QDesignerFormWindowInterface::GridFeature0x02Grid display and snap-to-grid facilities for editing
QDesignerFormWindowInterface::TabOrderFeature0x04Tab order management
QDesignerFormWindowInterface::DefaultFeatureEditFeature | GridFeatureSupport for default features (form editing and grid)

See also hasFeature() and features().

enum QDesignerFormWindowInterface::ResourceFileSaveMode

This enum describes how resource files are saved.

ConstantValueDescription
QDesignerFormWindowInterface::SaveAllResourceFiles0Save all resource files.
QDesignerFormWindowInterface::SaveOnlyUsedResourceFiles1Save resource files used by form.
QDesignerFormWindowInterface::DontSaveResourceFiles2Do not save resource files.

This enum was introduced or modified in Qt 5.0.