You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/html/designer-manual-16.html

520 lines
30 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/tools/designer/book/chap-ui-format.leaf:3 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Reference: The .ui File Format</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><p align="right">[<a href="designer-manual-15.html">Prev: Reference: Windows</a>] [<a href="designer-manual.html">Home</a>]</p>
<h2 align="center">Reference: The .ui File Format</h2>
<p><em>TQt Designer</em> stores forms in <tt>.ui</tt> files. These files use an XML format to represent form elements and their characteristics. This document provides an overview of the XML format used, and should provide enough information for developers to write their own <tt>.ui</tt> parsers so that they can read and modify <tt>.ui</tt> files programatically.</p>
<p>One way to parse a <tt>.ui</tt> file is to use TQt and the <a href="tqdomdocument.html">TQDomDocument</a> class; this is how <em>TQt Designer</em> does it: see the <tt>uilib/tqwidgetfactory.h</tt> and <tt>uilib/tqwidgetfactory.cpp</tt> source files. For information on dynamically loading and running <tt>.ui</tt> files see <a href="designer-manual-6.html#2-3-2">Loading and Executing a Dynamic Dialog</a>.</p>
<p>The doctype of a <tt>.ui</tt> file is simply "UI", so the doctype tag is:</p>
<pre>
&lt;!DOCTYPE UI&gt;
</pre>
<p>The root element is a "UI", which encloses the entire contents:</p>
<pre>
&lt;UI version="3.1" stdsetdef="1"&gt;
...
&lt;/UI&gt;
</pre>
<p>Within the UI entity, there may one or zero of the following element types:</p>
<ul><li><p><a href="designer-manual-16.html#1-1">actions</a> - actions, for <a href="ntqmainwindow.html">TQMainWindow</a> forms</p>
<li><p><a href="designer-manual-16.html#1-2">author</a> - the form's author</p>
<li><p><a href="designer-manual-16.html#1-3">class</a> - the form's class name</p>
<li><p><a href="designer-manual-16.html#1-4">comment</a> - comments, e.g. copyright notices</p>
<li><p><a href="designer-manual-16.html#1-5">connections</a> - signal/slot connections</p>
<li><p><a href="designer-manual-16.html#1-6">customwidgets</a> - custom widgets (old-style)</p>
<li><p><a href="designer-manual-16.html#1-7">exportmacro</a> - Windows-specific</p>
<li><p><a href="designer-manual-16.html#1-8">forwards</a> - forward declarations</p>
<li><p><a href="designer-manual-16.html#1-9">functions</a> - function declarations</p>
<li><p><a href="designer-manual-16.html#1-10">images</a> - embedded images: only for <tt>.ui</tt> files than include embedded images; images are normally stored in a separate <tt>images</tt> directory</p>
<li><p><a href="designer-manual-16.html#1-11">includes</a> - include files</p>
<li><p><a href="designer-manual-16.html#1-12">layoutdefaults</a> - default values for layout attributes</p>
<li><p><a href="designer-manual-16.html#1-13">layoutfunctions</a> - dynamic default values for layout attributes</p>
<li><p><a href="designer-manual-16.html#1-14">menubar</a> - menu bar, for <a href="ntqmainwindow.html">TQMainWindow</a> forms</p>
<li><p><a href="designer-manual-16.html#1-15">pixmapfunction</a> - the name of the function to use for retrieving pixmaps if neither embedded nor external pixmaps are being used</p>
<li><p><a href="designer-manual-16.html#1-16">pixmapinproject</a> - an element whose presence ndicates that the pixmaps are handled by the <tt>.pro</tt> file</p>
<li><p><a href="designer-manual-16.html#1-17">signals</a> - signal declarations</p>
<li><p><a href="designer-manual-16.html#1-18">slots</a> - slot declarations</p>
<li><p><a href="designer-manual-16.html#1-19">tabstops</a> - the form's tab order</p>
<li><p><a href="designer-manual-16.html#1-20">toolbars</a> - toolbars, for <a href="ntqmainwindow.html">TQMainWindow</a> forms</p>
<li><p><a href="designer-manual-16.html#1-21">variables</a> - class variables</p>
<li><p><a href="designer-manual-16.html#1-22">widget</a> - the form itself; this element may contain other elements, including other <tt>widget</tt> elements</p>
<li><p><a href="designer-manual-16.html#1-23">forward</a> - TQt 3.x beta backwards compatibility</p>
<li><p><a href="designer-manual-16.html#1-24">include</a> - TQt 2.x backwards compatibility</p>
<li><p><a href="designer-manual-16.html#1-25">variable</a> - TQt 3.x beta backwards compatibility</p>
</ul><p>The ordering of elements is arbitrary, although it is common for the <a href="designer-manual-16.html#1-3">class</a> element to be first.</p>
<h3><a name="1"></a>UI Elements</h3>
<a name="actions"></a><h4><a name="1-1"></a>actions</h4>
<p>This element is used to store the form's actions. It only occurs in <a href="ntqmainwindow.html">TQMainWindow</a> forms.</p>
<p>The <tt>actions</tt> element contains one or more <tt>action</tt> elements. Each <tt>action</tt> element contains one or more properties. Each property has a <tt>name</tt> attribute, and a single value which is contained within a <a href="designer-manual-16.html#datatype">datatype</a> element.</p>
<pre>
&lt;actions&gt;
&lt;action&gt;
&lt;property name="name"&gt;
&lt;cstring&gt;fileNewAction&lt;/cstring&gt;
&lt;/property&gt;
&lt;property name="iconSet"&gt;
&lt;iconset&gt;filenew&lt;/iconset&gt;
&lt;/property&gt;
&lt;property name="text"&gt;
&lt;string&gt;New&lt;/string&gt;
&lt;/property&gt;
&lt;property name="menuText"&gt;
&lt;string&gt;&amp;amp;New&lt;/string&gt;
&lt;/property&gt;
&lt;/action&gt;
...
&lt;/actions&gt;
</pre>
<a name="author"></a><h4><a name="1-2"></a>author</h4>
<p>This element is used to store the author's name as a simple string.</p>
<pre>
&lt;author&gt;Barney Rubble&lt;/author&gt;
</pre>
<a name="class"></a><h4><a name="1-3"></a>class</h4>
<p>This element is used to store the form's class name as a simple string.</p>
<pre>
&lt;class&gt;InsuranceForm&lt;/class&gt;
</pre>
<a name="comment"></a><h4><a name="1-4"></a>comment</h4>
<p>This element is used to store comments, for example, copyright notices, as a simple string.</p>
<pre>
&lt;comment&gt;*********************************************************************
** Copyright (C) 2002 Trolltech ASA. All rights reserved.
**
** This file is part of TQt Designer.
**
** This file may be used under the terms of the GNU General Public
** License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Alternatively you may (at your option) use any
** later version of the GNU General Public License if such license has
** been publicly approved by Trolltech ASA (or its successors, if any)
** and the KDE Free TQt Foundation.
**
** Please review the following information to ensure GNU General
** Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/.
** If you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** Licensees holding valid TQt Commercial licenses may use this file in
** accordance with the TQt Commercial License Agreement provided with
** the Software.
**
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
** herein.
**
*********************************************************************&lt;/comment&gt;
</pre>
<a name="connections"></a><h4><a name="1-5"></a>connections</h4>
<p>This element is used to record the signals and slots connections in the form.</p>
<p>The <tt>connections</tt> element contains one or more <tt>connection</tt> elements and one or more <tt>slot</tt> elements. Each <tt>connection</tt> element identifies the signaling object and its signal, and the receiving object and its slot.</p>
<pre>
&lt;connections&gt;
...
&lt;connection language="C++"&gt;
&lt;sender&gt;alignActionGroup&lt;/sender&gt;
&lt;signal&gt;selected(TQAction*)&lt;/signal&gt;
&lt;receiver&gt;EditorForm&lt;/receiver&gt;
&lt;slot&gt;changeAlignment(TQAction*)&lt;/slot&gt;
&lt;/connection&gt;
...
&lt;/connections&gt;
</pre>
<a name="customwidgets"></a><h4><a name="1-6"></a>customwidgets</h4>
<p><em>TQt Designer</em> can operate with custom widgets. A custom widget is represented in a <tt>.ui</tt> file using the <tt>&lt;customwidget&gt;</tt> element.</p>
<p>Note that these are the 'old-style' custom widgets that show up on the form as grey rectangles. Use plugins to seamlessly integrate your custom widgets into <em>TQt Designer</em> -- see <a href="designer-manual-7.html#2">Creating Custom Widgets with Plugins</a>.</p>
<p>Each custom widget has a class name and a header file. They also have a size hint and size policy. A pixmap can be specified; this is displayed on a <em>TQt Designer</em> toolbar button which the user can use to create an instance of the custom widget. Custom widgets usually emit signals, and these are listed. The name and type of any properties that the widget has are also included.</p>
<pre>
&lt;customwidgets&gt;
&lt;customwidget&gt;
&lt;class&gt;StyledButton&lt;/class&gt;
&lt;header location="local"&gt;styledbutton.h&lt;/header&gt;
&lt;sizehint&gt;
&lt;width&gt;40&lt;/width&gt;
&lt;height&gt;25&lt;/height&gt;
&lt;/sizehint&gt;
&lt;container&gt;0&lt;/container&gt;
&lt;sizepolicy&gt;
&lt;hordata&gt;5&lt;/hordata&gt;
&lt;verdata&gt;5&lt;/verdata&gt;
&lt;/sizepolicy&gt;
&lt;pixmap&gt;image0&lt;/pixmap&gt;
&lt;signal&gt;clicked()&lt;/signal&gt;
&lt;signal&gt;changed()&lt;/signal&gt;
&lt;property type="Color"&gt;color&lt;/property&gt;
&lt;property type="Pixmap"&gt;pixmap&lt;/property&gt;
&lt;property type="Bool"&gt;scale&lt;/property&gt;
&lt;/customwidget&gt;
&lt;/customwidgets&gt;
</pre>
<a name="exportmacro"></a><h4><a name="1-7"></a>exportmacro</h4>
<p>This tag is only relevant to Windows users.</p>
<p>If you have a class that requires some Windows-specific export macro, e.g. for classes in a DLL that need to be declared like this: <tt>class win_specific_declaration_goes_here Class</tt>, you can use the <tt>&lt;exportmacro&gt;</tt> tag. (In standard TQt we use the <tt>TQ_EXPORT</tt> macro, e.g. <tt>class TQ_EXPORT TQWidget</tt>.) If you use this tag you must also:</p>
<ol type=1><li><p><a href="designer-manual-16.html#1-11">include</a> the file which contains the macro definition;</p>
<li><p>add the export macro to the form -- this is achieved by entering the macro's name in the 'export macro' sub-property of the form's name property.</p>
</ol><p>Following these steps will ensure that <a href="uic.html">uic</a> will create the correct <tt>class YOUR_MACRO Form</tt> declarations.</p>
<pre>
&lt;exportmacro&gt;EDITOR_EXPORT&lt;/exportmacro&gt;
</pre>
<a name="forwards"></a><h4><a name="1-8"></a>forwards</h4>
<p>It is sometimes necessary to forward declare classes, particularly if code is being written in <tt>.ui.h</tt> files within <em>TQt Designer</em>. Each forward declaration is listed as it should appear in the generated C++ code.</p>
<pre>
&lt;forwards&gt;
&lt;forward&gt;class TQStringList;&lt;/forward&gt;
&lt;/forwards&gt;
</pre>
<a name="functions"></a><h4><a name="1-9"></a>functions</h4>
<p>The <tt>functions</tt> element contains a list of functions. Functions are standard C++ functions. It is possible to specify various attributes to create a function's signature, for example:</p>
<ul><li><p>access: <tt>private</tt>, <tt>protected</tt> or <tt>public</tt>. Default: <tt>public</tt></p>
<li><p>returnType: the return datatype of the function. Default: <tt>void</tt></p>
<li><p>specifier: <tt>non virtual</tt>, <tt>virtual</tt> or <tt>pure virtual</tt>. Default: <tt>virtual</tt></p>
<li><p>language: specifies the programming language. Default: <tt>C++</tt></p>
</ul><pre>
&lt;functions&gt;
&lt;function access="private" specifier="non virtual"&gt;isValid()&lt;/function&gt;
&lt;function access="public" returnType="TQString"&gt;getMessage()&lt;/function&gt;
&lt;/functions&gt;
</pre>
<a name="images"></a><h4><a name="1-10"></a>images</h4>
<p>Images are normally stored in their own files and associated with forms using project files. This has the advantage that images can be shared across any number of forms in a project, and between projects.</p>
<p>In some cases it may be desireable to store image data directly in a form, and the <tt>&lt;image&gt;</tt> tag allows for this.</p>
<p>It is possible to store images in both PNG and XPM formats, although in practice only XPM is recommended because of bugs in some PNG libraries. See the <tt>saveImageData</tt> function in <tt>resource.cpp</tt> to see how the image data is encoded.</p>
<pre>
&lt;images&gt;
&lt;image name="image0"&gt;
&lt;data format="XPM.GZ" length="409"&gt;789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c6b53006ab440370316528264b4c198450c5808a94d1ed00aac214832b43124b544ec414d34b4c4c441103f11341120831309758313d0cf3b0840b7258d55a73010092c14eca&lt;/data&gt;
&lt;/image&gt;
&lt;/images&gt;
</pre>
<a name="includes"></a><h4><a name="1-11"></a>includes</h4>
<p>It is sometimes necessary to <tt>#include</tt> header files in a <tt>.ui</tt> file. Header files may be 'local', i.e. relative to the project's directory, or 'global', i.e. part of TQt or the compilers standard libraries. Header files are declared in the implementation wherever possible, although sometimes it is necessary to declare them in the declaration (header) file.</p>
<p><em>TQt Designer</em> automatically adds <tt>&lt;include&gt;</tt> tags for a <tt>.ui</tt>'s <tt>.ui.h</tt> file.</p>
<pre>
&lt;includes&gt;
&lt;include location="local" impldecl="in implementation"&gt;pixmapcollection.h&lt;/include&gt;
&lt;include location="local" impldecl="in implementation"&gt;pixmapchooser.h&lt;/include&gt;
&lt;include location="local" impldecl="in implementation"&gt;project.h&lt;/include&gt;
&lt;include location="global" impldecl="in implementation"&gt;ntqfileinfo.h&lt;/include&gt;
&lt;include location="global" impldecl="in implementation"&gt;ntqimage.h&lt;/include&gt;
&lt;include location="global" impldecl="in declaration"&gt;ntqpixmap.h&lt;/include&gt;
&lt;include location="local" impldecl="in implementation"&gt;pixmapcollectioneditor.ui.h&lt;/include&gt;
&lt;/includes&gt;
</pre>
<a name="layoutdefaults"></a><h4><a name="1-12"></a>layoutdefaults</h4>
<p>Every form has a default spacing and margin size. These can be overridden on a case-by-case basis.</p>
<pre>
&lt;layoutdefaults spacing="6" margin="11"/&gt;
</pre>
<p>See also <a href="designer-manual-16.html#1-13">layoutfunctions</a>.</p>
<a name="layoutfunctions"></a><h4><a name="1-13"></a>layoutfunctions</h4>
<p>Sometimes the spacing and margin values should be determined dynamically, e.g. to provide a common look in a windowmanager.</p>
<pre>
&lt;layoutfunctions spacing="LayoutClass::spacing" margin="LayoutClass::margin"/&gt;
</pre>
<p>The rules for determining <tt>margin</tt> and <tt>spacing</tt> values are these:</p>
<ol type=1><li><p>If an integer value is specified for <tt>margin</tt> or <tt>spacing</tt> then the value is used.</p>
<li><p>If no integer value is specified and a layout function is specified then the function is used.</p>
<li><p>If no integer value or function is specified then the default value from <tt>layoutdefaults</tt> is used.</p>
</ol><a name="menubar"></a><h4><a name="1-14"></a>menubar</h4>
<p>Applications that use <a href="ntqmainwindow.html">TQMainWindow</a> often have a menubar. The menubar has a name property and one or more popup menu items. Each menu item has one or more actions and optionally separators.</p>
<pre>
&lt;menubar&gt;
&lt;property name="name"&gt;
&lt;cstring&gt;menubar&lt;/cstring&gt;
&lt;/property&gt;
&lt;item text="&amp;amp;File" name="PopupMenu"&gt;
&lt;action name="fileSaveAction"/&gt;
&lt;separator/&gt;
&lt;action name="fileExitAction"/&gt;
&lt;/item&gt;
&lt;item text="&amp;amp;Help" name="PopupMenu_2"&gt;
&lt;action name="helpAboutAction"/&gt;
&lt;action name="helpAboutTQtAction"/&gt;
&lt;/item&gt;
&lt;/menubar&gt;
</pre>
<a name="pixmapfunction"></a><h4><a name="1-15"></a>pixmapfunction</h4>
<p>Images are normally included by listing their filenames in project files. Images can also be included inline using the <a href="designer-manual-16.html#1-10">images</a> tag. Another way of dealing with images is to specify a function name. This function will be called, with the name (or 'key') of the relevant image, and is responsible for loading the appropriate image. To specify such a function the <tt>&lt;pixmapfunction&gt;</tt> tag is used.</p>
<pre>
&lt;pixmapfunction&gt;splashScreen&lt;/pixmapfunction&gt;
</pre>
<a name="pixmapinproject"></a><h4><a name="1-16"></a>pixmapinproject</h4>
<p>Most applications store their images as separate files listed in the application's project file. This can be signified by including the <tt>&lt;pixmapinproject&gt;</tt> tag.</p>
<pre>
&lt;pixmapinproject/&gt;
</pre>
<a name="signals"></a><h4><a name="1-17"></a>signals</h4>
<p>All the signals are listed Within a <tt>&lt;signals&gt;</tt> tag.</p>
<pre>
&lt;signals&gt;
&lt;signal&gt;somethingChanged()&lt;/signal&gt;
&lt;/signals&gt;
</pre>
<a name="slots"></a><h4><a name="1-18"></a>slots</h4>
<p>The <tt>slots</tt> element contains a list of slots. Each <tt>slot</tt> element provides a slot's prototype.</p>
<pre>
&lt;slots&gt;
&lt;slot access="public" specifier="virtual" language="C++"
returnType="void"&gt;changeAlignment(TQAction* align)&lt;/slot&gt;
&lt;/slots&gt;
</pre>
<p>For available attributes see <a href="designer-manual-16.html#1-9">functions</a>.</p>
<a name="tabstops"></a><h4><a name="1-19"></a>tabstops</h4>
<p>Tabstops indicate the widgets that get the focus as the user tabs through the form. The <tt>&lt;tabstops&gt;</tt> tag contains a list of tabstops, in order, each of which holds the name of a widget.</p>
<pre>
&lt;tabstops&gt;
&lt;tabstop&gt;templateView&lt;/tabstop&gt;
&lt;tabstop&gt;helpButton&lt;/tabstop&gt;
&lt;tabstop&gt;buttonOk&lt;/tabstop&gt;
&lt;tabstop&gt;buttonCancel&lt;/tabstop&gt;
&lt;/tabstops&gt;
</pre>
<a name="toolbars"></a><h4><a name="1-20"></a>toolbars</h4>
<p>Forms that have toolbars (dock windows) use the <tt>&lt;toolbars&gt;</tt> tag to hold the details. These forms are normally <a href="ntqmainwindow.html">TQMainWindow</a>s (or subclasses). Each toolbar has a dock attribute which identifies which dock window the toolbar initially belongs to. They also have both name and label properties. Each toolbar button is represented by an action. Toolbars can also hold other widgets, in which case the <tt>&lt;toolbar&gt;</tt> tag includes appropriate <tt>&lt;widget&gt;</tt> tags which give the class, name and any non-default property values for the relevant widget.</p>
<pre>
&lt;toolbars&gt;
&lt;toolbar dock="2"&gt;
&lt;property name="name"&gt;
&lt;cstring&gt;toolBar&lt;/cstring&gt;
&lt;/property&gt;
&lt;property name="label"&gt;
&lt;string&gt;Tools&lt;/string&gt;
&lt;/property&gt;
&lt;action name="fileNewAction"/&gt;
&lt;action name="fileOpenAction"/&gt;
&lt;action name="fileSaveAction"/&gt;
&lt;separator/&gt;
&lt;action name="editUndoAction"/&gt;
&lt;action name="editRedoAction"/&gt;
&lt;action name="editCutAction"/&gt;
&lt;action name="editCopyAction"/&gt;
&lt;action name="editPasteAction"/&gt;
&lt;/toolbar&gt;
&lt;toolbar dock="2"&gt;
&lt;property name="name"&gt;
&lt;cstring&gt;Toolbar&lt;/cstring&gt;
&lt;/property&gt;
&lt;property name="label"&gt;
&lt;string&gt;Toolbar&lt;/string&gt;
&lt;/property&gt;
&lt;action name="leftAlignAction"/&gt;
&lt;action name="centerAlignAction"/&gt;
&lt;action name="rightAlignAction"/&gt;
&lt;separator/&gt;
&lt;action name="boldAction"/&gt;
&lt;action name="italicAction"/&gt;
&lt;action name="underlineAction"/&gt;
&lt;separator/&gt;
&lt;widget class="TQComboBox"&gt;
&lt;property name="name"&gt;
&lt;cstring&gt;fontComboBox&lt;/cstring&gt;
&lt;/property&gt;
&lt;/widget&gt;
&lt;widget class="TQSpinBox"&gt;
&lt;property name="name"&gt;
&lt;cstring&gt;SpinBox2&lt;/cstring&gt;
&lt;/property&gt;
&lt;property name="minValue"&gt;
&lt;number&gt;6&lt;/number&gt;
&lt;/property&gt;
&lt;property name="value"&gt;
&lt;number&gt;10&lt;/number&gt;
&lt;/property&gt;
&lt;/widget&gt;
&lt;/toolbar&gt;
&lt;/toolbars&gt;
</pre>
<a name="variables"></a><h4><a name="1-21"></a>variables</h4>
<p>Module variables are held in the <tt>&lt;variables&gt;</tt> tag. Variable type names often include &lt; and &gt;, which must be stored as entities. It is also possible to specify the access type - either <tt>public</tt>, <tt>protected</tt> or <tt>private</tt>. Default is <tt>protected</tt>.</p>
<pre>
&lt;variables&gt;
&lt;variable access="private"&gt;SettingsDialog * settings;&lt;/variable&gt;
&lt;variable&gt;TQMap&amp;lt;int, TQString&amp;gt; bookmarks;&lt;/variable&gt;
&lt;variable&gt;HelpWindow *browser;&lt;/variable&gt;
&lt;variable&gt;HelpDialog *helpDock;&lt;/variable&gt;
&lt;variable&gt;TQGuardedPtr&amp;lt;FindDialog&amp;gt; findDialog;&lt;/variable&gt;
&lt;variable&gt;static TQPtrList&amp;lt;MainWindow&amp;gt; *windows;&lt;/variable&gt;
&lt;/variables&gt;
</pre>
<a name="widget"></a><h4><a name="1-22"></a>widget</h4>
<p>Widgets are used at multiple levels within a <tt>.ui</tt> file. The whole form itself is a widget, and it contains other widgets, usually within the context of layouts such as hboxes, vboxes and grids.</p>
<p>Below is an example of a complete <tt>.ui</tt> file. The form itself is a <a href="tqwidget.html">TQWidget</a> with various non-default properties set. This widget contains a single hbox, which also has some non-default properties, and which contains a single <a href="ntqtextbrowser.html">TQTextBrowser</a> widget.</p>
<pre>
&lt;!DOCTYPE UI&gt;&lt;UI version="3.1" stdsetdef="1"&gt;
&lt;class&gt;WinIntroPage&lt;/class&gt;
&lt;widget class="TQWidget"&gt;
&lt;property name="name"&gt;
&lt;cstring&gt;WinIntroPage&lt;/cstring&gt;
&lt;/property&gt;
&lt;property name="geometry"&gt;
&lt;rect&gt;
&lt;x&gt;0&lt;/x&gt;
&lt;y&gt;0&lt;/y&gt;
&lt;width&gt;387&lt;/width&gt;
&lt;height&gt;228&lt;/height&gt;
&lt;/rect&gt;
&lt;/property&gt;
&lt;property name="caption"&gt;
&lt;string&gt;Form1&lt;/string&gt;
&lt;/property&gt;
&lt;hbox&gt;
&lt;property name="name"&gt;
&lt;cstring&gt;unnamed&lt;/cstring&gt;
&lt;/property&gt;
&lt;property name="margin"&gt;
&lt;number&gt;11&lt;/number&gt;
&lt;/property&gt;
&lt;property name="spacing"&gt;
&lt;number&gt;6&lt;/number&gt;
&lt;/property&gt;
&lt;widget class="TQTextBrowser"&gt;
&lt;property name="name"&gt;
&lt;cstring&gt;TextBrowser1&lt;/cstring&gt;
&lt;/property&gt;
&lt;property name="text"&gt;
&lt;string&gt;This program installs TQt.&lt;/string&gt;
&lt;/property&gt;
&lt;/widget&gt;
&lt;/hbox&gt;
&lt;/widget&gt;
&lt;layoutdefaults spacing="6" margin="11"/&gt;
&lt;/UI&gt;
</pre>
<a name="forward"></a><h4><a name="1-23"></a>forward</h4>
<p><i> This tag is included for TQt 3.x beta backwards compatibility, and should not be used. Use <a href="designer-manual-16.html#1-8">forwards</a> instead. </i></p>
<a name="include"></a><h4><a name="1-24"></a>include</h4>
<p><i> This tag is included for TQt 2.x beta backwards compatibility, and should not be used. Use <a href="designer-manual-16.html#1-11">includes</a> instead. </i></p>
<a name="variable"></a><h4><a name="1-25"></a>variable</h4>
<p><i> This tag is included for TQt 3.x beta backwards compatibility, and should not be used. Use <a href="designer-manual-16.html#1-21">variables</a> instead. </i></p>
<a name="datatype"></a><h3><a name="2"></a>Datatype Elements</h3>
<a name="color"></a><ul><li><p><tt>bool</tt> - a boolean value (0 or 1), e.g. <tt>&lt;bool&gt;1&lt;/bool&gt;</tt></p>
<li><p><tt>color</tt> - a color, e.g. <tt>&lt;color&gt;&lt;red&gt;192&lt;/red&gt;&lt;green&gt;0&lt;/green&gt;&lt;blue&gt;255&lt;/blue&gt;&lt;/color&gt;</tt></p>
<li><p><tt>cstring</tt> - a C string value (8-bit), e.g. <tt>&lt;cstring&gt;Some text&lt;/cstring&gt;</tt></p>
<li><p><tt>cursor</tt> - an integer which indicates the cursor type, e.g. <tt>&lt;cursor&gt;4&lt;/cursor&gt;</tt>. The valid integers for the cursor type are:</p>
<ul><li><p>0 - ArrowCursor</p>
<li><p>1 - UpArrowCursor</p>
<li><p>2 - CrossCursor</p>
<li><p>3 - WaitCursor</p>
<li><p>4 - IbeamCursor</p>
<li><p>5 - SizeVerCursor</p>
<li><p>6 - SizeHorCursor</p>
<li><p>7 - SizeBDiagCursor</p>
<li><p>8 - SizeFDiagCursor</p>
<li><p>9 - SizeAllCursor</p>
<li><p>10 - BlankCursor</p>
<li><p>11 - SplitVCursor</p>
<li><p>12 - SplitHCursor</p>
<li><p>13 - PointingHandCursor</p>
<li><p>14 - ForbiddenCursor</p>
</ul><li><p><tt>enum</tt> - an enum name, e.g. <tt>&lt;enum&gt;StrongFocus&lt;/enum&gt;</tt></p>
<li><p><tt>font</tt> - a font description, e.g.</p>
<pre>
&lt;font&gt;
&lt;family&gt;Helvetica&lt;/family&gt;
&lt;pointsize&gt;16&lt;/pointsize&gt;
&lt;weight&gt;50&lt;/weight&gt;
&lt;italic&gt;1&lt;/italic&gt;
&lt;underline&gt;0&lt;/underline&gt;
&lt;strikeout&gt;0&lt;/strikeout&gt;
&lt;/font&gt;
</pre>
<li><p><tt>iconset</tt> - an iconset (see <tt>pixmap</tt>), e.g. <tt>&lt;iconset&gt;filenew&lt;/iconset&gt;</tt></p>
<li><p><tt>number</tt> - an integer with an optional sign, e.g. <tt>&lt;number&gt;947&lt;/number&gt;</tt></p>
<li><p><tt>palette</tt> - a <a href="tqwidget.html#palette-prop">palette</a></p>
<li><p><tt>pixmap</tt> - a pixmap, normally the name or "key" of the pixmap; the name is used if pixmaps are stored in the project, the key is used if a user defined function is used to access the pixmap. It is also possible for pixmaps to be included inline. Example: <tt>&lt;pixmap&gt;chair&lt;/pixmap&gt;</tt></p>
<li><p><tt>point</tt> - a point, e.g. <tt>&lt;point&gt;&lt;x&gt;15&lt;/x&gt;&lt;y&gt;95&lt;/y&gt;&lt;/point&gt;</tt></p>
<li><p><tt>rect</tt> - a rectangle, e.g.</p>
<pre>
&lt;rect&gt;
&lt;x&gt;20&lt;/x&gt;
&lt;y&gt;35&lt;/y&gt;
&lt;width&gt;225&lt;/width&gt;
&lt;height&gt;45&lt;/height&gt;
&lt;/rect&gt;
</pre>
<li><p><tt>set</tt> - a list of names separated by |'s, e.g. <tt>&lt;set&gt;AlignLeft|AlignTop&lt;/set&gt;</tt></p>
<li><p><tt>size</tt> - a size, e.g. <tt>&lt;size&gt;&lt;width&gt;150&lt;/width&gt;&lt;height&gt;105&lt;/height&gt;&lt;/size&gt;</tt></p>
<li><p><tt>sizepolicy</tt> - an integer which indicates the size type, e.g. <tt>&lt;hsizetype&gt;5&lt;/hsizetype&gt;&lt;vsizetype&gt;4&lt;/vsizetype&gt;</tt>. The valid integers for the size type are:</p>
<ul><li><p>0 - Fixed</p>
<li><p>1 - Minimum</p>
<li><p>3 - MinimumExpanding</p>
<li><p>4 - Maximum</p>
<li><p>5 - Preferred</p>
<li><p>7 - Expanding</p>
</ul><li><p><tt>string</tt> - a Unicode string value (in UTF8), e.g. <tt>&lt;string&gt;Some text&lt;/string&gt;</tt></p>
</ul><h4><a name="2-1"></a>Complex Datatype Elements</h4>
<a name="palette"></a><h5><a name="2-1-1"></a>palette</h5>
<p>This element holds colors for user interface elements for each color group. For example:</p>
<pre>
&lt;palette&gt;
&lt;active&gt;
&lt;color&gt; ... Foreground ... &lt;/color&gt;
&lt;color&gt; ... Button ... &lt;/color&gt;
&lt;color&gt; ... Light ... &lt;/color&gt;
&lt;color&gt; ... Midlight ... &lt;/color&gt;
&lt;color&gt; ... Dark ... &lt;/color&gt;
&lt;color&gt; ... Mid ... &lt;/color&gt;
&lt;color&gt; ... Text ... &lt;/color&gt;
&lt;color&gt; ... BrightText ... &lt;/color&gt;
&lt;color&gt; ... ButtonText ... &lt;/color&gt;
&lt;color&gt; ... Base ... &lt;/color&gt;
&lt;color&gt; ... Background ... &lt;/color&gt;
&lt;color&gt; ... Shadow ... &lt;/color&gt;
&lt;color&gt; ... Highlight ... &lt;/color&gt;
&lt;color&gt; ... HighlightText ... &lt;/color&gt;
&lt;/active&gt;
&lt;disabled&gt;
&lt;color&gt;&lt;red&gt;128&lt;/red&gt;&lt;green&gt;128&lt;/green&gt;&lt;blue&gt;128&lt;/blue&gt;&lt;/color&gt;
...
&lt;color&gt;&lt;red&gt;255&lt;/red&gt;&lt;green&gt;255&lt;/green&gt;&lt;blue&gt;255&lt;/blue&gt;&lt;/color&gt;
&lt;/disabled&gt;
&lt;inactive&gt;
&lt;color&gt;&lt;red&gt;0&lt;/red&gt;&lt;green&gt;0&lt;/green&gt;&lt;blue&gt;0&lt;/blue&gt;&lt;/color&gt;
...
&lt;color&gt;&lt;red&gt;255&lt;/red&gt;&lt;green&gt;255&lt;/green&gt;&lt;blue&gt;255&lt;/blue&gt;&lt;/color&gt;
&lt;/inactive&gt;
&lt;/palette&gt;
</pre>
<p>See <a href="designer-manual-16.html#color">color</a> for the format of the <tt>&lt;color&gt;</tt> element.</p>
<!-- eof -->
<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>