<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- /tmp/qt-4.3.4-qt-1203442408707/qt-x11-opensource-src-4.3.4/tools/designer/src/lib/uilib/abstractformbuilder.cpp --> <head> <title>Qt 4.3: QAbstractFormBuilder Class Reference</title> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td> <td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td> <td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QAbstractFormBuilder Class Reference<br /><sup><sup>[<a href="qtdesigner.html">QtDesigner</a> module]</sup></sup></h1> <p>The QAbstractFormBuilder class provides a default implementation for classes that create user interfaces at run-time. <a href="#details">More...</a></p> <pre> #include <QAbstractFormBuilder></pre><p>Inherited by <a href="qformbuilder.html">QFormBuilder</a>.</p> <ul> <li><a href="qabstractformbuilder-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-functions"></a> <h3>Public Functions</h3> <ul> <li><div class="fn"/><b><a href="qabstractformbuilder.html#QAbstractFormBuilder">QAbstractFormBuilder</a></b> ()</li> <li><div class="fn"/>virtual <b><a href="qabstractformbuilder.html#dtor.QAbstractFormBuilder">~QAbstractFormBuilder</a></b> ()</li> <li><div class="fn"/>virtual QWidget * <b><a href="qabstractformbuilder.html#load">load</a></b> ( QIODevice * <i>device</i>, QWidget * <i>parent</i> = 0 )</li> <li><div class="fn"/>virtual void <b><a href="qabstractformbuilder.html#save">save</a></b> ( QIODevice * <i>device</i>, QWidget * <i>widget</i> )</li> <li><div class="fn"/>void <b><a href="qabstractformbuilder.html#setWorkingDirectory">setWorkingDirectory</a></b> ( const QDir & <i>directory</i> )</li> <li><div class="fn"/>QDir <b><a href="qabstractformbuilder.html#workingDirectory">workingDirectory</a></b> () const</li> </ul> <a name="details"></a> <hr /> <h2>Detailed Description</h2> <p>The QAbstractFormBuilder class provides a default implementation for classes that create user interfaces at run-time.</p> <p>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 <a href="qformbuilder.html">QFormBuilder</a> class to create user interfaces from <tt>.ui</tt> files at run-time. For example:</p> <pre> 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); }</pre> <p>To override certain aspects of the form builder's behavior, subclass QAbstractFormBuilder and reimplement the relevant virtual functions:</p> <ul> <li><a href="qabstractformbuilder.html#load">load</a>() handles reading of <tt>.ui</tt> format files from arbitrary QIODevices, and construction of widgets from the XML data that they contain.</li> <li><a href="qabstractformbuilder.html#save">save</a>() handles saving of widget details in <tt>.ui</tt> format to arbitrary QIODevices.</li> <li><a href="qabstractformbuilder.html#workingDirectory">workingDirectory</a>() and <a href="qabstractformbuilder.html#setWorkingDirectory">setWorkingDirectory</a>() control the directory in which forms are held. The form builder looks for other resources on paths relative to this directory.</li> </ul> <p>The <a href="qformbuilder.html">QFormBuilder</a> class is typically used by custom components and applications that embed <i>Qt Designer</i>. Standalone applications that need to dynamically generate user interfaces at run-time use the <a href="quiloader.html">QUiLoader</a>, found in the <a href="qtuitools.html">QtUiTools</a> module.</p> <p>See also <a href="qtuitools.html">QtUiTools Module</a>.</p> <hr /> <h2>Member Function Documentation</h2> <h3 class="fn"><a name="QAbstractFormBuilder"></a>QAbstractFormBuilder::QAbstractFormBuilder ()</h3> <p>Constructs a new form builder.</p> <h3 class="fn"><a name="dtor.QAbstractFormBuilder"></a>QAbstractFormBuilder::~QAbstractFormBuilder () <tt> [virtual]</tt></h3> <p>Destroys the form builder.</p> <h3 class="fn"><a name="load"></a><a href="qwidget.html">QWidget</a> * QAbstractFormBuilder::load ( <a href="qiodevice.html">QIODevice</a> * <i>device</i>, <a href="qwidget.html">QWidget</a> * <i>parent</i> = 0 ) <tt> [virtual]</tt></h3> <p>Loads an XML representation of a widget from the given <i>device</i>, and constructs a new widget with the specified <i>parent</i>.</p> <p>See also <a href="qabstractformbuilder.html#save">save</a>().</p> <h3 class="fn"><a name="save"></a>void QAbstractFormBuilder::save ( <a href="qiodevice.html">QIODevice</a> * <i>device</i>, <a href="qwidget.html">QWidget</a> * <i>widget</i> ) <tt> [virtual]</tt></h3> <p>Saves an XML representation of the given <i>widget</i> to the specified <i>device</i> in the standard <tt>.ui</tt> file format.</p> <p>See also <a href="qabstractformbuilder.html#load">load</a>().</p> <h3 class="fn"><a name="setWorkingDirectory"></a>void QAbstractFormBuilder::setWorkingDirectory ( const <a href="qdir.html">QDir</a> & <i>directory</i> )</h3> <p>Sets the current working directory of the form builder to the specified <i>directory</i>.</p> <p>See also <a href="qabstractformbuilder.html#workingDirectory">workingDirectory</a>().</p> <h3 class="fn"><a name="workingDirectory"></a><a href="qdir.html">QDir</a> QAbstractFormBuilder::workingDirectory () const</h3> <p>Returns the current working directory of the form builder.</p> <p>See also <a href="qabstractformbuilder.html#setWorkingDirectory">setWorkingDirectory</a>().</p> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td width="30%">Copyright © 2008 <a href="trolltech.html">Trolltech</a></td> <td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td> <td width="30%" align="right"><div align="right">Qt 4.3.4</div></td> </tr></table></div></address></body> </html>