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

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()
virtual QDir absoluteDir() const = 0
QStringList activeResourceFilePaths() const
virtual void addResourceFile(const QString &path) = 0
virtual QString author() const = 0
virtual void beginCommand(const QString &description) = 0
virtual QStringList checkContents() const = 0
virtual QUndoStack *commandHistory() const = 0
virtual QString comment() const = 0
virtual QString contents() const = 0
virtual QDesignerFormEditorInterface *core() const
virtual int currentTool() const = 0
virtual QDesignerFormWindowCursorInterface *cursor() const = 0
virtual void emitSelectionChanged() = 0
virtual void endCommand() = 0
virtual void ensureUniqueObjectName(QObject *object) = 0
virtual QString exportMacro() const = 0
virtual QDesignerFormWindowInterface::Feature features() const = 0
virtual QString fileName() const = 0
virtual QWidget *formContainer() const = 0
virtual QPoint grid() const = 0
virtual bool hasFeature(QDesignerFormWindowInterface::Feature f) const = 0
virtual QStringList includeHints() const = 0
virtual bool isDirty() const = 0
virtual bool isManaged(QWidget *widget) const = 0
virtual void layoutDefault(int *margin, int *spacing) = 0
virtual void layoutFunction(QString *margin, QString *spacing) = 0
virtual QWidget *mainContainer() const = 0
virtual QString pixmapFunction() const = 0
virtual void registerTool(QDesignerFormWindowToolInterface *tool) = 0
virtual void removeResourceFile(const QString &path) = 0
virtual QDesignerFormWindowInterface::ResourceFileSaveMode resourceFileSaveMode() const = 0
virtual QStringList resourceFiles() const = 0
virtual QtResourceSet *resourceSet() const = 0
virtual void setAuthor(const QString &author) = 0
virtual void setComment(const QString &comment) = 0
virtual bool setContents(QIODevice *dev, QString *errorMessage = Q_NULLPTR) = 0
virtual void setCurrentTool(int index) = 0
virtual void setExportMacro(const QString &exportMacro) = 0
virtual void setIncludeHints(const QStringList &includeHints) = 0
virtual void setLayoutDefault(int margin, int spacing) = 0
virtual void setLayoutFunction(const QString &margin, const QString &spacing) = 0
virtual void setMainContainer(QWidget *mainContainer) = 0
virtual void setPixmapFunction(const QString &pixmapFunction) = 0
virtual void setResourceFileSaveMode(QDesignerFormWindowInterface::ResourceFileSaveMode behaviour) = 0
virtual void setResourceSet(QtResourceSet *resourceSet) = 0
virtual void simplifySelection(QList<QWidget *> *widgets) const = 0
virtual QDesignerFormWindowToolInterface *tool(int index) const = 0
virtual int toolCount() const = 0

Public Slots

void activateResourceFilePaths(const QStringList &paths, int *errorCount = Q_NULLPTR, QString *errorMessages = Q_NULLPTR)
virtual void clearSelection(bool changePropertyDisplay = true) = 0
virtual void editWidgets() = 0
virtual void manageWidget(QWidget *widget) = 0
virtual void selectWidget(QWidget *w, bool select = true) = 0
virtual bool setContents(const QString &contents) = 0
virtual void setDirty(bool dirty) = 0
virtual void setFeatures(QDesignerFormWindowInterface::Feature f) = 0
virtual void setFileName(const QString &fileName) = 0
virtual void setGrid(const QPoint &grid) = 0
virtual void unmanageWidget(QWidget *widget) = 0

Signals

void aboutToUnmanageWidget(QWidget *widget)
void activated(QWidget *widget)
void changed()
void featureChanged(QDesignerFormWindowInterface::Feature f)
void fileNameChanged(const QString &fileName)
void geometryChanged()
void mainContainerChanged(QWidget *mainContainer)
void objectRemoved(QObject *o)
void resourceFilesChanged()
void selectionChanged()
void toolChanged(int toolIndex)
void widgetManaged(QWidget *widget)
void widgetRemoved(QWidget *w)
void widgetUnmanaged(QWidget *widget)

Static Public Members

QDesignerFormWindowInterface *findFormWindow(QWidget *w)
QDesignerFormWindowInterface *findFormWindow(QObject *obj)

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.

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:

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)

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.

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.

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.

[virtual] QDesignerFormWindowInterface::~QDesignerFormWindowInterface()

Destroys the form window interface.

[signal] void QDesignerFormWindowInterface::aboutToUnmanageWidget(QWidget *widget)

[pure virtual] QDir QDesignerFormWindowInterface::absoluteDir() const

[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.

[signal] void QDesignerFormWindowInterface::activated(QWidget *widget)

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().

[pure virtual] void QDesignerFormWindowInterface::addResourceFile(const QString &path)

[pure virtual] QString QDesignerFormWindowInterface::author() const

See also setAuthor().

[pure virtual] void QDesignerFormWindowInterface::beginCommand(const QString &description)

[signal] void QDesignerFormWindowInterface::changed()

[pure virtual] QStringList QDesignerFormWindowInterface::checkContents() const

[pure virtual slot] void QDesignerFormWindowInterface::clearSelection(bool changePropertyDisplay = true)

[pure virtual] QUndoStack *QDesignerFormWindowInterface::commandHistory() const

[pure virtual] QString QDesignerFormWindowInterface::comment() const

See also setComment().

[pure virtual] QString QDesignerFormWindowInterface::contents() const

See also setContents().

[virtual] QDesignerFormEditorInterface *QDesignerFormWindowInterface::core() const

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

[pure virtual] int QDesignerFormWindowInterface::currentTool() const

See also setCurrentTool().

[pure virtual] QDesignerFormWindowCursorInterface *QDesignerFormWindowInterface::cursor() const

[pure virtual slot] void QDesignerFormWindowInterface::editWidgets()

[pure virtual] void QDesignerFormWindowInterface::emitSelectionChanged()

[pure virtual] void QDesignerFormWindowInterface::endCommand()

[pure virtual] void QDesignerFormWindowInterface::ensureUniqueObjectName(QObject *object)

[pure virtual] QString QDesignerFormWindowInterface::exportMacro() const

See also setExportMacro().

[signal] void QDesignerFormWindowInterface::featureChanged(QDesignerFormWindowInterface::Feature f)

[pure virtual] QDesignerFormWindowInterface::Feature QDesignerFormWindowInterface::features() const

See also setFeatures().

[pure virtual] QString QDesignerFormWindowInterface::fileName() const

See also setFileName().

[signal] void QDesignerFormWindowInterface::fileNameChanged(const QString &fileName)

[static] QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QWidget *w)

[static] QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObject *obj)

[pure virtual] QWidget *QDesignerFormWindowInterface::formContainer() const

[signal] void QDesignerFormWindowInterface::geometryChanged()

[pure virtual] QPoint QDesignerFormWindowInterface::grid() const

See also setGrid().

[pure virtual] bool QDesignerFormWindowInterface::hasFeature(QDesignerFormWindowInterface::Feature f) const

[pure virtual] QStringList QDesignerFormWindowInterface::includeHints() const

See also setIncludeHints().

[pure virtual] bool QDesignerFormWindowInterface::isDirty() const

[pure virtual] bool QDesignerFormWindowInterface::isManaged(QWidget *widget) const

[pure virtual] void QDesignerFormWindowInterface::layoutDefault(int *margin, int *spacing)

See also setLayoutDefault().

[pure virtual] void QDesignerFormWindowInterface::layoutFunction(QString *margin, QString *spacing)

See also setLayoutFunction().

[pure virtual] QWidget *QDesignerFormWindowInterface::mainContainer() const

See also setMainContainer().

[signal] void QDesignerFormWindowInterface::mainContainerChanged(QWidget *mainContainer)

[pure virtual slot] void QDesignerFormWindowInterface::manageWidget(QWidget *widget)

[signal] void QDesignerFormWindowInterface::objectRemoved(QObject *o)

[pure virtual] QString QDesignerFormWindowInterface::pixmapFunction() const

See also setPixmapFunction().

[pure virtual] void QDesignerFormWindowInterface::registerTool(QDesignerFormWindowToolInterface *tool)

[pure virtual] void QDesignerFormWindowInterface::removeResourceFile(const QString &path)

[pure virtual] QDesignerFormWindowInterface::ResourceFileSaveMode QDesignerFormWindowInterface::resourceFileSaveMode() const

See also setResourceFileSaveMode().

[pure virtual] QStringList QDesignerFormWindowInterface::resourceFiles() const

[signal] void QDesignerFormWindowInterface::resourceFilesChanged()

[pure virtual] QtResourceSet *QDesignerFormWindowInterface::resourceSet() const

See also setResourceSet().

[pure virtual slot] void QDesignerFormWindowInterface::selectWidget(QWidget *w, bool select = true)

[signal] void QDesignerFormWindowInterface::selectionChanged()

[pure virtual] void QDesignerFormWindowInterface::setAuthor(const QString &author)

See also author().

[pure virtual] void QDesignerFormWindowInterface::setComment(const QString &comment)

See also comment().

[pure virtual] bool QDesignerFormWindowInterface::setContents(QIODevice *dev, QString *errorMessage = Q_NULLPTR)

See also contents().

[pure virtual slot] bool QDesignerFormWindowInterface::setContents(const QString &contents)

[pure virtual] void QDesignerFormWindowInterface::setCurrentTool(int index)

See also currentTool().

[pure virtual slot] void QDesignerFormWindowInterface::setDirty(bool dirty)

See also isDirty().

[pure virtual] void QDesignerFormWindowInterface::setExportMacro(const QString &exportMacro)

See also exportMacro().

[pure virtual slot] void QDesignerFormWindowInterface::setFeatures(QDesignerFormWindowInterface::Feature f)

See also features().

[pure virtual slot] void QDesignerFormWindowInterface::setFileName(const QString &fileName)

See also fileName().

[pure virtual slot] void QDesignerFormWindowInterface::setGrid(const QPoint &grid)

See also grid().

[pure virtual] void QDesignerFormWindowInterface::setIncludeHints(const QStringList &includeHints)

See also includeHints().

[pure virtual] void QDesignerFormWindowInterface::setLayoutDefault(int margin, int spacing)

See also layoutDefault().

[pure virtual] void QDesignerFormWindowInterface::setLayoutFunction(const QString &margin, const QString &spacing)

See also layoutFunction().

[pure virtual] void QDesignerFormWindowInterface::setMainContainer(QWidget *mainContainer)

See also mainContainer().

[pure virtual] void QDesignerFormWindowInterface::setPixmapFunction(const QString &pixmapFunction)

See also pixmapFunction().

[pure virtual] void QDesignerFormWindowInterface::setResourceFileSaveMode(QDesignerFormWindowInterface::ResourceFileSaveMode behaviour)

See also resourceFileSaveMode().

[pure virtual] void QDesignerFormWindowInterface::setResourceSet(QtResourceSet *resourceSet)

See also resourceSet().

[pure virtual] void QDesignerFormWindowInterface::simplifySelection(QList<QWidget *> *widgets) const

[pure virtual] QDesignerFormWindowToolInterface *QDesignerFormWindowInterface::tool(int index) const

[signal] void QDesignerFormWindowInterface::toolChanged(int toolIndex)

[pure virtual] int QDesignerFormWindowInterface::toolCount() const

[pure virtual slot] void QDesignerFormWindowInterface::unmanageWidget(QWidget *widget)

[signal] void QDesignerFormWindowInterface::widgetManaged(QWidget *widget)

[signal] void QDesignerFormWindowInterface::widgetRemoved(QWidget *w)

[signal] void QDesignerFormWindowInterface::widgetUnmanaged(QWidget *widget)