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.
520 lines
30 KiB
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 Classes</font></a>
|
|
| <a href="mainclasses.html">
|
|
<font color="#004faf">Main Classes</font></a>
|
|
| <a href="annotated.html">
|
|
<font color="#004faf">Annotated</font></a>
|
|
| <a href="groups.html">
|
|
<font color="#004faf">Grouped 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/ntqwidgetfactory.h</tt> and <tt>uilib/qwidgetfactory.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>
|
|
<!DOCTYPE UI>
|
|
</pre>
|
|
<p>The root element is a "UI", which encloses the entire contents:</p>
|
|
<pre>
|
|
<UI version="3.1" stdsetdef="1">
|
|
...
|
|
</UI>
|
|
</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>
|
|
<actions>
|
|
<action>
|
|
<property name="name">
|
|
<cstring>fileNewAction</cstring>
|
|
</property>
|
|
<property name="iconSet">
|
|
<iconset>filenew</iconset>
|
|
</property>
|
|
<property name="text">
|
|
<string>New</string>
|
|
</property>
|
|
<property name="menuText">
|
|
<string>&amp;New</string>
|
|
</property>
|
|
</action>
|
|
...
|
|
</actions>
|
|
</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>
|
|
<author>Barney Rubble</author>
|
|
</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>
|
|
<class>InsuranceForm</class>
|
|
</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>
|
|
<comment>*********************************************************************
|
|
** 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.
|
|
**
|
|
*********************************************************************</comment>
|
|
</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>
|
|
<connections>
|
|
...
|
|
<connection language="C++">
|
|
<sender>alignActionGroup</sender>
|
|
<signal>selected(TQAction*)</signal>
|
|
<receiver>EditorForm</receiver>
|
|
<slot>changeAlignment(TQAction*)</slot>
|
|
</connection>
|
|
...
|
|
</connections>
|
|
</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><customwidget></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>
|
|
<customwidgets>
|
|
<customwidget>
|
|
<class>StyledButton</class>
|
|
<header location="local">styledbutton.h</header>
|
|
<sizehint>
|
|
<width>40</width>
|
|
<height>25</height>
|
|
</sizehint>
|
|
<container>0</container>
|
|
<sizepolicy>
|
|
<hordata>5</hordata>
|
|
<verdata>5</verdata>
|
|
</sizepolicy>
|
|
<pixmap>image0</pixmap>
|
|
<signal>clicked()</signal>
|
|
<signal>changed()</signal>
|
|
<property type="Color">color</property>
|
|
<property type="Pixmap">pixmap</property>
|
|
<property type="Bool">scale</property>
|
|
</customwidget>
|
|
</customwidgets>
|
|
</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><exportmacro></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>
|
|
<exportmacro>EDITOR_EXPORT</exportmacro>
|
|
</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>
|
|
<forwards>
|
|
<forward>class TQStringList;</forward>
|
|
</forwards>
|
|
</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>
|
|
<functions>
|
|
<function access="private" specifier="non virtual">isValid()</function>
|
|
<function access="public" returnType="TQString">getMessage()</function>
|
|
</functions>
|
|
</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><image></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>
|
|
<images>
|
|
<image name="image0">
|
|
<data format="XPM.GZ" length="409">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c6b53006ab440370316528264b4c198450c5808a94d1ed00aac214832b43124b544ec414d34b4c4c441103f11341120831309758313d0cf3b0840b7258d55a73010092c14eca</data>
|
|
</image>
|
|
</images>
|
|
</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><include></tt> tags for a <tt>.ui</tt>'s <tt>.ui.h</tt> file.</p>
|
|
<pre>
|
|
<includes>
|
|
<include location="local" impldecl="in implementation">pixmapcollection.h</include>
|
|
<include location="local" impldecl="in implementation">pixmapchooser.h</include>
|
|
<include location="local" impldecl="in implementation">project.h</include>
|
|
<include location="global" impldecl="in implementation">ntqfileinfo.h</include>
|
|
<include location="global" impldecl="in implementation">ntqimage.h</include>
|
|
<include location="global" impldecl="in declaration">ntqpixmap.h</include>
|
|
<include location="local" impldecl="in implementation">pixmapcollectioneditor.ui.h</include>
|
|
</includes>
|
|
</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>
|
|
<layoutdefaults spacing="6" margin="11"/>
|
|
</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>
|
|
<layoutfunctions spacing="LayoutClass::spacing" margin="LayoutClass::margin"/>
|
|
</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>
|
|
<menubar>
|
|
<property name="name">
|
|
<cstring>menubar</cstring>
|
|
</property>
|
|
<item text="&amp;File" name="PopupMenu">
|
|
<action name="fileSaveAction"/>
|
|
<separator/>
|
|
<action name="fileExitAction"/>
|
|
</item>
|
|
<item text="&amp;Help" name="PopupMenu_2">
|
|
<action name="helpAboutAction"/>
|
|
<action name="helpAboutTQtAction"/>
|
|
</item>
|
|
</menubar>
|
|
</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><pixmapfunction></tt> tag is used.</p>
|
|
<pre>
|
|
<pixmapfunction>splashScreen</pixmapfunction>
|
|
</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><pixmapinproject></tt> tag.</p>
|
|
<pre>
|
|
<pixmapinproject/>
|
|
</pre>
|
|
<a name="signals"></a><h4><a name="1-17"></a>signals</h4>
|
|
<p>All the signals are listed Within a <tt><signals></tt> tag.</p>
|
|
<pre>
|
|
<signals>
|
|
<signal>somethingChanged()</signal>
|
|
</signals>
|
|
</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>
|
|
<slots>
|
|
<slot access="public" specifier="virtual" language="C++"
|
|
returnType="void">changeAlignment(TQAction* align)</slot>
|
|
</slots>
|
|
</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><tabstops></tt> tag contains a list of tabstops, in order, each of which holds the name of a widget.</p>
|
|
<pre>
|
|
<tabstops>
|
|
<tabstop>templateView</tabstop>
|
|
<tabstop>helpButton</tabstop>
|
|
<tabstop>buttonOk</tabstop>
|
|
<tabstop>buttonCancel</tabstop>
|
|
</tabstops>
|
|
</pre>
|
|
<a name="toolbars"></a><h4><a name="1-20"></a>toolbars</h4>
|
|
<p>Forms that have toolbars (dock windows) use the <tt><toolbars></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><toolbar></tt> tag includes appropriate <tt><widget></tt> tags which give the class, name and any non-default property values for the relevant widget.</p>
|
|
<pre>
|
|
<toolbars>
|
|
<toolbar dock="2">
|
|
<property name="name">
|
|
<cstring>toolBar</cstring>
|
|
</property>
|
|
<property name="label">
|
|
<string>Tools</string>
|
|
</property>
|
|
<action name="fileNewAction"/>
|
|
<action name="fileOpenAction"/>
|
|
<action name="fileSaveAction"/>
|
|
<separator/>
|
|
<action name="editUndoAction"/>
|
|
<action name="editRedoAction"/>
|
|
<action name="editCutAction"/>
|
|
<action name="editCopyAction"/>
|
|
<action name="editPasteAction"/>
|
|
</toolbar>
|
|
<toolbar dock="2">
|
|
<property name="name">
|
|
<cstring>Toolbar</cstring>
|
|
</property>
|
|
<property name="label">
|
|
<string>Toolbar</string>
|
|
</property>
|
|
<action name="leftAlignAction"/>
|
|
<action name="centerAlignAction"/>
|
|
<action name="rightAlignAction"/>
|
|
<separator/>
|
|
<action name="boldAction"/>
|
|
<action name="italicAction"/>
|
|
<action name="underlineAction"/>
|
|
<separator/>
|
|
<widget class="TQComboBox">
|
|
<property name="name">
|
|
<cstring>fontComboBox</cstring>
|
|
</property>
|
|
</widget>
|
|
<widget class="TQSpinBox">
|
|
<property name="name">
|
|
<cstring>SpinBox2</cstring>
|
|
</property>
|
|
<property name="minValue">
|
|
<number>6</number>
|
|
</property>
|
|
<property name="value">
|
|
<number>10</number>
|
|
</property>
|
|
</widget>
|
|
</toolbar>
|
|
</toolbars>
|
|
</pre>
|
|
<a name="variables"></a><h4><a name="1-21"></a>variables</h4>
|
|
<p>Module variables are held in the <tt><variables></tt> tag. Variable type names often include < and >, 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>
|
|
<variables>
|
|
<variable access="private">SettingsDialog * settings;</variable>
|
|
<variable>TQMap&lt;int, TQString&gt; bookmarks;</variable>
|
|
<variable>HelpWindow *browser;</variable>
|
|
<variable>HelpDialog *helpDock;</variable>
|
|
<variable>TQGuardedPtr&lt;FindDialog&gt; findDialog;</variable>
|
|
<variable>static TQPtrList&lt;MainWindow&gt; *windows;</variable>
|
|
</variables>
|
|
</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="ntqwidget.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>
|
|
<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
|
|
<class>WinIntroPage</class>
|
|
<widget class="TQWidget">
|
|
<property name="name">
|
|
<cstring>WinIntroPage</cstring>
|
|
</property>
|
|
<property name="geometry">
|
|
<rect>
|
|
<x>0</x>
|
|
<y>0</y>
|
|
<width>387</width>
|
|
<height>228</height>
|
|
</rect>
|
|
</property>
|
|
<property name="caption">
|
|
<string>Form1</string>
|
|
</property>
|
|
<hbox>
|
|
<property name="name">
|
|
<cstring>unnamed</cstring>
|
|
</property>
|
|
<property name="margin">
|
|
<number>11</number>
|
|
</property>
|
|
<property name="spacing">
|
|
<number>6</number>
|
|
</property>
|
|
<widget class="TQTextBrowser">
|
|
<property name="name">
|
|
<cstring>TextBrowser1</cstring>
|
|
</property>
|
|
<property name="text">
|
|
<string>This program installs TQt.</string>
|
|
</property>
|
|
</widget>
|
|
</hbox>
|
|
</widget>
|
|
<layoutdefaults spacing="6" margin="11"/>
|
|
</UI>
|
|
</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><bool>1</bool></tt></p>
|
|
<li><p><tt>color</tt> - a color, e.g. <tt><color><red>192</red><green>0</green><blue>255</blue></color></tt></p>
|
|
<li><p><tt>cstring</tt> - a C string value (8-bit), e.g. <tt><cstring>Some text</cstring></tt></p>
|
|
<li><p><tt>cursor</tt> - an integer which indicates the cursor type, e.g. <tt><cursor>4</cursor></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><enum>StrongFocus</enum></tt></p>
|
|
<li><p><tt>font</tt> - a font description, e.g.</p>
|
|
<pre>
|
|
<font>
|
|
<family>Helvetica</family>
|
|
<pointsize>16</pointsize>
|
|
<weight>50</weight>
|
|
<italic>1</italic>
|
|
<underline>0</underline>
|
|
<strikeout>0</strikeout>
|
|
</font>
|
|
</pre>
|
|
<li><p><tt>iconset</tt> - an iconset (see <tt>pixmap</tt>), e.g. <tt><iconset>filenew</iconset></tt></p>
|
|
<li><p><tt>number</tt> - an integer with an optional sign, e.g. <tt><number>947</number></tt></p>
|
|
<li><p><tt>palette</tt> - a <a href="ntqwidget.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><pixmap>chair</pixmap></tt></p>
|
|
<li><p><tt>point</tt> - a point, e.g. <tt><point><x>15</x><y>95</y></point></tt></p>
|
|
<li><p><tt>rect</tt> - a rectangle, e.g.</p>
|
|
<pre>
|
|
<rect>
|
|
<x>20</x>
|
|
<y>35</y>
|
|
<width>225</width>
|
|
<height>45</height>
|
|
</rect>
|
|
</pre>
|
|
<li><p><tt>set</tt> - a list of names separated by |'s, e.g. <tt><set>AlignLeft|AlignTop</set></tt></p>
|
|
<li><p><tt>size</tt> - a size, e.g. <tt><size><width>150</width><height>105</height></size></tt></p>
|
|
<li><p><tt>sizepolicy</tt> - an integer which indicates the size type, e.g. <tt><hsizetype>5</hsizetype><vsizetype>4</vsizetype></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><string>Some text</string></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>
|
|
<palette>
|
|
<active>
|
|
<color> ... Foreground ... </color>
|
|
<color> ... Button ... </color>
|
|
<color> ... Light ... </color>
|
|
<color> ... Midlight ... </color>
|
|
<color> ... Dark ... </color>
|
|
<color> ... Mid ... </color>
|
|
<color> ... Text ... </color>
|
|
<color> ... BrightText ... </color>
|
|
<color> ... ButtonText ... </color>
|
|
<color> ... Base ... </color>
|
|
<color> ... Background ... </color>
|
|
<color> ... Shadow ... </color>
|
|
<color> ... Highlight ... </color>
|
|
<color> ... HighlightText ... </color>
|
|
</active>
|
|
<disabled>
|
|
<color><red>128</red><green>128</green><blue>128</blue></color>
|
|
...
|
|
<color><red>255</red><green>255</green><blue>255</blue></color>
|
|
</disabled>
|
|
<inactive>
|
|
<color><red>0</red><green>0</green><blue>0</blue></color>
|
|
...
|
|
<color><red>255</red><green>255</green><blue>255</blue></color>
|
|
</inactive>
|
|
</palette>
|
|
</pre>
|
|
<p>See <a href="designer-manual-16.html#color">color</a> for the format of the <tt><color></tt> element.</p>
|
|
<!-- eof -->
|
|
<p><address><hr><div align=center>
|
|
<table width=100% cellspacing=0 border=0><tr>
|
|
<td>Copyright © 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>
|