File: qtreewidget.html

package info (click to toggle)
python-qt4 4.0.1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 18,632 kB
  • ctags: 2,639
  • sloc: python: 29,409; sh: 5,646; cpp: 3,168; xml: 149; makefile: 109
file content (148 lines) | stat: -rw-r--r-- 35,695 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QTreeWidget Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QTreeWidget Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QTreeWidget class provides a tree view that uses a predefined tree model. <a href="#details">More...</a></p>
<p>Inherits <a href="qtreeview.html">QTreeView</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qtreewidget.html#QTreeWidget">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qtreewidget.html#addTopLevelItem">addTopLevelItem</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#addTopLevelItems">addTopLevelItems</a></b> (<i>self</i>, QTreeWidgetItem-list&#160;<i>items</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#closePersistentEditor">closePersistentEditor</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>, int&#160;<i>column</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qtreewidget.html#collapseItem">collapseItem</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>)</li><li><div class="fn" />int <b><a href="qtreewidget.html#columnCount">columnCount</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtreewidget.html#currentColumn">currentColumn</a></b> (<i>self</i>)</li><li><div class="fn" />QTreeWidgetItem <b><a href="qtreewidget.html#currentItem">currentItem</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtreewidget.html#dropMimeData">dropMimeData</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>parent</i>, int&#160;<i>index</i>, QMimeData&#160;<i>data</i>, Qt.DropAction&#160;<i>action</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#editItem">editItem</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>, int&#160;<i>column</i>&#160;=&#160;0)</li><li><div class="fn" />bool <b><a href="qtreewidget.html#event">event</a></b> (<i>self</i>, QEvent&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#expandItem">expandItem</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>)</li><li><div class="fn" />QTreeWidgetItem-list <b><a href="qtreewidget.html#findItems">findItems</a></b> (<i>self</i>, QString&#160;<i>text</i>, Qt.MatchFlags&#160;<i>flags</i>, int&#160;<i>column</i>&#160;=&#160;0)</li><li><div class="fn" />QTreeWidgetItem <b><a href="qtreewidget.html#headerItem">headerItem</a></b> (<i>self</i>)</li><li><div class="fn" />QModelIndex <b><a href="qtreewidget.html#indexFromItem">indexFromItem</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>, int&#160;<i>column</i>&#160;=&#160;0)</li><li><div class="fn" />int <b><a href="qtreewidget.html#indexOfTopLevelItem">indexOfTopLevelItem</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#insertTopLevelItem">insertTopLevelItem</a></b> (<i>self</i>, int&#160;<i>index</i>, QTreeWidgetItem&#160;<i>item</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#insertTopLevelItems">insertTopLevelItems</a></b> (<i>self</i>, int&#160;<i>index</i>, QTreeWidgetItem-list&#160;<i>items</i>)</li><li><div class="fn" />bool <b><a href="qtreewidget.html#isItemExpanded">isItemExpanded</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>)</li><li><div class="fn" />bool <b><a href="qtreewidget.html#isItemHidden">isItemHidden</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>)</li><li><div class="fn" />bool <b><a href="qtreewidget.html#isItemSelected">isItemSelected</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>)</li><li><div class="fn" />bool <b><a href="qtreewidget.html#isSortingEnabled">isSortingEnabled</a></b> (<i>self</i>)</li><li><div class="fn" />QTreeWidgetItem <b><a href="qtreewidget.html#itemAt">itemAt</a></b> (<i>self</i>, QPoint&#160;<i>p</i>)</li><li><div class="fn" />QTreeWidgetItem <b><a href="qtreewidget.html#itemAt-2">itemAt</a></b> (<i>self</i>, int&#160;<i>ax</i>, int&#160;<i>ay</i>)</li><li><div class="fn" />QTreeWidgetItem <b><a href="qtreewidget.html#itemFromIndex">itemFromIndex</a></b> (<i>self</i>, QModelIndex&#160;<i>index</i>)</li><li><div class="fn" />QTreeWidgetItem-list <b><a href="qtreewidget.html#items">items</a></b> (<i>self</i>, QMimeData&#160;<i>data</i>)</li><li><div class="fn" />QWidget <b><a href="qtreewidget.html#itemWidget">itemWidget</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>, int&#160;<i>column</i>)</li><li><div class="fn" />QMimeData <b><a href="qtreewidget.html#mimeData">mimeData</a></b> (<i>self</i>, QTreeWidgetItem-list&#160;<i>items</i>)</li><li><div class="fn" />QStringList <b><a href="qtreewidget.html#mimeTypes">mimeTypes</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#openPersistentEditor">openPersistentEditor</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>, int&#160;<i>column</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qtreewidget.html#scrollToItem">scrollToItem</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>, QAbstractItemView.ScrollHint&#160;<i>hint</i>&#160;=&#160;QAbstractItemView.EnsureVisible)</li><li><div class="fn" />QTreeWidgetItem-list <b><a href="qtreewidget.html#selectedItems">selectedItems</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#setColumnCount">setColumnCount</a></b> (<i>self</i>, int&#160;<i>columns</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#setCurrentItem">setCurrentItem</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#setCurrentItem-2">setCurrentItem</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>, int&#160;<i>column</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#setHeaderItem">setHeaderItem</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#setHeaderLabels">setHeaderLabels</a></b> (<i>self</i>, QStringList&#160;<i>labels</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#setItemExpanded">setItemExpanded</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>, bool&#160;<i>expand</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#setItemHidden">setItemHidden</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>, bool&#160;<i>hide</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#setItemSelected">setItemSelected</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>, bool&#160;<i>select</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#setItemWidget">setItemWidget</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>, int&#160;<i>column</i>, QWidget&#160;<i>widget</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#setSortingEnabled">setSortingEnabled</a></b> (<i>self</i>, bool&#160;<i>enable</i>)</li><li><div class="fn" />int <b><a href="qtreewidget.html#sortColumn">sortColumn</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtreewidget.html#sortItems">sortItems</a></b> (<i>self</i>, int&#160;<i>column</i>, Qt.SortOrder&#160;<i>order</i>)</li><li><div class="fn" />Qt.DropActions <b><a href="qtreewidget.html#supportedDropActions">supportedDropActions</a></b> (<i>self</i>)</li><li><div class="fn" />QTreeWidgetItem <b><a href="qtreewidget.html#takeTopLevelItem">takeTopLevelItem</a></b> (<i>self</i>, int&#160;<i>index</i>)</li><li><div class="fn" />QTreeWidgetItem <b><a href="qtreewidget.html#topLevelItem">topLevelItem</a></b> (<i>self</i>, int&#160;<i>index</i>)</li><li><div class="fn" />int <b><a href="qtreewidget.html#topLevelItemCount">topLevelItemCount</a></b> (<i>self</i>)</li><li><div class="fn" />QRect <b><a href="qtreewidget.html#visualItemRect">visualItemRect</a></b> (<i>self</i>, QTreeWidgetItem&#160;<i>item</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qtreewidget.html#currentItemChanged">currentItemChanged</a></b> (QTreeWidgetItem *,QTreeWidgetItem *)</li><li><div class="fn" />void <b><a href="qtreewidget.html#itemActivated">itemActivated</a></b> (QTreeWidgetItem *,int)</li><li><div class="fn" />void <b><a href="qtreewidget.html#itemChanged">itemChanged</a></b> (QTreeWidgetItem *,int)</li><li><div class="fn" />void <b><a href="qtreewidget.html#itemClicked">itemClicked</a></b> (QTreeWidgetItem *,int)</li><li><div class="fn" />void <b><a href="qtreewidget.html#itemCollapsed">itemCollapsed</a></b> (QTreeWidgetItem *)</li><li><div class="fn" />void <b><a href="qtreewidget.html#itemDoubleClicked">itemDoubleClicked</a></b> (QTreeWidgetItem *,int)</li><li><div class="fn" />void <b><a href="qtreewidget.html#itemEntered">itemEntered</a></b> (QTreeWidgetItem *,int)</li><li><div class="fn" />void <b><a href="qtreewidget.html#itemExpanded">itemExpanded</a></b> (QTreeWidgetItem *)</li><li><div class="fn" />void <b><a href="qtreewidget.html#itemPressed">itemPressed</a></b> (QTreeWidgetItem *,int)</li><li><div class="fn" />void <b><a href="qtreewidget.html#itemSelectionChanged">itemSelectionChanged</a></b> ()</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QTreeWidget class provides a tree view that uses a predefined tree model.</p>
<p>The QTreeWidget class is a convenience class that provides a standard tree widget with a classic item-based interface similar to that used by the <a href="qlistview.html">QListView</a> class in Qt 3. This class is based on Qt's Model/View architecture and uses a default model to hold items, each of which is a <a href="qtreewidgetitem.html">QTreeWidgetItem</a>.</p>
<p>Developers who do not need the flexibility of the Model/View framework can use this class to create simple hierarchical lists very easily. A more flexible approach involves combining a <a href="qtreeview.html">QTreeView</a> with a standard item model. This allows the storage of data to be separated from its representation.</p>
<p>In its simplest form, a tree widget can be constructed in the following way:</p>
<pre>
    QTreeWidget *treeWidget = new QTreeWidget();
    treeWidget-&gt;setColumnCount(1);
    QList&lt;QTreeWidgetItem *&gt; items;
    for (int i = 0; i &lt; 10; ++i)
        items.append(new QTreeWidgetItem(0, QStringList(QString("item: %1").arg(i))));
    treeWidget-&gt;insertTopLevelItems(0, items);
</pre>
<p>Before items can be added to the tree widget, the number of columns must be set with <a href="qtreewidget.html#columnCount-prop">setColumnCount</a>(). This allows each item to have one or more labels or other decorations. The number of columns in use can be found with the <a href="qtreewidget.html#columnCount-prop">columnCount</a>() function.</p>
<p>The tree can have a header that contains a section for each column in the widget. It is easiest to set up the labels for each section by supplying a list of strings with <a href="qtreewidget.html#setHeaderLabels">setHeaderLabels</a>(), but a custom header can be constructed with a <a href="qtreewidgetitem.html">QTreeWidgetItem</a> and inserted into the tree with the <a href="qtreewidget.html#setHeaderItem">setHeaderItem</a>() function.</p>
<p>The items in the tree can be sorted by column according to a predefined sort order. If sorting is enabled, the user can sort the items by clicking on a column header. Sorting can be enabled or disabled by calling <a href="qtreewidget.html#sortingEnabled-prop">setSortingEnabled</a>(). The <a href="qtreewidget.html#sortingEnabled-prop">isSortingEnabled</a>() function indicates whether sorting is enabled.</p>
<table align="center" border="0" cellpadding="2" cellspacing="1" width="100%">
<tr bgcolor="#F0F0F0" valign="top">
<td><img alt="Screenshot of a Windows XP style tree widget" src="images/windowsxp-treeview.png" /></td>
<td><img alt="Screenshot of a Macintosh style tree widget" src="images/macintosh-treeview.png" /></td>
<td><img alt="Screenshot of a Plastique style tree widget" src="images/plastique-treeview.png" /></td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>A <a href="gallery-windowsxp.html">Windows XP style</a> tree widget.</td>
<td>A <a href="gallery-macintosh.html">Macintosh style</a> tree widget.</td>
<td>A <a href="gallery-plastique.html">Plastique style</a> tree widget.</td>
</tr>
</table>
<br />
<br />
<p>See also <a href="qtreewidgetitem.html">QTreeWidgetItem</a>, <a href="qtreeview.html">QTreeView</a>, and <a href="model-view-programming.html">Model/View Programming</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QTreeWidget" />QTreeWidget.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a tree widget with the given <i>parent</i>.</p>
<h3 class="fn"><a name="addTopLevelItem" />QTreeWidget.addTopLevelItem (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>)</h3><p>The <i>item</i> argument has it's ownership transferred to Qt.</p><p>Appends the <i>item</i> as a top-level item in the widget.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qtreewidget.html#insertTopLevelItem">insertTopLevelItem</a>().</p>
<h3 class="fn"><a name="addTopLevelItems" />QTreeWidget.addTopLevelItems (<i>self</i>, QTreeWidgetItem-list&#160;<i>items</i>)</h3><p>The <i>items</i> argument has it's ownership transferred to Qt.</p><p>Appends the list of <i>items</i> as a top-level items in the widget.</p>
<p>See also <a href="qtreewidget.html#insertTopLevelItems">insertTopLevelItems</a>().</p>
<h3 class="fn"><a name="clear" />QTreeWidget.clear (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void clear()</tt>.</p><p>Clears the tree widget by removing all of its items and selections.</p>
<p><b>Note:</b> Since each item is removed from the tree widget before being deleted, the return value of <a href="qtreewidgetitem.html#treeWidget">QTreeWidgetItem.treeWidget</a>() will be invalid when called from an item's destructor.</p>
<p>See also <a href="qtreewidget.html#takeTopLevelItem">takeTopLevelItem</a>(), <a href="qtreewidget.html#topLevelItemCount-prop">topLevelItemCount</a>(), and <a href="qtreewidget.html#columnCount-prop">columnCount</a>().</p>
<h3 class="fn"><a name="closePersistentEditor" />QTreeWidget.closePersistentEditor (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>, int&#160;<i>column</i>&#160;=&#160;0)</h3><p>Closes the persistent editor for the <i>item</i> in the given <i>column</i>.</p>
<p>This function has no effect if no persistent editor is open for this combination of item and column.</p>
<p>See also <a href="qtreewidget.html#openPersistentEditor">openPersistentEditor</a>().</p>
<h3 class="fn"><a name="collapseItem" />QTreeWidget.collapseItem (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void collapseItem(const QTreeWidgetItem *)</tt>.</p><p>Closes the <i>item</i>. This causes the tree containing the item's children to be collapsed.</p>
<p>See also <a href="qtreewidget.html#expandItem">expandItem</a>(), <a href="qtreewidget.html#currentItem">currentItem</a>(), <a href="qtreewidget.html#itemAt">itemAt</a>(), and <a href="qtreewidget.html#topLevelItem">topLevelItem</a>().</p>
<h3 class="fn"><a name="columnCount" />int QTreeWidget.columnCount (<i>self</i>)</h3><h3 class="fn"><a name="currentColumn" />int QTreeWidget.currentColumn (<i>self</i>)</h3><p>Returns the current column in the tree widget.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qtreewidget.html#setCurrentItem">setCurrentItem</a>() and <a href="qtreewidget.html#columnCount-prop">columnCount</a>().</p>
<h3 class="fn"><a name="currentItem" /><a href="qtreewidgetitem.html">QTreeWidgetItem</a> QTreeWidget.currentItem (<i>self</i>)</h3><p>Returns the current item in the tree widget.</p>
<p>See also <a href="qtreewidget.html#setCurrentItem">setCurrentItem</a>() and <a href="qtreewidget.html#currentItemChanged">currentItemChanged</a>().</p>
<h3 class="fn"><a name="dropMimeData" />bool QTreeWidget.dropMimeData (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>parent</i>, int&#160;<i>index</i>, <a href="qmimedata.html">QMimeData</a>&#160;<i>data</i>, <a href="qt.html#DropAction-enum">Qt.DropAction</a>&#160;<i>action</i>)</h3><p>Handles the <i>data</i> supplied by a drag and drop operation that ended with the given <i>action</i> in the <i>index</i> in the given <i>parent</i> item.</p>
<p>See also <a href="qtreewidget.html#supportedDropActions">supportedDropActions</a>().</p>
<h3 class="fn"><a name="editItem" />QTreeWidget.editItem (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>, int&#160;<i>column</i>&#160;=&#160;0)</h3><p>Starts editing the <i>item</i> in the given <i>column</i> if it is editable.</p>
<h3 class="fn"><a name="event" />bool QTreeWidget.event (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>e</i>)</h3><h3 class="fn"><a name="expandItem" />QTreeWidget.expandItem (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void expandItem(const QTreeWidgetItem *)</tt>.</p><p>Expands the <i>item</i>. This causes the tree containing the item's children to be expanded.</p>
<p>See also <a href="qtreewidget.html#collapseItem">collapseItem</a>(), <a href="qtreewidget.html#currentItem">currentItem</a>(), <a href="qtreewidget.html#itemAt">itemAt</a>(), <a href="qtreewidget.html#topLevelItem">topLevelItem</a>(), and <a href="qtreewidget.html#itemExpanded">itemExpanded</a>().</p>
<h3 class="fn"><a name="findItems" />QTreeWidgetItem-list QTreeWidget.findItems (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>text</i>, <a href="qt-matchflags.html">Qt.MatchFlags</a>&#160;<i>flags</i>, int&#160;<i>column</i>&#160;=&#160;0)</h3><p>Returns a list of items that match the given <i>text</i>, using the given <i>flags</i>, in the given <i>column</i>.</p>
<h3 class="fn"><a name="headerItem" /><a href="qtreewidgetitem.html">QTreeWidgetItem</a> QTreeWidget.headerItem (<i>self</i>)</h3><p>Returns the item used for the tree widget's header.</p>
<p>See also <a href="qtreewidget.html#setHeaderItem">setHeaderItem</a>().</p>
<h3 class="fn"><a name="indexFromItem" /><a href="qmodelindex.html">QModelIndex</a> QTreeWidget.indexFromItem (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>, int&#160;<i>column</i>&#160;=&#160;0)</h3><p>Returns the <a href="qmodelindex.html">QModelIndex</a> assocated with the given <i>item</i> in the given <i>column</i>.</p>
<p>See also <a href="qtreewidget.html#itemFromIndex">itemFromIndex</a>() and <a href="qtreewidget.html#topLevelItem">topLevelItem</a>().</p>
<h3 class="fn"><a name="indexOfTopLevelItem" />int QTreeWidget.indexOfTopLevelItem (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>)</h3><p>Returns the index of the given top-level <i>item</i>, or -1 if the item cannot be found.</p>
<p>See also <a href="qtreewidget.html#sortItems">sortItems</a>() and <a href="qtreewidget.html#topLevelItemCount-prop">topLevelItemCount</a>().</p>
<h3 class="fn"><a name="insertTopLevelItem" />QTreeWidget.insertTopLevelItem (<i>self</i>, int&#160;<i>index</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>)</h3><p>The <i>item</i> argument has it's ownership transferred to Qt.</p><p>Inserts the <i>item</i> at <i>index</i> in the top level in the view.</p>
<p>See also <a href="qtreewidget.html#addTopLevelItem">addTopLevelItem</a>() and <a href="qtreewidget.html#columnCount-prop">columnCount</a>().</p>
<h3 class="fn"><a name="insertTopLevelItems" />QTreeWidget.insertTopLevelItems (<i>self</i>, int&#160;<i>index</i>, QTreeWidgetItem-list&#160;<i>items</i>)</h3><p>The <i>items</i> argument has it's ownership transferred to Qt.</p><p>Inserts the list of <i>items</i> at <i>index</i> in the top level in the view.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qtreewidget.html#addTopLevelItems">addTopLevelItems</a>().</p>
<h3 class="fn"><a name="isItemExpanded" />bool QTreeWidget.isItemExpanded (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>)</h3><p>Returns true if the given <i>item</i> is open; otherwise returns false.</p>
<p>See also <a href="qtreewidget.html#itemExpanded">itemExpanded</a>().</p>
<h3 class="fn"><a name="isItemHidden" />bool QTreeWidget.isItemHidden (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>)</h3><p>Returns true if the <i>item</i> is explicitly hidden, otherwise returns false.</p>
<h3 class="fn"><a name="isItemSelected" />bool QTreeWidget.isItemSelected (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>)</h3><p>Returns true if the <i>item</i> is selected; otherwise returns false.</p>
<p>See also <a href="qtreewidget.html#itemSelectionChanged">itemSelectionChanged</a>().</p>
<h3 class="fn"><a name="isSortingEnabled" />bool QTreeWidget.isSortingEnabled (<i>self</i>)</h3><h3 class="fn"><a name="itemAt" /><a href="qtreewidgetitem.html">QTreeWidgetItem</a> QTreeWidget.itemAt (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p</i>)</h3><p>Returns a pointer to the item at the coordinates <i>p</i>.</p>
<p>See also <a href="qtreewidget.html#visualItemRect">visualItemRect</a>().</p>
<h3 class="fn"><a name="itemAt-2" /><a href="qtreewidgetitem.html">QTreeWidgetItem</a> QTreeWidget.itemAt (<i>self</i>, int&#160;<i>ax</i>, int&#160;<i>ay</i>)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p>Returns a pointer to the item at the coordinates (<i>x</i>, <i>y</i>).</p>
<h3 class="fn"><a name="itemFromIndex" /><a href="qtreewidgetitem.html">QTreeWidgetItem</a> QTreeWidget.itemFromIndex (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>index</i>)</h3><p>Returns a pointer to the <a href="qtreewidgetitem.html">QTreeWidgetItem</a> assocated with the given <i>index</i>.</p>
<p>See also <a href="qtreewidget.html#indexFromItem">indexFromItem</a>().</p>
<h3 class="fn"><a name="items" />QTreeWidgetItem-list QTreeWidget.items (<i>self</i>, <a href="qmimedata.html">QMimeData</a>&#160;<i>data</i>)</h3><p>Returns a list of pointers to the items contained in the <i>data</i> object. If the object was not created by a <a href="qtreewidget.html">QTreeWidget</a> in the same process, the list is empty.</p>
<h3 class="fn"><a name="itemWidget" /><a href="qwidget.html">QWidget</a> QTreeWidget.itemWidget (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>, int&#160;<i>column</i>)</h3><p>Returns the widget displayed in the cell specified by <i>item</i> and the given <i>column</i>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qtreewidget.html#setItemWidget">setItemWidget</a>().</p>
<h3 class="fn"><a name="mimeData" /><a href="qmimedata.html">QMimeData</a> QTreeWidget.mimeData (<i>self</i>, QTreeWidgetItem-list&#160;<i>items</i>)</h3><p>The <i>QMimeData</i> result</p><p>Returns an object that contains a serialized description of the specified <i>items</i>. The format used to describe the items is obtained from the <a href="qtreewidget.html#mimeTypes">mimeTypes</a>() function.</p>
<p>If the list of items is empty, 0 is returned rather than a serialized empty list.</p>
<h3 class="fn"><a name="mimeTypes" /><a href="qstringlist.html">QStringList</a> QTreeWidget.mimeTypes (<i>self</i>)</h3><p>Returns a list of MIME types that can be used to describe a list of treewidget items.</p>
<p>See also <a href="qtreewidget.html#mimeData">mimeData</a>().</p>
<h3 class="fn"><a name="openPersistentEditor" />QTreeWidget.openPersistentEditor (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>, int&#160;<i>column</i>&#160;=&#160;0)</h3><p>Opens a persistent editor for the <i>item</i> in the given <i>column</i>.</p>
<p>See also <a href="qtreewidget.html#closePersistentEditor">closePersistentEditor</a>().</p>
<h3 class="fn"><a name="scrollToItem" />QTreeWidget.scrollToItem (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>, <a href="qabstractitemview.html#ScrollHint-enum">QAbstractItemView.ScrollHint</a>&#160;<i>hint</i>&#160;=&#160;QAbstractItemView.EnsureVisible)</h3><p>This method is also a Qt slot with the C++ signature <tt>void scrollToItem(const QTreeWidgetItem *,QAbstractItemView::ScrollHint = QAbstractItemView.EnsureVisible)</tt>.</p><h3 class="fn"><a name="selectedItems" />QTreeWidgetItem-list QTreeWidget.selectedItems (<i>self</i>)</h3><p>Returns a list of all selected non-hidden items.</p>
<p>See also <a href="qtreewidget.html#itemSelectionChanged">itemSelectionChanged</a>().</p>
<h3 class="fn"><a name="setColumnCount" />QTreeWidget.setColumnCount (<i>self</i>, int&#160;<i>columns</i>)</h3><h3 class="fn"><a name="setCurrentItem" />QTreeWidget.setCurrentItem (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>)</h3><p>Sets the current <i>item</i> in the tree widget.</p>
<p>Depending on the current selection mode, the item may also be selected.</p>
<p>See also <a href="qtreewidget.html#currentItem">currentItem</a>() and <a href="qtreewidget.html#currentItemChanged">currentItemChanged</a>().</p>
<h3 class="fn"><a name="setCurrentItem-2" />QTreeWidget.setCurrentItem (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>, int&#160;<i>column</i>)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p>Sets the current <i>item</i> in the tree widget and the curernt column to <i>column</i>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qtreewidget.html#currentItem">currentItem</a>().</p>
<h3 class="fn"><a name="setHeaderItem" />QTreeWidget.setHeaderItem (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>)</h3><p>Sets the header <i>item</i> for the tree widget. The label for each column in the header is supplied by the corresponding label in the item.</p>
<p>See also <a href="qtreewidget.html#headerItem">headerItem</a>() and <a href="qtreewidget.html#setHeaderLabels">setHeaderLabels</a>().</p>
<h3 class="fn"><a name="setHeaderLabels" />QTreeWidget.setHeaderLabels (<i>self</i>, <a href="qstringlist.html">QStringList</a>&#160;<i>labels</i>)</h3><p>Adds a column in the header for each item in the <i>labels</i> list, and sets the label for each column.</p>
<p>Note that setHeaderLabels wont remove existing columns.</p>
<p>See also <a href="qtreewidget.html#setHeaderItem">setHeaderItem</a>().</p>
<h3 class="fn"><a name="setItemExpanded" />QTreeWidget.setItemExpanded (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>, bool&#160;<i>expand</i>)</h3><p>Sets the item referred to by <i>item</i> to either closed or opened, depending on the value of <i>expand</i>.</p>
<p>See also <a href="qtreewidget.html#expandItem">expandItem</a>(), <a href="qtreewidget.html#collapseItem">collapseItem</a>(), and <a href="qtreewidget.html#itemExpanded">itemExpanded</a>().</p>
<h3 class="fn"><a name="setItemHidden" />QTreeWidget.setItemHidden (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>, bool&#160;<i>hide</i>)</h3><p>Hides the given <i>item</i> if <i>hide</i> is true; otherwise shows the item.</p>
<p>See also <a href="qtreewidget.html#isItemHidden">isItemHidden</a>() and <a href="qtreewidget.html#itemChanged">itemChanged</a>().</p>
<h3 class="fn"><a name="setItemSelected" />QTreeWidget.setItemSelected (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>, bool&#160;<i>select</i>)</h3><p>If <i>select</i> is true, the given <i>item</i> is selected; otherwise it is deselected.</p>
<p>See also <a href="qtreewidget.html#isItemSelected">isItemSelected</a>() and <a href="qtreewidget.html#itemSelectionChanged">itemSelectionChanged</a>().</p>
<h3 class="fn"><a name="setItemWidget" />QTreeWidget.setItemWidget (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>, int&#160;<i>column</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>)</h3><p>Sets the <i>widget</i> to be displayed in the cell specified by <i>item</i> and the given <i>column</i>.</p>
<p>This function should only be used to display static content in the place of a tree widget item. If you want to display custom dynamic content or implement a custom editor widget, use <a href="qtreeview.html">QTreeView</a> and subclass <a href="qitemdelegate.html">QItemDelegate</a> instead.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qtreewidget.html#itemWidget">itemWidget</a>() and <a href="model-view-delegate.html">Delegate Classes</a>.</p>
<h3 class="fn"><a name="setSortingEnabled" />QTreeWidget.setSortingEnabled (<i>self</i>, bool&#160;<i>enable</i>)</h3><h3 class="fn"><a name="sortColumn" />int QTreeWidget.sortColumn (<i>self</i>)</h3><p>Returns the column used to sort the contents of the widget.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qtreewidget.html#sortItems">sortItems</a>().</p>
<h3 class="fn"><a name="sortItems" />QTreeWidget.sortItems (<i>self</i>, int&#160;<i>column</i>, <a href="qt.html#SortOrder-enum">Qt.SortOrder</a>&#160;<i>order</i>)</h3><p>Sorts the items in the widget in the specified <i>order</i> by the values in the given <i>column</i>.</p>
<p>See also <a href="qtreewidget.html#sortColumn">sortColumn</a>().</p>
<h3 class="fn"><a name="supportedDropActions" /><a href="qt-dropactions.html">Qt.DropActions</a> QTreeWidget.supportedDropActions (<i>self</i>)</h3><p>Returns the drop actions supported by this view.</p>
<p>See also <a href="qt.html#DropAction-enum">Qt.DropActions</a>.</p>
<h3 class="fn"><a name="takeTopLevelItem" /><a href="qtreewidgetitem.html">QTreeWidgetItem</a> QTreeWidget.takeTopLevelItem (<i>self</i>, int&#160;<i>index</i>)</h3><p>The <i>QTreeWidgetItem</i> result</p><p>Removes the top-level item at the given <i>index</i> in the tree and returns it, otherwise returns 0;</p>
<p>See also <a href="qtreewidget.html#insertTopLevelItem">insertTopLevelItem</a>(), <a href="qtreewidget.html#topLevelItem">topLevelItem</a>(), and <a href="qtreewidget.html#topLevelItemCount-prop">topLevelItemCount</a>().</p>
<h3 class="fn"><a name="topLevelItem" /><a href="qtreewidgetitem.html">QTreeWidgetItem</a> QTreeWidget.topLevelItem (<i>self</i>, int&#160;<i>index</i>)</h3><p>Returns the top level item at the given <i>index</i>, or 0 if the item does not exist.</p>
<p>See also <a href="qtreewidget.html#topLevelItemCount-prop">topLevelItemCount</a>() and <a href="qtreewidget.html#insertTopLevelItem">insertTopLevelItem</a>().</p>
<h3 class="fn"><a name="topLevelItemCount" />int QTreeWidget.topLevelItemCount (<i>self</i>)</h3><h3 class="fn"><a name="visualItemRect" /><a href="qrect.html">QRect</a> QTreeWidget.visualItemRect (<i>self</i>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>&#160;<i>item</i>)</h3><p>Returns the rectangle on the viewport occupied by the item at <i>item</i>.</p>
<p>See also <a href="qtreewidget.html#itemAt">itemAt</a>().</p>
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="currentItemChanged" />void currentItemChanged (QTreeWidgetItem *,QTreeWidgetItem *)</h3><p>This signal is emitted when the current item changes. The current item is specified by <i>current</i>, and this replaces the <i>previous</i> current item.</p>
<p>See also <a href="qtreewidget.html#setCurrentItem">setCurrentItem</a>().</p>
<h3 class="fn"><a name="itemActivated" />void itemActivated (QTreeWidgetItem *,int)</h3><p>This signal is emitted when the user activates an item by single- or double-clicking (depending on the platform, i.e. on the <a href="qstyle.html#StyleHint-enum">QStyle.SH_ItemView_ActivateItemOnSingleClick</a> style hint) or pressing a special key (e.g., <b>Enter</b>).</p>
<p>The specified <i>item</i> is the item that was clicked, or 0 if no item was clicked. The <i>column</i> is the item's column that was clicked, or -1 if no item was clicked.</p>
<h3 class="fn"><a name="itemChanged" />void itemChanged (QTreeWidgetItem *,int)</h3><p>This signal is emitted when the contents of the <i>column</i> in the specified <i>item</i> changes.</p>
<h3 class="fn"><a name="itemClicked" />void itemClicked (QTreeWidgetItem *,int)</h3><p>This signal is emitted when the user clicks inside the widget. The specified <i>item</i> is the item that was clicked.</p>
<h3 class="fn"><a name="itemCollapsed" />void itemCollapsed (QTreeWidgetItem *)</h3><p>This signal is emitted when the specified <i>item</i> is collapsed so that none of its children are displayed.</p>
<p>See also <a href="qtreewidget.html#isItemExpanded">isItemExpanded</a>().</p>
<h3 class="fn"><a name="itemDoubleClicked" />void itemDoubleClicked (QTreeWidgetItem *,int)</h3><p>This signal is emitted when the user double clicks inside the widget. The specified <i>item</i> is the item that was clicked.</p>
<h3 class="fn"><a name="itemEntered" />void itemEntered (QTreeWidgetItem *,int)</h3><p>This signal is emitted when the mouse cursor enters an <i>item</i> over the specified <i>column</i>. <a href="qtreewidget.html">QTreeWidget</a> mouse tracking needs to be enabled for this feature to work.</p>
<h3 class="fn"><a name="itemExpanded" />void itemExpanded (QTreeWidgetItem *)</h3><p>This signal is emitted when the specified <i>item</i> is expanded so that all of its children are displayed.</p>
<p>See also <a href="qtreewidget.html#setItemExpanded">setItemExpanded</a>() and <a href="qtreewidget.html#isItemExpanded">isItemExpanded</a>().</p>
<h3 class="fn"><a name="itemPressed" />void itemPressed (QTreeWidgetItem *,int)</h3><p>This signal is emitted when the user presses a mouse button inside the widget. The specified <i>item</i> is the item that was clicked.</p>
<h3 class="fn"><a name="itemSelectionChanged" />void itemSelectionChanged ()</h3><p>This signal is emitted when the selection changes in the tree widget. The current selection can be found with <a href="qtreewidget.html#selectedItems">selectedItems</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt&#160;4.0.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.trolltech.com">Trolltech&#160;AS</a> 2006</td><td align="right" width="25%">Qt&#160;4.1.4</td></tr></table></div></address></body></html>