source: trunk/doc/html/metaobjects.html

Last change on this file was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 4.4 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/doc/metaobjects.doc:36 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>Meta Object System</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>Meta Object System</h1>
33
34
35
36<p> <!-- index meta object --><a name="meta-object"></a><!-- index Q_OBJECT --><a name="Q_OBJECT"></a>
37<p> Qt's Meta Object System provides the signals and slots mechanism for
38inter-object communication, runtime type information, and the dynamic
39property system.
40<p> The Meta Object System is based on three things:
41<ol type=1>
42<li> the <a href="qobject.html">QObject</a> class;
43<li> the Q_OBJECT macro inside the private section of the class
44declaration;
45<li> the <a href="moc.html">Meta Object Compiler (moc)</a>.
46</ol>
47<p> The <em><a href="moc.html#moc">moc</a></em> reads a C++ source file. If it finds one or more class
48declarations that contain the Q_OBJECT macro, it produces another C++
49source file which contains the meta object code for the classes that
50contain the Q_OBJECT macro. This generated source file is either
51#included into the class's source file or compiled and linked with the
52class's implementation.
53<p> In addition to providing the <a href="signalsandslots.html">signals and
54slots</a> mechanism for communication between objects (the main
55reason for introducing the system), the meta object code provides
56additional features in QObject:
57<p> <ul>
58<p> <li> the <a href="qobject.html#className">className()</a> function that
59returns the class name as a string at runtime, without requiring
60native runtime type information (RTTI) support through the C++
61compiler.
62<p> <li> the <a href="qobject.html#inherits">inherits()</a> function that
63returns whether an object is an instance of a class that inherits a
64specified class within the <a href="qobject.html">QObject</a> inheritance tree.
65<p> <li> the <a href="qobject.html#tr">tr()</a> and
66<a href="qobject.html#trUtf8">trUtf8()</a> functions for string
67translation as used for <a href="i18n.html#internationalization">internationalization</a>.
68<p> <li> the <a href="qobject.html#setProperty">setProperty()</a> and <a href="qobject.html#property">property()</a> functions for dynamically
69setting and getting <a href="properties.html">object properties</a> by
70name.
71<p> <li> the <a href="qobject.html#metaObject">metaObject()</a> function that
72returns the associated <a href="qmetaobject.html">meta object</a> for the
73class.
74<p> </ul>
75<p> While it is possible to use QObject as a base class without the
76Q_OBJECT macro and without meta object code, neither signals and slots
77nor the other features described here will be available if the
78Q_OBJECT macro is not used. From the meta object system's point of
79view, a QObject subclass without meta code is equivalent to its
80closest ancestor with meta object code. This means for example, that
81className() will not return the actual name of your class, but the
82class name of this ancestor. We <em>strongly</em> recommend that all
83subclasses of <a href="qobject.html">QObject</a> use the Q_OBJECT macro regardless of whether
84they actually use signals, slots and properties or not.
85<p>
86<!-- eof -->
87<p><address><hr><div align=center>
88<table width=100% cellspacing=0 border=0><tr>
89<td>Copyright &copy; 2007
90<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
91<td align=right><div align=right>Qt 3.3.8</div>
92</table></div></address></body>
93</html>
Note: See TracBrowser for help on using the repository browser.