<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QAbstractFormBuilder Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></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="modules.html"><font color="#004faf">Modules</font></a></td></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> <p>Inherited by <a href="qformbuilder.html">QFormBuilder</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qabstractformbuilder.html#QAbstractFormBuilder">__init__</a></b> (<i>self</i>)</li><li><div class="fn" />QWidget <b><a href="qabstractformbuilder.html#load">load</a></b> (<i>self</i>, QIODevice <i>device</i>, QWidget <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qabstractformbuilder.html#save">save</a></b> (<i>self</i>, QIODevice <i>dev</i>, QWidget <i>widget</i>)</li><li><div class="fn" /><b><a href="qabstractformbuilder.html#setWorkingDirectory">setWorkingDirectory</a></b> (<i>self</i>, QDir <i>directory</i>)</li><li><div class="fn" />QDir <b><a href="qabstractformbuilder.html#workingDirectory">workingDirectory</a></b> (<i>self</i>)</li></ul><a name="details" /><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 UI files at run-time. For example:</p> <pre class="cpp"> MyForm<span class="operator">.</span>MyForm(<span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>parent) : <span class="type"><a href="qwidget.html">QWidget</a></span>(parent) { <span class="type"><a href="qformbuilder.html">QFormBuilder</a></span> builder; <span class="type"><a href="qfile.html">QFile</a></span> file(<span class="string">":/forms/myWidget.ui"</span>); file<span class="operator">.</span>open(<span class="type"><a href="qfile.html">QFile</a></span><span class="operator">.</span>ReadOnly); <span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>myWidget <span class="operator">=</span> builder<span class="operator">.</span>load(<span class="operator">&</span>file<span class="operator">,</span> <span class="keyword">this</span>); file<span class="operator">.</span>close(); <span class="type"><a href="qvboxlayout.html">QVBoxLayout</a></span> <span class="operator">*</span>layout <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qvboxlayout.html">QVBoxLayout</a></span>; layout<span class="operator">-</span><span class="operator">></span>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 UI 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 UI 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> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QAbstractFormBuilder" />QAbstractFormBuilder.__init__ (<i>self</i>)</h3><p>Constructs a new form builder.</p> <h3 class="fn"><a name="load" /><a href="qwidget.html">QWidget</a> QAbstractFormBuilder.load (<i>self</i>, <a href="qiodevice.html">QIODevice</a> <i>device</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><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><b>See also</b> <a href="qabstractformbuilder.html#save">save</a>().</p> <h3 class="fn"><a name="save" />QAbstractFormBuilder.save (<i>self</i>, <a href="qiodevice.html">QIODevice</a> <i>dev</i>, <a href="qwidget.html">QWidget</a> <i>widget</i>)</h3><p>Saves an XML representation of the given <i>widget</i> to the specified <i>device</i> in the standard UI file format.</p> <p><b>See also</b> <a href="qabstractformbuilder.html#load">load</a>().</p> <h3 class="fn"><a name="setWorkingDirectory" />QAbstractFormBuilder.setWorkingDirectory (<i>self</i>, <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><b>See also</b> <a href="qabstractformbuilder.html#workingDirectory">workingDirectory</a>().</p> <h3 class="fn"><a name="workingDirectory" /><a href="qdir.html">QDir</a> QAbstractFormBuilder.workingDirectory (<i>self</i>)</h3><p>Returns the current working directory of the form builder.</p> <p><b>See also</b> <a href="qabstractformbuilder.html#setWorkingDirectory">setWorkingDirectory</a>().</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>