Qt:Документация 4.3.2/qabstractformbuilder

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь

__NOTOC__

Image:qt-logo.png

Главная · Все классы · Основные классы · Классы по группам · Модули · Функции

Image:trolltech-logo.png

Содержание

[править] QAbstractFormBuilder Class Reference
[модуль QtDesigner ]

The QAbstractFormBuilder class provides a default implementation for classes that create user interfaces at run-time. More...

 #include <QAbstractFormBuilder>

Inherited by QFormBuilder.

[править] Открытые функции


[править] Подробное описание

The QAbstractFormBuilder class provides a default implementation for classes that create user interfaces at run-time.

QAbstractFormBuilder provides a standard interface and a default implementation for constructing forms from user interface files. It is not intended to be instantiated directly. Use the QFormBuilder class to create user interfaces from .ui files at run-time. For example:

 MyForm::MyForm(QWidget *parent)
     : QWidget(parent)
 {
     QFormBuilder builder;
     QFile file(":/forms/myWidget.ui");
     file.open(QFile::ReadOnly);
     QWidget *myWidget = builder.load(&amp;file, this);
     file.close();
 
     QVBoxLayout *layout = new QVBoxLayout;
     layout->addWidget(myWidget);
     setLayout(layout);
 }

To override certain aspects of the form builder's behavior, subclass QAbstractFormBuilder and reimplement the relevant virtual functions:

  • load() handles reading of .ui format files from arbitrary QIODevices, and construction of widgets from the XML data that they contain.
  • save() handles saving of widget details in .ui format to arbitrary QIODevices.
  • workingDirectory() and setWorkingDirectory() control the directory in which forms are held. The form builder looks for other resources on paths relative to this directory.

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, found in the QtUiTools module.

See also QtUiTools Module.


[править] Описание функций-членов

[править]
QAbstractFormBuilder::QAbstractFormBuilder ()

Constructs a new form builder.

[править]
QAbstractFormBuilder::~QAbstractFormBuilder () [virtual]

Destroys the form builder.

[править]
QWidget * QAbstractFormBuilder::load ( QIODevice * device, QWidget * parent = 0 ) [virtual]

Loads an XML representation of a widget from the given device, and constructs a new widget with the specified parent.

See also save().

[править]
void QAbstractFormBuilder::save ( QIODevice * device, QWidget * widget ) [virtual]

Saves an XML representation of the given widget to the specified device in the standard .ui file format.

See also load().

[править]
void QAbstractFormBuilder::setWorkingDirectory ( const QDir & directory )

Sets the current working directory of the form builder to the specified directory.

See also workingDirectory().

[править]
QDir QAbstractFormBuilder::workingDirectory () const

Returns the current working directory of the form builder.

See also setWorkingDirectory().


Copyright © 2007 Trolltech Trademarks
Qt 4.3.2