Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QDesignerFormWindowInterface Class

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

Header:#include <QDesignerFormWindowInterface>
Inherits:QWidget

Public Types

flagsFeature
enumFeatureFlag { EditFeature, GridFeature, TabOrderFeature, DefaultFeature }

Public Functions

QDesignerFormWindowInterface(QWidget * parent = 0, Qt::WindowFlags flags = 0)
virtual~QDesignerFormWindowInterface()
virtual QDirabsoluteDir() const = 0
virtual voidaddResourceFile(const QString & path) = 0
virtual QStringauthor() const = 0
virtual QStringcomment() const = 0
virtual QStringcontents() const = 0
virtual QDesignerFormEditorInterface *core() const
virtual QDesignerFormWindowCursorInterface *cursor() const = 0
virtual voidemitSelectionChanged() = 0
virtual QStringexportMacro() const = 0
virtual Featurefeatures() const = 0
virtual QStringfileName() const = 0
virtual QPointgrid() const = 0
virtual boolhasFeature(Feature feature) const = 0
virtual QStringListincludeHints() const = 0
virtual boolisDirty() const = 0
virtual boolisManaged(QWidget * widget) const = 0
virtual voidlayoutDefault(int * margin, int * spacing) = 0
virtual voidlayoutFunction(QString * margin, QString * spacing) = 0
virtual QWidget *mainContainer() const = 0
virtual QStringpixmapFunction() const = 0
virtual voidremoveResourceFile(const QString & path) = 0
virtual QStringListresourceFiles() const = 0
virtual voidsetAuthor(const QString & author) = 0
virtual voidsetComment(const QString & comment) = 0
virtual voidsetContents(QIODevice * device) = 0
virtual voidsetExportMacro(const QString & exportMacro) = 0
virtual voidsetIncludeHints(const QStringList & includeHints) = 0
virtual voidsetLayoutDefault(int margin, int spacing) = 0
virtual voidsetLayoutFunction(const QString & margin, const QString & spacing) = 0
virtual voidsetMainContainer(QWidget * mainContainer) = 0
virtual voidsetPixmapFunction(const QString & pixmapFunction) = 0

Public Slots

virtual voidclearSelection(bool update = true) = 0
virtual voidmanageWidget(QWidget * widget) = 0
virtual voidselectWidget(QWidget * widget, bool select = true) = 0
virtual voidsetContents(const QString & contents) = 0
virtual voidsetDirty(bool dirty) = 0
virtual voidsetFeatures(Feature features) = 0
virtual voidsetFileName(const QString & fileName) = 0
virtual voidsetGrid(const QPoint & grid) = 0
virtual voidunmanageWidget(QWidget * widget) = 0
  • 19 public slots inherited fromQWidget
  • 1 public slot inherited fromQObject

Signals

voidaboutToUnmanageWidget(QWidget * widget)
voidactivated(QWidget * widget)
voidchanged()
voidfeatureChanged(Feature feature)
voidfileNameChanged(const QString & fileName)
voidgeometryChanged()
voidmainContainerChanged(QWidget * mainContainer)
voidobjectRemoved(QObject * object)
voidresourceFilesChanged()
voidselectionChanged()
voidwidgetManaged(QWidget * widget)
voidwidgetRemoved(QWidget * widget)
voidwidgetUnmanaged(QWidget * widget)

Static Public Members

QDesignerFormWindowInterface *findFormWindow(QWidget * widget)
QDesignerFormWindowInterface *findFormWindow(QObject * object)
  • 4 static public members inherited fromQWidget
  • 7 static public members inherited fromQObject

Additional Inherited Members

  • 58 properties inherited fromQWidget
  • 1 property inherited fromQObject
  • 37 protected functions inherited fromQWidget
  • 8 protected functions inherited fromQObject
  • 1 protected function inherited fromQPaintDevice
  • 1 protected slot inherited fromQWidget

Detailed Description

TheQDesignerFormWindowInterface 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 toQt Designer's current form windows controlled byQt Designer'sform window manager.

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

But in addition, you can access any of the current form windows throughQt Designer's form window manager: Use theQDesignerFormEditorInterface::formWindowManager() function to retrieve an interface to the manager. Once you have this interface, you have access to all ofQt Designer's current form windows through theQDesignerFormWindowManagerInterface::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 toQt Designer's currentQDesignerFormEditorInterface object (formEditor in the example above) is provided by theQDesignerCustomWidgetInterface::initialize() function's parameter. When implementing a custom widget plugin, you must subclass theQDesignerCustomWidgetInterface class to expose your plugin toQt Designer.

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

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

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

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

You can also retrieve information about where the form is stored usingabsoluteDir(), its include files usingincludeHints(), and its layout and pixmap functions usinglayoutDefault(),layoutFunction() andpixmapFunction(). You can find out whether the form window has been modified (but not saved) or not, using theisDirty() function. You can retrieve itsauthor(), itscontents(), itsfileName(), associatedcomment() andexportMacro(), itsmainContainer(), itsfeatures(), itsgrid() and itsresourceFiles().

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 alsoQDesignerFormWindowCursorInterface,QDesignerFormEditorInterface, andQDesignerFormWindowManagerInterface.

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 forQFlags<FeatureFlag>. It stores an OR combination of FeatureFlag values.

See alsohasFeature() andfeatures().

Member Function Documentation

QDesignerFormWindowInterface::QDesignerFormWindowInterface(QWidget * parent = 0,Qt::WindowFlags flags = 0)

Constructs a form window interface with the givenparent and the specified windowflags.

[virtual]QDesignerFormWindowInterface::~QDesignerFormWindowInterface()

Destroys the form window interface.

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

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

See alsounmanageWidget() andisManaged().

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

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

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

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

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

Adds the resource file at the givenpath to those used by the form.

See alsoresourceFiles() andresourceFilesChanged().

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

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

See alsosetAuthor().

[signal]void QDesignerFormWindowInterface::changed()

This signal is emitted whenever a form is changed.

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

Clears the current selection in the form window. Ifupdate is true, theemitSelectionChanged() function is called, emitting theselectionChanged() signal.

See alsoselectWidget().

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

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

See alsosetComment().

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

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

See alsosetContents().

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

Returns a pointer toQt Designer's currentQDesignerFormEditorInterface object.

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

Returns the cursor interface used by the form window.

[pure virtual]void QDesignerFormWindowInterface::emitSelectionChanged()

Emits theselectionChanged() signal.

See alsoselectWidget() andclearSelection().

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

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 alsosetExportMacro() andCreating Custom Widgets for Qt Designer.

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

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

See alsosetFeatures().

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

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

See alsosetFeatures() andhasFeature().

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

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

See alsosetFileName().

[signal]void QDesignerFormWindowInterface::fileNameChanged(constQString & fileName)

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

See alsosetFileName().

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

Returns the form window interface for the givenwidget.

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

Returns the form window interface for the givenobject.

This function was introduced in Qt 4.4.

[signal]void QDesignerFormWindowInterface::geometryChanged()

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

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

Returns the grid spacing used by the form window.

See alsosetGrid().

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

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

See alsofeatures().

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

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

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

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

See alsosetDirty().

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

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

See alsomanageWidget().

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

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

See alsosetLayoutDefault().

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

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

See alsosetLayoutFunction().

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

Returns the main container widget for the form window.

See alsosetMainContainer().

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

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

See alsosetMainContainer().

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

Instructs the form window to manage the specifiedwidget.

See alsoisManaged(),unmanageWidget(), andwidgetManaged().

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

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

This function was introduced in Qt 4.5.

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

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

See alsosetPixmapFunction().

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

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

See alsoresourceFiles() andresourceFilesChanged().

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

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

See alsoaddResourceFile() andremoveResourceFile().

[signal]void QDesignerFormWindowInterface::resourceFilesChanged()

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

See alsoresourceFiles().

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

Ifselect is true, the givenwidget is selected; otherwise thewidget is deselected.

See alsoclearSelection() andselectionChanged().

[signal]void QDesignerFormWindowInterface::selectionChanged()

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

See alsoselectWidget() andclearSelection().

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

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

See alsoauthor().

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

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

See alsocomment().

[pure virtual]void QDesignerFormWindowInterface::setContents(QIODevice * device)

Sets the form's contents using data obtained from the givendevice.

Data can be read fromQFile objects or any other subclass ofQIODevice.

See alsocontents().

[pure virtual slot]void QDesignerFormWindowInterface::setContents(constQString & contents)

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

See alsocontents().

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

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

See alsoisDirty().

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

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

See alsoexportMacro().

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

Enables the specifiedfeatures for the form window.

See alsofeatures() andfeatureChanged().

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

Sets the file name for the form to the givenfileName.

See alsofileName() andfileNameChanged().

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

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

See alsogrid().

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

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

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

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

Sets the defaultmargin andspacing for the form's layout.

See alsolayoutDefault().

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

Sets themargin andspacing for the form's layout.

The default layout properties will be replaced by the corresponding layout functions whenuic 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 alsolayoutFunction().

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

Sets the main container widget on the form to the specifiedmainContainer.

See alsomainContainer() andmainContainerChanged().

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

Sets the function used to load pixmaps into the form window to the givenpixmapFunction.

See alsopixmapFunction().

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

Instructs the form window not to manage the specifiedwidget.

See alsoaboutToUnmanageWidget() andwidgetUnmanaged().

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

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

See alsomanageWidget().

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

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

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

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

See alsounmanageWidget() andaboutToUnmanageWidget().

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp