This document describes the XML format which is used by the Qt Designer to describe dialogs and other widgets. The XML document has to start with <!DOCTYPE UI><UI>. After that some tags (header-tags) are following which store some general information. After that a <widget>....</widget> element is expected which describes the top-level widget. After that a pixmap collection tagged with <images>....</images> might follow. After that optionally sections which describe the Used Customwidgets, the Defined Connections and Slots and the Tab-Chain follows. The XML document has to be closed with </UI> then.
This tags describe some general information, all of them are optional.
This element describes a widget. Following child elements are defined:
This element describes a layout which arranges all childs from the left to the right. It has to be a child of a widget-element element. This widget is then normally a container widget (e.g. QGroupBox) or a temporary QLayoutWidget. Following child elements are defined:
This element describes a layout which arranges all childs from the top to the bottom. It has to be a child of a widget-element element. This widget is then normally a container widget (e.g. QGroupBox) or a temporary QLayoutWidget. Following child elements are defined:
This element describes a layout which arranges all childs in a grid (in cells). It can also contain childs which use multiple cells. It has to be a child of a widget-element which is normally a container widget or a temporary QLayoutWidget. Following child elements are defined:
Widget, and Spacer-Tags which are inside a grid have two attributes, which describe the position of this item in the grid. These attributes are row and col. Optionally these tags have one or both of the following attributes (if they are multicells): rowspan and colspan. If these attributes are not given, these values default to 1.
This element describes a property of a widget or a layout. Each property has as first child a name element which describes the name of the property (like <name>geometry</name>). After that there follows an element which contains the value of the property and describes the data type of it. Following types are defined:
Element-Name | Type | Value-Description | Example |
string | Any unicode string value (saved in utf8) | String | <string>A Text</string> |
cstring | Any c-string (8-bit) value | CString | <string>A Text</string> |
bool | Any bool value | Bool (1|0) | <bool>1</bool> |
number | Any signed numerical value | Integer | <number>-4</number> |
number | Any unsigned numerical value | Unsigned Integer | <number>1</number> |
enum | Enum Key | String | <enum>StrongFocus</enum> |
set | Set (or'd ints) | StringList joined with '|' | <set>AlignLeft|AlignTop|WordWrap</set> |
rect | Rectangles |
<x>Integer</x> <y>Integer</y> <width>Integer</width> <height>Integer</height> If you leave out one of the elements, the value of it defaults to zero (0) |
<rect> <x>20</x> <y>30</y> <width>200</width> <height>25</height> </rect> |
point | Points (Coordinates) |
<x>Integer</x> <y>Integer</y> If you leave out one of the elements, the value of it defaults to zero (0) |
<point> <x>20</x> <y>30</y> </point> |
size | Sizes |
<width>Integer</width> <height>Integer</height> If you leave out one of the elements, the value of it defaults to zero (0) |
<size> <width>200</width> <height>25</height> </size> |
font | Font Description |
<family>String</family> <pointsize>Integer</pointsize> <weight>Integer</weight> <italic>Boolean</italic> <underline>Boolean</underline> <strikeout>Boolean</strikeout> |
<font> <family>Times</family> <pointsize>12</pointsize> <weight>50</weight> <italic>1</italic> <underline>0</underline> <strikeout>0</strikeout> </font> |
color | Color Description |
<red>Integer</red> <green>Integer</green> <blue>Integer</blue> |
<color> <red>192</red> <green>200</green> <blue>50</blue> </color> |
pixmap/image/imageset | Pixmap |
Depending on whether images are saved inline or not (see header-tags) this tag looks different:
|
<pixmap>image1</pixmap> |
sizepolicy | SizePolicy (saved as int) |
<hsizetype>SizeType</hsizetype> <vsizetype>SizeType</vsizetype> SizeType is saved as int and can be one of |
<hsizetype>1</hsizetype> <vsizetype>3</vsizetype> |
palette | Palette |
<palette> <active> <color> rgb of Foreground </color> <color> rgb of Button </color> <color> rgb of Light </color> <color> rgb of Midlight </color> <color> rgb of Dark </color> <color> rgb of Mid </color> <color> rgb of Text </color> <color> rgb of BrightText </color> <color> rgb of ButtonText </color> <color> rgb of Base </color> <color> rgb of Background </color> <color> rgb of Shadow </color> <color> rgb of Highlight </color> <color> rgb of HighlightText </color> </active> <disabled> ColorGroup of disabled palette </disabled> <inactive> ColorGroup of inactive palette </inactive> </palette> |
<palette> <active> <color> <red>0</red> <green>0</green> <blue>0</blue> </color> <color> <red>170</red> <green>170</green> <blue>255</blue> </color> <color> <red>255</red> <green>255</green> <blue>255</blue> </color> <color> <red>212</red> <green>212</green> <blue>255</blue> </color> <color> <red>85</red> <green>85</green> <blue>127</blue> </color> <color> <red>113</red> <green>113</green> <blue>170</blue> </color> <color> <red>0</red> <green>0</green> <blue>0</blue> </color> <color> <red>255</red> <green>255</green> <blue>255</blue> </color> <color> <red>0</red> <green>0</green> <blue>0</blue> </color> <color> <red>255</red> <green>255</green> <blue>255</blue> </color> <color> <red>218</red> <green>218</green> <blue>218</blue> </color> <color> <red>0</red> <green>0</green> <blue>0</blue> </color> <color> <red>90</red> <green>36</green> <blue>0</blue> </color> <color> <red>255</red> <green>255</green> <blue>255</blue> </color> </active> ...... <disabled> </disabled> <inactive> ...... </inactive> </palette> |
cursor | Cursor saved as int |
<cursor>cursor</cursor> Following int values are defined for cursor:
|
<cursor>5</cursor> |
To find out the known properties of a widget look at the property table of that widget documentation in the Qt Class Documentation.
The attribute element describes an attribute of a widget-element. A widget may contain multiple attribute elements. The format of an attribute element is the same as the one of the property element, just that the name of the element is attribute. The only difference to a property is, that an attribute is not a property known by the widget and needs special treatment. Attributes of a widget are normally only interesting for the parent of the widget and not the widget itself. E.g. the title of a tab-page in a tabwidget is an attribute and not a property of the page widget.
These elements describe spacer items inside a layout (see QSpacerItem). The orientation property describes the orientation of the spacer (Horizontal or Vertical). The sizeType property describes the way this spacer item acts in the defined direction (vertical or horizontal). Although this is neither a QWidget nor a QObject in reality, there are properties defined for this item. These are:
The item element describes an item of a widget, if the widget can contain items (like listboxes, iconviews, etc.). The item element contains exactly one child element, which describes the item. This child element is a property element. The property names which are valid are text and pixmap depending on where to insert the item.
As Listviews can hold a tree of items, in this case a item tag can contain other item tags which are child items then. Also as listviews can have many columns, a item tag contais a text and pixmap property for each column. The columns of a listview are described using the column-tag.
The column element describes a columns of a listview widget. A listview can contain multiple column elements. A column element contains following properties (all of them are optional):
To decerase the file size, images are saved shared. This means each image gets a key which is used in the pixmap/image/iconset properties. Later in the image collection all this images are saved once. The images are written in either PNG or zipped XPM (XPM.GZ) where each caracter is converted to HEX code. The format is specified in the data tag using the format attribute. So the image collection looks like this:
<images>
<image>
<name>key</name>
<data format="PNG|XPM.GZ">PNG or XPM.GZ data in HEX</data>
</image>
</images>
A Dialog created by the Qt Designer can contain custom widgets. To be able to create code for that, some information about the used customwidgets has to be stored. This is done in the section which is encapsulated by the tags <customwidgets>...</customwidgets>. Inside that for each customwidget there is an entry encapsulated by <customwidget>...</customwidget>. Each of this customwidget entries has following child elements:
In the section which is encapsulated by <connections>...</connections> all connections between the widgets of this form are stored. For each connection there is an entry encapsulated by <connection>...</connection>. Inside this entry following elements are defined:
As it is possible to add custom slots to forms to which widgets can connect, these custom slots are defined in this section too. For each slots there exists a <slot>...</slot> element which has an attribute access which describes the access policy of this slot which can be public or protected.
The tab-chain of the form is defined in the section which is encapsulated by the elements <tabstops>...</tabstops>. Inside that there comes a element <tabstop>WidgetName</tabstop> for each widget of the form which can accept keyboard focus. The tabchain is set in the order in which these tabstop elements are stored.