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
flags | Feature |
enum | FeatureFlag { EditFeature, GridFeature, TabOrderFeature, DefaultFeature } |
enum | ResourceFileSaveMode { SaveAllResourceFiles, SaveOnlyUsedResourceFiles, DontSaveResourceFiles } |
Public Functions
QDesignerFormWindowInterface(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags()) | |
virtual | ~QDesignerFormWindowInterface() |
QStringList | activeResourceFilePaths() const |
virtual QDesignerFormEditorInterface * | core() const |
- 188 public functions inherited from QWidget
Public Slots
void | activateResourceFilePaths(const QStringList &paths, int *errorCount = Q_NULLPTR, QString *errorMessages = Q_NULLPTR) |
- 18 public slots inherited from QWidget
Macros
Additional Inherited Members
- 59 properties inherited from QWidget
- 3 signals inherited from QWidget
- 2 static public members inherited from QWidget
- 19 protected functions inherited from QWidget
- 1 protected slot inherited from QWidget
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
flags QDesignerFormWindowInterface::Feature
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().
enum QDesignerFormWindowInterface::ResourceFileSaveMode
This enum describes how resource files are saved.
Constant | Value | Description |
---|---|---|
QDesignerFormWindowInterface::SaveAllResourceFiles | 0 | Save all resource files. |
QDesignerFormWindowInterface::SaveOnlyUsedResourceFiles | 1 | Save resource files used by form. |
QDesignerFormWindowInterface::DontSaveResourceFiles | 2 | Do not save resource files. |
This enum was introduced or modified in Qt 5.0.
Member Function Documentation
QDesignerFormWindowInterface::QDesignerFormWindowInterface(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags())
Constructs a form window interface with the given parent and the specified window flags.
[slot]
void QDesignerFormWindowInterface::activateResourceFilePaths(const QStringList &paths, int *errorCount = Q_NULLPTR, QString *errorMessages = Q_NULLPTR)
Activates the resource (.qrc) file paths paths, returning the count of errors in errorCount and error message in errorMessages. Qt Designer loads the resources using the QResource class, making them available for form editing.
In IDE integrations, a list of the project's resource (.qrc) file can be activated, making them available to Qt Designer.
This function was introduced in Qt 5.0.
See also activeResourceFilePaths() and QResource.
[virtual]
QDesignerFormWindowInterface::~QDesignerFormWindowInterface()
Destroys the form window interface.
QStringList QDesignerFormWindowInterface::activeResourceFilePaths() const
Returns the active resource (.qrc) file paths currently loaded in Qt Designer.
This function was introduced in Qt 5.0.
See also activateResourceFilePaths().
[virtual]
QDesignerFormEditorInterface *QDesignerFormWindowInterface::core() const
Returns a pointer to Qt Designer's current QDesignerFormEditorInterface object.