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  ·  Tous les espaces de nom  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QFormBuilder Class Reference
[QtDesigner module]

The QFormBuilder class is used to dynamically construct user interfaces from .ui files at run-time. More...

 #include <QFormBuilder>

Inherits QAbstractFormBuilder.

Public Functions


Detailed Description

The QFormBuilder class is used to dynamically construct user interfaces from .ui files at run-time.

The QFormBuilder class provides a mechanism for dynamically creating user interfaces at run-time, based on .ui files created with Qt Designer. For example:

 MyForm::MyForm(QWidget *parent)
     : QWidget(parent)
 {
     QFormBuilder builder;
     QFile file(":/forms/myWidget.ui");
     file.open(QFile::ReadOnly);
     QWidget *myWidget = builder.load(&file, this);
     file.close();

     QVBoxLayout *layout = new QVBoxLayout;
     layout->addWidget(myWidget);
     setLayout(layout);
 }

By including the user interface in the example's resources (myForm.grc), we ensure that it will be present when the example is run:

 <!DOCTYPE RCC><RCC version="1.0">
 <qresource prefix="/forms">
    <file>mywidget.ui</file>
 </qresource>
 </RCC>

QFormBuilder extends the QAbstractFormBuilder base class with a number of functions that are used to support custom widget plugins:

  • pluginPaths() returns the list of paths that the form builder searches when loading custom widget plugins.
  • addPluginPath() allows additional paths to be registered with the form builder.
  • setPluginPath() is used to replace the existing list of paths with a list obtained from some other source.
  • clearPluginPaths() removes all paths registered with the form builder.
  • customWidgets() returns a list of interfaces to plugins that can be used to create new instances of registered custom widgets.

The QFormBuilder class is typically used by custom components and applications that embed Qt Designer. Standalone applications that need to dynamically generate user interfaces at run-time use the QUiLoader class, found in the QtUiTools module.

See also QAbstractFormBuilder and QtUiTools Module.


Member Function Documentation

QFormBuilder::QFormBuilder ()

Constructs a new form builder.

QFormBuilder::~QFormBuilder ()   [virtual]

Destroys the form builder.

void QFormBuilder::addPluginPath ( const QString & pluginPath )

Adds a new plugin path specified by pluginPath to the list of paths that will be searched by the form builder when loading a custom widget plugin.

See also setPluginPath() and clearPluginPaths().

void QFormBuilder::clearPluginPaths ()

Clears the list of paths that the form builder uses to search for custom widget plugins.

See also pluginPaths().

QList<QDesignerCustomWidgetInterface *> QFormBuilder::customWidgets () const

Returns a list of the available plugins.

QStringList QFormBuilder::pluginPaths () const

Returns the list of paths the form builder searches for plugins.

See also addPluginPath().

void QFormBuilder::setPluginPath ( const QStringList & pluginPaths )

Sets the list of plugin paths to the list specified by pluginPaths.

See also addPluginPath().

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 4.3
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