~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/designer-editing-mode.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/doc/src/designer-manual.qdoc -->
 
6
<head>
 
7
    <title>Qt 4.0: Qt Designer's Form Editing Mode</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
    <link rel="prev" href="designer-designing-a-component.html" />
 
15
    <link rel="contents" href="designer-manual.html" />
 
16
    <link rel="next" href="designer-using-containers.html" />
 
17
</head>
 
18
<body>
 
19
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
20
<tr>
 
21
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
22
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
23
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><p>
 
24
[Previous: <a href="designer-designing-a-component.html">Designing a Component with Qt Designer</a>]
 
25
[<a href="designer-manual.html">Contents</a>]
 
26
[Next: <a href="designer-using-containers.html">Using Containers in Qt Designer</a>]
 
27
</p>
 
28
<h1 align="center">Qt Designer's Form Editing Mode</h1>
 
29
<center><img src="images/designer-editing-mode.png" /></center><p>In <i>Qt Designer</i>'s form editing mode, objects can be dragged from the main window's toolbox to a form, edited, resized, dragged around on the form, and even dragged between forms. Their properties can be modified interactively, so that changes can be seen immediately. The editing interface is intuitive for simple operations, yet still supports Qt's powerful layout facilities.</p>
 
30
<ul><li><a href="#managing-forms">Managing Forms</a></li>
 
31
<li><a href="#editing-a-form">Editing a Form</a></li>
 
32
<li><a href="#the-property-editor">The Property Editor</a></li>
 
33
<li><a href="#the-object-inspector">The Object Inspector</a></li>
 
34
<li><a href="#layouts">Layouts</a></li>
 
35
<ul><li><a href="#applying-and-breaking-layouts">Applying and Breaking Layouts</a></li>
 
36
<li><a href="#horizontal-and-vertical-layouts">Horizontal and Vertical Layouts</a></li>
 
37
<li><a href="#the-grid-layout">The Grid Layout</a></li>
 
38
</ul>
 
39
<li><a href="#previewing-forms">Previewing Forms</a></li>
 
40
</ul>
 
41
<a name="managingforms"></a><a name="managing-forms"></a>
 
42
<h2>Managing Forms</h2>
 
43
<p><i>Qt Designer</i> allows you to create and edit new forms (open the <b>File</b> menu and select <b>New Form...</b> or press <b>Ctrl N</b>). Existing forms can also be edited (open the <b>File</b> menu and select <b>Open Form...</b> or press <b>Ctrl O</b>).</p>
 
44
<p>At any point, it is possible to save a form by selecting the <b>Save Form As...</b> option from the <b>File</b> menu. The .ui files saved by <i>Qt Designer</i> contain information about the objects used, and record the details of any signal and slot connections between them.</p>
 
45
<a name="editingaform"></a><a name="editing-a-form"></a>
 
46
<h2>Editing a Form</h2>
 
47
<p>By default, new forms are opened in editing mode. If <i>Qt Designer</i> is in another mode, you can enter editing mode by opening the <b>Edit</b> menu and selecting <b>Edit Widgets</b>, or by pressing the <b>F3</b> key.</p>
 
48
<p>Objects are added to the form by dragging them from the main toolbox and dropping them in the desired location on the form. Once there, they can be moved around simply by dragging them. Objects can be selected by clicking on them using the left mouse button.</p>
 
49
<p>The toolbox contains objects in a number of different categories, all of which can be simply placed on the form as required. The only objects that require a little more preparation are the <i>Container</i> widgets. These are described in more detail in the chapter on <a href="designer-using-containers.html">Using Containers</a>.</p>
 
50
<a name="selectingobjects"></a><table align="center" cellpadding="2" cellspacing="1" border="0">
 
51
<tr valign="top" bgcolor="#f0f0f0"><td><img src="images/designer-selecting-widget.png" /></td><td><b>Selecting objects</b><p>Objects on the form are selected by clicking on them with the left mouse button. When an object is selected, resize handles are shown at each corner and at the midpoint of each side, indicating that it can be resized.</p>
 
52
<p>If more than one object is selected, the current object will be displayed with resize handles that are colored differently to the others.</p>
 
53
</td></tr>
 
54
</table>
 
55
<p>When selected, the normal clipboard operations can be performed on a widget to cut, copy, and paste it. All of these operations are recorded in an undo buffer to enable changes to be undone and redone as necessary. The shortcuts used to perform all of these actions are described in the table below.</p>
 
56
<a name="shortcutsforediting"></a><table align="center" cellpadding="2" cellspacing="1" border="0">
 
57
<tr valign="top" bgcolor="#a2c511"><th>Action</th><th>Shortcut</th><th>Description</th></tr>
 
58
<tr valign="top" bgcolor="#f0f0f0"><td>Cut</td><td><b>Ctrl+X</b></td><td>Cuts the selected objects to the clipboard.</td></tr>
 
59
<tr valign="top" bgcolor="#e0e0e0"><td>Copy</td><td><b>Ctrl+C</b></td><td>Copies the selected objects to the clipboard.</td></tr>
 
60
<tr valign="top" bgcolor="#f0f0f0"><td>Paste</td><td><b>Ctrl+V</b></td><td>Pastes the objects in the clipboard onto the form.</td></tr>
 
61
<tr valign="top" bgcolor="#e0e0e0"><td>Delete</td><td><b>Delete</b></td><td>Deletes the selected objects.</td></tr>
 
62
<tr valign="top" bgcolor="#f0f0f0"><td>Clone object</td><td><b>Ctrl+drag</b> (left mouse button)</td><td>Makes a copy of the selected object or group of objects.</td></tr>
 
63
<tr valign="top" bgcolor="#e0e0e0"><td>Preview</td><td><b>Ctrl+R</b></td><td>Shows a preview of the form.</td></tr>
 
64
</table>
 
65
<p>All the above actions (apart from cloning) can be accessed via both the <b>Edit</b> and the form's context menu. These menus also provide a <b>Select All</b> function to select all the objects on the form. They also provide functions for laying out objects.</p>
 
66
<p>Widgets are not unique objects; you can make as many copies of them as you need. To quickly duplicate a widget, you can clone it by holding down the <b>Ctrl</b> key and dragging it. This allows widgets to be copied and placed on the form much more quickly than with clipboard operations.</p>
 
67
<a name="draganddrop"></a><table align="center" cellpadding="2" cellspacing="1" border="0">
 
68
<tr valign="top" bgcolor="#f0f0f0"><td><img src="images/designer-dragging-onto-form.png" /></td><td><b>Drag and drop</b><p><i>Qt Designer</i> makes extensive use of the drag and drop facilities provided by Qt. Widgets can be dragged from the toolbox and dropped onto the form.</p>
 
69
<p>Widgets can also be &quot;cloned&quot; on the form: Holding down <b>Ctrl</b> and dragging the widget creates a copy of the widget that can be dragged to a new position.</p>
 
70
</td></tr>
 
71
</table>
 
72
<p><i>Qt Designer</i> allows selections of objects to be copied, pasted, and dragged between forms. You can use this feature to create more than one copy of the same form, and experiment with different layouts in each of them.</p>
 
73
<a name="thepropertyeditor"></a><a name="the-property-editor"></a>
 
74
<h2>The Property Editor</h2>
 
75
<p>The Property Editor always displays the properties of the currently selected object on the form. The properties available depend on the object being edited, but all of the widgets provided have common properties such as <tt>objectName</tt> (the object's internal name) and <tt>enabled</tt> (whether it can be interacted with).</p>
 
76
<a name="editingproperties"></a><table align="center" cellpadding="2" cellspacing="1" border="0">
 
77
<tr valign="top" bgcolor="#f0f0f0"><td><img src="images/designer-property-editor.png" /></td><td><b>Editing properties</b><p>The Property Editor uses standard Qt input widgets to manage the properties of objects on the form. Textual properties are shown in line edits, integer properties are displayed in spinboxes, and compound properties such as colors and sizes are presented in drop-down lists of input widgets.</p>
 
78
</td></tr>
 
79
</table>
 
80
<a name="the-object-inspector"></a>
 
81
<h2>The Object Inspector</h2>
 
82
<p>The Object Inspector shows an up-to-date hierarchical list of the objects (widgets, layouts, spacers, and other objects) on the form that is currently being edited.</p>
 
83
<a name="theobjectinspector"></a><table align="center" cellpadding="2" cellspacing="1" border="0">
 
84
<tr valign="top" bgcolor="#f0f0f0"><td><img src="images/designer-object-inspector.png" /></td><td><b>Editing properties</b><p>The Object Inspector displays a hierarchical list of all the objects on the form that is currently being edited. To show the child objects of a container widget or a layout, click the &quot;+&quot; handle next to the object label.</p>
 
85
<p>Each object on a form can be selected by double clicking on the corresponding item in the Object Inspector. This feature can be useful if you have many overlapping objects.</p>
 
86
</td></tr>
 
87
</table>
 
88
<a name="layouts"></a><a name="layouts"></a>
 
89
<h2>Layouts</h2>
 
90
<p>Before the form can be used the objects on the form need to be placed into layouts, this ensures that they will be displayed properly when the form is previewed or deployed in an application. Placing objects in a layout also ensures that they will be resized correctly when the form is resized.</p>
 
91
<a name="applying-and-breaking-layouts"></a>
 
92
<h3>Applying and Breaking Layouts</h3>
 
93
<p>The simplest way to manage objects is to apply a layout to a group of existing objects. This is achieved by selecting the objects that you need to manage and applying one of the standard layouts from the main toolbar, the <b>Edit</b> menu, or the form's context menu.</p>
 
94
<p>Once widgets have been inserted into a layout, it is not possible to move and resize them individually because the layout itself controls the geometry of each widget within it, taking account of the hints provided by spacers. Instead, you must either break the layout (<b>Ctrl+B</b> or <b>Break Layout</b>) and adjust each object's geometry manually, or you can influence the widget's geometry by resizing the layout. You can also add and remove spacers from the layout to influence the geometries of the widgets.</p>
 
95
<a name="insertingobjectsintoalayout"></a><table align="center" cellpadding="2" cellspacing="1" border="0">
 
96
<tr valign="top" bgcolor="#f0f0f0"><td><img src="images/designer-layout-inserting.png" /></td><td><b>Inserting objects into a layout</b><p>Objects can be inserted into an existing layout by dragging them from their current positions and dropping them at the required location. A blue cursor is displayed in the layout as an object is dragged over it to indicate where the object will be added.</p>
 
97
</td></tr>
 
98
</table>
 
99
<p>The form's top level layout can be set by clearing the selection (click the left mouse button on the form itself) and applying a layout.</p>
 
100
<a name="hoizontalandverticallayouts"></a><a name="horizontal-and-vertical-layouts"></a>
 
101
<h3>Horizontal and Vertical Layouts</h3>
 
102
<p>The simplest way to arrange objects on a form is to place them in a horizontal or vertical layout. For example, the dialog shown at the beginning of this chapter contains two push buttons and a spacer that can be placed in a horizontal layout; this makes sure that the buttons remain next to each other when more layouts are added to the dialog. In the same way, vertical layouts ensure that each of the widgets within are aligned horizontally.</p>
 
103
<p>Horizontal and vertical layouts can be combined, and nested to any depth. However, if you need more control over the placement of objects, you should consider using the grid layout.</p>
 
104
<a name="thegridlayout"></a><a name="the-grid-layout"></a>
 
105
<h3>The Grid Layout</h3>
 
106
<p>Complex form layouts can be created by placed objects in a grid layout. This kind of layout gives the form designer much more freedom to arrange widgets on the form, but can result in a much less flexible layout. However, for some kinds of form layout, a grid arrangement is much more suitable than a nested arrangement of horizontal and vertical layouts.</p>
 
107
<a name="previewingforms"></a><a name="previewing-forms"></a>
 
108
<h2>Previewing Forms</h2>
 
109
<p>Although <i>Qt Designer</i>'s forms are accurate representations of the components being edited, it is useful to preview the final appearance while editing. This feature can be activated by opening the <b>Form</b> menu and selecting <b>Preview</b>, or by pressing <b>Ctrl+R</b> when in the form.</p>
 
110
<center><img src="images/designer-dialog-preview.png" /></center><p>The preview shows exactly what the final component will look like when used in an application.</p>
 
111
<p>
 
112
[Previous: <a href="designer-designing-a-component.html">Designing a Component with Qt Designer</a>]
 
113
[<a href="designer-manual.html">Contents</a>]
 
114
[Next: <a href="designer-using-containers.html">Using Containers in Qt Designer</a>]
 
115
</p>
 
116
<p /><address><hr /><div align="center">
 
117
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
118
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
119
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
120
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
121
</tr></table></div></address></body>
 
122
</html>