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

« back to all changes in this revision

Viewing changes to doc/html/designer-connection-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: Editing Signals and Slots</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-using-containers.html" />
 
15
    <link rel="contents" href="designer-manual.html" />
 
16
    <link rel="next" href="designer-buddy-mode.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-using-containers.html">Using Containers in Qt Designer</a>]
 
25
[<a href="designer-manual.html">Contents</a>]
 
26
[Next: <a href="designer-buddy-mode.html">Qt Designer's Buddy Editing Mode</a>]
 
27
</p>
 
28
<h1 align="center">Editing Signals and Slots</h1>
 
29
<center><img src="images/designer-connection-mode.png" /></center><p><i>Qt Designer</i>'s connection editing mode allows objects in a form to be connected together using Qt's signals and slots mechanism. Both widgets and layout objects can be connected via an intuitive connection interface, and <i>Qt Designer</i> will present a menu of compatible signals and slots to use for each connection made. When the form is saved, the connections are preserved so that they will be ready for use when your project is built.</p>
 
30
<ul><li><a href="#connecting-objects">Connecting Objects</a></li>
 
31
<li><a href="#editing-and-deleting-connections">Editing and Deleting Connections</a></li>
 
32
</ul>
 
33
<a name="connectingobjects"></a><a name="connecting-objects"></a>
 
34
<h2>Connecting Objects</h2>
 
35
<p>To begin connecting objects, enter connection mode by opening the <b>Edit</b> menu and selecting <b>Edit Signals/Slots</b>, or by pressing the <b>F4</b> key. All widgets and layout objects on the form can be connected together. Spacers just provide spacing hints to layouts, so they cannot be connected to other objects.</p>
 
36
<a name="highlightedobjects"></a><table align="center" cellpadding="2" cellspacing="1" border="0">
 
37
<tr valign="top" bgcolor="#f0f0f0"><td><img src="images/designer-connection-highlight.png" /></td><td><b>Highlighted objects</b><p>When the cursor is over an object that can be used in a connection, the object will be highlighted, and can be connected to other objects on the form.</p>
 
38
</td></tr>
 
39
</table>
 
40
<p>To make a connection, hold down the left mouse button over a highlighted object, and drag the cursor towards the object you want to connect it to. As you do this, a line will extend from the source object to the cursor. If the cursor is over another object on the form, the line will end with an arrow head that points to the destination object, indicating that a connection will be made between the two objects when you release the mouse button.</p>
 
41
<p>You can abandon the connection at any point while you are dragging the connection path by pressing <b>Escape</b>.</p>
 
42
<a name="makingaconnection"></a><table align="center" cellpadding="2" cellspacing="1" border="0">
 
43
<tr valign="top" bgcolor="#f0f0f0"><td><img src="images/designer-connection-making.png" /></td><td><b>Making a connection</b><p>The connection path changes shape as the cursor moves around the form. As it passes over objects, they are highlighted, indicating that they can be used in a signals and slots connection.</p>
 
44
</td></tr>
 
45
</table>
 
46
<p>When you are satisfied that the correct objects will be connected, release the mouse button to make the connection. A dialog displays the signals from the source object and the slots from the destination object that can be used to connect the two objects.</p>
 
47
<p>To complete the connection, select a signal from the source object and a slot from the destination object, then click the <b>OK</b> button. Click <b>Cancel</b> if you wish to abandon the connection.</p>
 
48
<a name="choosingsignalsandslots"></a><table align="center" cellpadding="2" cellspacing="1" border="0">
 
49
<tr valign="top" bgcolor="#f0f0f0"><td><img src="images/designer-connection-dialog.png" /></td><td><b>Choosing signals and slots</b><p>The <b>Configure Connection</b> dialog presents the signals that can be emitted by the source object alongside a list of compatible slots in the destination object. When you select a signal, the dialog automatically updates the list of compatible slots to ensure that a valid connection is made.</p>
 
50
<p>If the <b>Show all signals and slots</b> checkbox is selected, all available signals from the source object are shown. The list of available slots in the destination object is updated to show all the slots that are compatible with the currently selected signal.</p>
 
51
</td></tr>
 
52
</table>
 
53
<p>You can make as many connections as you like between objects on the form, and it is possible to connect signals from objects to slots in the form itself. As a result, the signal and slot connections in many dialogs can be completely configured from within <i>Qt Designer</i>.</p>
 
54
<a name="connectingtotheform"></a><table align="center" cellpadding="2" cellspacing="1" border="0">
 
55
<tr valign="top" bgcolor="#f0f0f0"><td><img src="images/designer-connection-to-form.png" /></td><td><b>Connecting to a form</b><p>Connections can be made between objects on the form and the form itself. Instead of dragging a connection path to another object, position the cursor over the form and release the mouse button.</p>
 
56
<p>To make it clear that the connection will be made with the form itself, the end point of the connection changes to an electrical &quot;ground&quot; symbol.</p>
 
57
</td></tr>
 
58
</table>
 
59
<a name="editingconnections"></a><a name="editing-and-deleting-connections"></a>
 
60
<h2>Editing and Deleting Connections</h2>
 
61
<p>By default, connection paths are created with two labels that show the signal and slot involved in the connection. These labels are usually oriented along the line of the connection, and they can be moved around inside their host widgets by dragging the red square at each end of the connection path.</p>
 
62
<p>The signal and slot used in a connection can be changed after it has been set up. To do this, simply double click on the connection path or one of its labels, and select the signal and slot to be used in the connection dialog.</p>
 
63
<a name="deletingconnections"></a><table align="center" cellpadding="2" cellspacing="1" border="0">
 
64
<tr valign="top" bgcolor="#f0f0f0"><td><img src="images/designer-connection-editing.png" /></td><td><b>Deleting connections</b><p>The whole connection can be selected by clicking on any of the path segments. Once selected, connections can be deleted with the <b>Delete</b> key, and they will not be set up in the .ui file.</p>
 
65
</td></tr>
 
66
</table>
 
67
<p>
 
68
[Previous: <a href="designer-using-containers.html">Using Containers in Qt Designer</a>]
 
69
[<a href="designer-manual.html">Contents</a>]
 
70
[Next: <a href="designer-buddy-mode.html">Qt Designer's Buddy Editing Mode</a>]
 
71
</p>
 
72
<p /><address><hr /><div align="center">
 
73
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
74
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
75
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
76
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
77
</tr></table></div></address></body>
 
78
</html>