Sophie

Sophie

distrib > * > 2009.0 > i586 > by-pkgid > a6711891ce757817bba854bf3f25205a > files > 1849

qtjambi-doc-4.3.3-3mdv2008.1.i586.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /home/gvatteka/dev/qt-4.3/doc/src/objecttrees.qdoc -->
<head>
  <title>Object Trees and Object Ownership</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 align="center">Object Trees and Object Ownership<br /><small></small></h1>
<p><a href="core/QObject.html">QObjects</a> organize themselves in object trees. When you create a <a href="core/QObject.html"><tt>QObject</tt></a> with another object as parent, it's added to the parent's children()</tt> list, and is deleted when the parent is. It turns out that this approach fits the needs of GUI objects very well. For example, a <a href="gui/QShortcut.html"><tt>QShortcut</tt></a> (keyboard shortcut) is a child of the relevant window, so when the user closes that window, the shorcut is deleted too.</p>
<p><a href="gui/QWidget.html"><tt>QWidget</tt></a>, the base class of everything that appears on the screen, extends the parent-child relationship. A child normally also becomes a child widget, i.e&#x2e; it is displayed in its parent's coordinate system and is graphically clipped by its parent's boundaries. For example, when the an application deletes a message box after it has been closed, the message box's buttons and label are also deleted, just as we'd want, because the buttons and label are children of the message box.</p>
<p>You can also delete child objects yourself, and they will remove themselves from their parents. For example, when the user removes a toolbar it may lead to the application deleting one of its <a href="gui/QToolBar.html"><tt>QToolBar</tt></a> objects, in which case the tool bar's <a href="gui/QMainWindow.html"><tt>QMainWindow</tt></a> parent would detect the change and reconfigure its screen space accordingly.</p>
<p>The debugging functions <tt>QObject::dumpObjectTree</tt> and <tt>QObject::dumpObjectInfo</tt> are often useful when an application looks or acts strangely.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2007 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt Jambi </div></td>
</tr></table></div></address></body>
</html>