Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QDesignerFormWindowInterface Class

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

 #include <QDesignerFormWindowInterface>

Inherits: QWidget.

Inherited by:

Public Types

flags Feature
enum FeatureFlag { EditFeature, GridFeature, TabOrderFeature, DefaultFeature }
enum PaintDeviceMetric { PdmWidth, PdmHeight, PdmWidthMM, PdmHeightMM, ..., PdmPhysicalDpiY }
enum ResourceFileSaveMode { SaveAllResourceFiles, SaveOnlyUsedResourceFiles, DontSaveResourceFiles }

Public Functions

QDesignerFormWindowInterface(QWidget * parent = 0, Qt::WindowFlags flags = 0)
virtual ~QDesignerFormWindowInterface()
virtual ~QPaintDevice()
virtual QDir absoluteDir() const = 0
QStringList activeResourceFilePaths() const
virtual void addResourceFile(const QString & path) = 0
virtual QString author() const = 0
virtual QStringList checkContents() const = 0
int colorCount() const
virtual QString comment() const = 0
virtual QString contents() const = 0
virtual QDesignerFormEditorInterface * core() const
virtual QDesignerFormWindowCursorInterface * cursor() const = 0
int depth() const
virtual void emitSelectionChanged() = 0
virtual QString exportMacro() const = 0
virtual Feature features() const = 0
virtual QString fileName() const = 0
virtual QWidget * formContainer() const = 0
virtual QPoint grid() const = 0
virtual bool hasFeature(Feature feature) const = 0
int height() const
int heightMM() const
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
int logicalDpiX() const
int logicalDpiY() const
virtual QPaintEngine * paintEngine() const = 0
bool paintingActive() const
int physicalDpiX() const
int physicalDpiY() const
virtual QString pixmapFunction() const = 0
virtual void removeResourceFile(const QString & path) = 0
virtual ResourceFileSaveMode resourceFileSaveMode() const = 0
virtual QStringList resourceFiles() const = 0
virtual void setAuthor(const QString & author) = 0
virtual void setComment(const QString & comment) = 0
virtual bool setContents(QIODevice * device, QString * errorMessage = 0) = 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(ResourceFileSaveMode behaviour) = 0
int width() const
int widthMM() const
  • 215 public functions inherited from QWidget
  • 31 public functions inherited from QObject

Public Slots

void activateResourceFilePaths(const QStringList & paths, int * errorCount = 0, QString * errorMessages = 0)
virtual void clearSelection(bool update = true) = 0
virtual void manageWidget(QWidget * widget) = 0
virtual void selectWidget(QWidget * widget, bool select = true) = 0
virtual bool setContents(const QString & contents) = 0
virtual void setDirty(bool dirty) = 0
virtual void setFeatures(Feature features) = 0
virtual void setFileName(const QString & fileName) = 0
virtual void setGrid(const QPoint & grid) = 0
virtual void unmanageWidget(QWidget * widget) = 0
  • 19 public slots inherited from QWidget
  • 1 public slot inherited from QObject

Signals

void aboutToUnmanageWidget(QWidget * widget)
void activated(QWidget * widget)
void changed()
void featureChanged(Feature feature)
void fileNameChanged(const QString & fileName)
void geometryChanged()
void mainContainerChanged(QWidget * mainContainer)
void objectRemoved(QObject * object)
void resourceFilesChanged()
void selectionChanged()
void widgetManaged(QWidget * widget)
void widgetRemoved(QWidget * widget)
void widgetUnmanaged(QWidget * widget)

Static Public Members

QDesignerFormWindowInterface * findFormWindow(QWidget * widget)
QDesignerFormWindowInterface * findFormWindow(QObject * object)
  • 4 static public members inherited from QWidget
  • 11 static public members inherited from QObject

Protected Functions

QPaintDevice()
virtual void init(QPainter * painter) const
virtual int metric(PaintDeviceMetric metric) const
virtual QPaintDevice * redirected(QPoint * offset) const
virtual QPainter * sharedPainter() const
  • 37 protected functions inherited from QWidget
  • 9 protected functions inherited from QObject

Additional Inherited Members

  • 58 properties inherited from QWidget
  • 1 property inherited from QObject
  • 1 protected slot inherited from QWidget

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 = 0, Qt::WindowFlags flags = 0)

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

QDesignerFormWindowInterface::~QDesignerFormWindowInterface() [virtual]

Destroys the form window interface.

void QDesignerFormWindowInterface::aboutToUnmanageWidget(QWidget * widget) [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().

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

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

void QDesignerFormWindowInterface::activateResourceFilePaths(const QStringList & paths, int * errorCount = 0, QString * errorMessages = 0) [slot]

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.

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

This signal is emitted whenever a widget is activated on the form. The activated widget is specified by 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().

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

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

See also resourceFiles() and resourceFilesChanged().

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

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

See also setAuthor().

void QDesignerFormWindowInterface::changed() [signal]

This signal is emitted whenever a form is changed.

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

Performs checks on the current form and returns a list of richtext warnings about potential issues (for example, top level spacers on unlaid-out forms).

IDE integrations can call this before handling starting a save operation.

This function was introduced in Qt 5.0.

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

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() const [pure virtual]

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

See also setComment().

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

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

See also setContents().

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

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

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

Returns the cursor interface used by the form window.

void QDesignerFormWindowInterface::emitSelectionChanged() [pure virtual]

Emits the selectionChanged() signal.

See also selectWidget() and clearSelection().

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

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.

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

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

See also setFeatures().

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

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() const [pure virtual]

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

See also setFileName().

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

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

See also setFileName().

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

Returns the form window interface for the given widget.

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

Returns the form window interface for the given object.

This function was introduced in Qt 4.4.

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

Returns the form the widget containing the main container widget.

This function was introduced in Qt 5.0.

See also mainContainer().

void QDesignerFormWindowInterface::geometryChanged() [signal]

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

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

Returns the grid spacing used by the form window.

See also setGrid().

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

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

See also features().

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

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() const [pure virtual]

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

See also setDirty().

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

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

See also manageWidget().

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

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

See also setLayoutDefault().

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

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

See also setLayoutFunction().

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

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

See also setMainContainer().

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

Instructs the form window to manage the specified widget.

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

void QDesignerFormWindowInterface::objectRemoved(QObject * object) [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.

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

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

See also setPixmapFunction().

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

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

See also resourceFiles() and resourceFilesChanged().

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

See also setResourceFileSaveMode().

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

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

See also addResourceFile() and removeResourceFile().

void QDesignerFormWindowInterface::resourceFilesChanged() [signal]

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

See also resourceFiles().

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

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

See also clearSelection() and selectionChanged().

void QDesignerFormWindowInterface::selectionChanged() [signal]

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

See also selectWidget() and clearSelection().

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

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

See also author().

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

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

See also comment().

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

Sets the form's contents using data obtained from the given device and returns whether loading succeeded. If it fails, the error message is returned in errorMessage.

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

See also contents().

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

Sets the contents of the form using data read from the specified contents string and returns whether the operation succeeded.

See also contents().

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

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

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

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

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

Enables the specified features for the form window.

See also features() and featureChanged().

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

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

See also fileName() and fileNameChanged().

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

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

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

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

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

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

See also layoutDefault().

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

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

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

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

See also mainContainer() and mainContainerChanged().

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

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

See also pixmapFunction().

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

See also resourceFileSaveMode().

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

Instructs the form window not to manage the specified widget.

See also aboutToUnmanageWidget() and widgetUnmanaged().

void QDesignerFormWindowInterface::widgetManaged(QWidget * widget) [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 QDesignerFormWindowInterface::widgetRemoved(QWidget * widget) [signal]

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

void QDesignerFormWindowInterface::widgetUnmanaged(QWidget * widget) [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().

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web