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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
<?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>QTreeView 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">  </td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QTreeView Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QTreeView class provides a default model/view implementation of a tree view. <a href="#details">More...</a></p>
<p>Inherits <a href="qabstractitemview.html">QAbstractItemView</a>.</p><p>Inherited by <a href="qtreewidget.html">QTreeWidget</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qtreeview.html#QTreeView">__init__</a></b> (<i>self</i>, QWidget <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qtreeview.html#collapse">collapse</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" />int <b><a href="qtreeview.html#columnAt">columnAt</a></b> (<i>self</i>, int <i>x</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#columnCountChanged">columnCountChanged</a></b> (<i>self</i>, int <i>oldCount</i>, int <i>newCount</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#columnMoved">columnMoved</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#columnResized">columnResized</a></b> (<i>self</i>, int <i>column</i>, int <i>oldSize</i>, int <i>newSize</i>)</li><li><div class="fn" />int <b><a href="qtreeview.html#columnViewportPosition">columnViewportPosition</a></b> (<i>self</i>, int <i>column</i>)</li><li><div class="fn" />int <b><a href="qtreeview.html#columnWidth">columnWidth</a></b> (<i>self</i>, int <i>column</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#dataChanged">dataChanged</a></b> (<i>self</i>, QModelIndex <i>topLeft</i>, QModelIndex <i>bottomRight</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#doItemsLayout">doItemsLayout</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#drawBranches">drawBranches</a></b> (<i>self</i>, QPainter <i>painter</i>, QRect <i>rect</i>, QModelIndex <i>index</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#drawRow">drawRow</a></b> (<i>self</i>, QPainter <i>painter</i>, QStyleOptionViewItem <i>options</i>, QModelIndex <i>index</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#expand">expand</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" />QHeaderView <b><a href="qtreeview.html#header">header</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#hideColumn">hideColumn</a></b> (<i>self</i>, int <i>column</i>)</li><li><div class="fn" />int <b><a href="qtreeview.html#horizontalOffset">horizontalOffset</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#horizontalScrollbarAction">horizontalScrollbarAction</a></b> (<i>self</i>, int <i>action</i>)</li><li><div class="fn" />int <b><a href="qtreeview.html#indentation">indentation</a></b> (<i>self</i>)</li><li><div class="fn" />QModelIndex <b><a href="qtreeview.html#indexAbove">indexAbove</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" />QModelIndex <b><a href="qtreeview.html#indexAt">indexAt</a></b> (<i>self</i>, QPoint <i>p</i>)</li><li><div class="fn" />QModelIndex <b><a href="qtreeview.html#indexBelow">indexBelow</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" />int <b><a href="qtreeview.html#indexRowSizeHint">indexRowSizeHint</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" />bool <b><a href="qtreeview.html#isColumnHidden">isColumnHidden</a></b> (<i>self</i>, int <i>column</i>)</li><li><div class="fn" />bool <b><a href="qtreeview.html#isExpanded">isExpanded</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" />bool <b><a href="qtreeview.html#isIndexHidden">isIndexHidden</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" />bool <b><a href="qtreeview.html#isRowHidden">isRowHidden</a></b> (<i>self</i>, int <i>row</i>, QModelIndex <i>parent</i>)</li><li><div class="fn" />bool <b><a href="qtreeview.html#itemsExpandable">itemsExpandable</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#keyboardSearch">keyboardSearch</a></b> (<i>self</i>, QString <i>search</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#mouseDoubleClickEvent">mouseDoubleClickEvent</a></b> (<i>self</i>, QMouseEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#mousePressEvent">mousePressEvent</a></b> (<i>self</i>, QMouseEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#mouseReleaseEvent">mouseReleaseEvent</a></b> (<i>self</i>, QMouseEvent <i>event</i>)</li><li><div class="fn" />QModelIndex <b><a href="qtreeview.html#moveCursor">moveCursor</a></b> (<i>self</i>, QAbstractItemView.CursorAction <i>cursorAction</i>, Qt.KeyboardModifiers <i>modifiers</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#reexpand">reexpand</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#reset">reset</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#resizeColumnToContents">resizeColumnToContents</a></b> (<i>self</i>, int <i>column</i>)</li><li><div class="fn" />bool <b><a href="qtreeview.html#rootIsDecorated">rootIsDecorated</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#rowsAboutToBeRemoved">rowsAboutToBeRemoved</a></b> (<i>self</i>, QModelIndex <i>parent</i>, int <i>start</i>, int <i>end</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#rowsInserted">rowsInserted</a></b> (<i>self</i>, QModelIndex <i>parent</i>, int <i>start</i>, int <i>end</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#rowsRemoved">rowsRemoved</a></b> (<i>self</i>, QModelIndex <i>parent</i>, int <i>first</i>, int <i>last</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#scrollContentsBy">scrollContentsBy</a></b> (<i>self</i>, int <i>dx</i>, int <i>dy</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#scrollTo">scrollTo</a></b> (<i>self</i>, QModelIndex <i>index</i>, QAbstractItemView.ScrollHint <i>hint</i> = QAbstractItemView.EnsureVisible)</li><li><div class="fn" /><b><a href="qtreeview.html#selectAll">selectAll</a></b> (<i>self</i>)</li><li><div class="fn" />QModelIndex-list <b><a href="qtreeview.html#selectedIndexes">selectedIndexes</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#setColumnHidden">setColumnHidden</a></b> (<i>self</i>, int <i>column</i>, bool <i>hide</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#setExpanded">setExpanded</a></b> (<i>self</i>, QModelIndex <i>index</i>, bool <i>expand</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#setHeader">setHeader</a></b> (<i>self</i>, QHeaderView <i>header</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#setIndentation">setIndentation</a></b> (<i>self</i>, int <i>i</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#setItemsExpandable">setItemsExpandable</a></b> (<i>self</i>, bool <i>enable</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#setModel">setModel</a></b> (<i>self</i>, QAbstractItemModel <i>model</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#setRootIndex">setRootIndex</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#setRootIsDecorated">setRootIsDecorated</a></b> (<i>self</i>, bool <i>show</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#setRowHidden">setRowHidden</a></b> (<i>self</i>, int <i>row</i>, QModelIndex <i>parent</i>, bool <i>hide</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#setSelection">setSelection</a></b> (<i>self</i>, QRect <i>rect</i>, QItemSelectionModel.SelectionFlags <i>command</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#setSelectionModel">setSelectionModel</a></b> (<i>self</i>, QItemSelectionModel <i>selectionModel</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#setUniformRowHeights">setUniformRowHeights</a></b> (<i>self</i>, bool <i>uniform</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#showColumn">showColumn</a></b> (<i>self</i>, int <i>column</i>)</li><li><div class="fn" />int <b><a href="qtreeview.html#sizeHintForColumn">sizeHintForColumn</a></b> (<i>self</i>, int <i>column</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#sortByColumn">sortByColumn</a></b> (<i>self</i>, int <i>column</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#timerEvent">timerEvent</a></b> (<i>self</i>, QTimerEvent <i>event</i>)</li><li><div class="fn" />bool <b><a href="qtreeview.html#uniformRowHeights">uniformRowHeights</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtreeview.html#updateGeometries">updateGeometries</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtreeview.html#verticalOffset">verticalOffset</a></b> (<i>self</i>)</li><li><div class="fn" />QRect <b><a href="qtreeview.html#visualRect">visualRect</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" />QRegion <b><a href="qtreeview.html#visualRegionForSelection">visualRegionForSelection</a></b> (<i>self</i>, QItemSelection <i>selection</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qtreeview.html#collapsed">collapsed</a></b> (const QModelIndex&)</li><li><div class="fn" />void <b><a href="qtreeview.html#expanded">expanded</a></b> (const QModelIndex&)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QTreeView class provides a default model/view implementation of a tree view.</p>
<p>A QTreeView implements a tree representation of items from a model. This class is used to provide standard hierarchical lists that were previously provided by the <tt>QListView</tt> class, but using the more flexible approach provided by Qt's model/view architecture.</p>
<p>The QTreeView class is one of the <a href="model-view.html">Model/View Classes</a> and is part of Qt's <a href="model-view-programming.html">model/view framework</a>.</p>
<p>QTreeView implements the interfaces defined by the <a href="qabstractitemview.html">QAbstractItemView</a> class to allow it to display data provided by models derived from the <a href="qabstractitemmodel.html">QAbstractItemModel</a> class.</p>
<p>It is simple to construct a tree view displaying data from a model. In the following example, the contents of a directory are supplied by a <a href="qdirmodel.html">QDirModel</a> and displayed as a tree:</p>
<pre>
QDirModel *model = new QDirModel;
QTreeView *tree = new QTreeView(splitter);
tree->setModel(model);
</pre>
<p>The model/view architecture ensures that the contents of the tree view are updated as the model changes.</p>
<p>Items that have children can be in an expanded (children are visible) or collapsed (children are hidden) state. When this state changes a <a href="qtreeview.html#collapsed">collapsed</a>() or <a href="qtreeview.html#expanded">expanded</a>() signal is emitted with the model index of the relevant item.</p>
<p>The amount of indentation used to indicate levels of hierarchy is controlled by the <a href="qtreeview.html#indentation-prop">indentation</a> property.</p>
<p>Headers in a tree view are constructed using the <a href="qheaderview.html">QHeaderView</a> class and can be hidden using <a href="qtreeview.html#header">header</a>()-><a href="qwidget.html#hide">hide</a>().</p>
<a id="key-bindings" name="key-bindings" />
<h3>Key Bindings</h3>
<p>QTreeView supports a set of key bindings that enable the user to navigate in the view and interact with the contents of items:</p>
<table align="center" border="0" cellpadding="2" cellspacing="1">
<tr bgcolor="#A2C511" valign="top">
<th>Key</th>
<th>Action</th>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>UpArrow</td>
<td>Moves the cursor to the item in the same column on the previous row. If the parent of the current item has no more rows to navigate to, the cursor moves to the relevant item in the last row of the sibling that precedes the parent.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>DownArrow</td>
<td>Moves the cursor to the item in the same column on the next row. If the parent of the current item has no more rows to navigate to, the cursor moves to the relevant item in the first row of the sibling that follows the parent.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>LeftArrow</td>
<td>Hides the children of the current item (if present) by collapsing a branch.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>RightArrow</td>
<td>Reveals the children of the current item (if present) by expanding a branch.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>PageUp</td>
<td>Moves the cursor up one page.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>PageDown</td>
<td>Moves the cursor down one page.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Home</td>
<td>Moves the cursor to an item in the same column of the first row of the first top-level item in the model.</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>End</td>
<td>Moves the cursor to an item in the same column of the last row of the last top-level item in the model.</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>F2</td>
<td>In editable models, this opens the current item for editing. The Escape key can be used to cancel the editing process and revert any changes to the data displayed.</td>
</tr>
</table>
<br />
<br />
<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 view" src="images/windowsxp-treeview.png" /></td>
<td><img alt="Screenshot of a Macintosh style tree view" src="images/macintosh-treeview.png" /></td>
<td><img alt="Screenshot of a Plastique style tree view" src="images/plastique-treeview.png" /></td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>A <a href="gallery-windowsxp.html">Windows XP style</a> tree view.</td>
<td>A <a href="gallery-macintosh.html">Macintosh style</a> tree view.</td>
<td>A <a href="gallery-plastique.html">Plastique style</a> tree view.</td>
</tr>
</table>
<br />
<br />
<p>See also <a href="qlistview.html">QListView</a>, <a href="qtreewidget.html">QTreeWidget</a>, <a href="model-view-programming.html">Model/View Programming</a>, <a href="qabstractitemmodel.html">QAbstractItemModel</a>, and <a href="qabstractitemview.html">QAbstractItemView</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QTreeView" />QTreeView.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = 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 table view with a <i>parent</i> to represent a model's data. Use <a href="qabstractitemview.html#setModel">setModel</a>() to set the model.</p>
<p>See also <a href="qabstractitemmodel.html">QAbstractItemModel</a>.</p>
<h3 class="fn"><a name="collapse" />QTreeView.collapse (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void collapse(const QModelIndex&)</tt>.</p><p>Collapses the model item specified by the <i>index</i>.</p>
<p>See also <a href="qtreeview.html#collapsed">collapsed</a>().</p>
<h3 class="fn"><a name="columnAt" />int QTreeView.columnAt (<i>self</i>, int <i>x</i>)</h3><p>Returns the column in the tree view whose header covers the <i>x</i> coordinate given.</p>
<h3 class="fn"><a name="columnCountChanged" />QTreeView.columnCountChanged (<i>self</i>, int <i>oldCount</i>, int <i>newCount</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void columnCountChanged(int,int)</tt>.</p><p>Informs the tree view that the number of columns in the tree view has changed from <i>oldCount</i> to <i>newCount</i>.</p>
<h3 class="fn"><a name="columnMoved" />QTreeView.columnMoved (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void columnMoved()</tt>.</p><p>This slot is called whenever a column has been moved.</p>
<h3 class="fn"><a name="columnResized" />QTreeView.columnResized (<i>self</i>, int <i>column</i>, int <i>oldSize</i>, int <i>newSize</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void columnResized(int,int,int)</tt>.</p><p>This function is called whenever <i>column</i>'s size is changed in the header. <i>oldSize</i> and <i>newSize</i> give the previous size and the new size in pixels.</p>
<h3 class="fn"><a name="columnViewportPosition" />int QTreeView.columnViewportPosition (<i>self</i>, int <i>column</i>)</h3><p>Returns the horizontal position of the <i>column</i> in the viewport.</p>
<h3 class="fn"><a name="columnWidth" />int QTreeView.columnWidth (<i>self</i>, int <i>column</i>)</h3><p>Returns the width of the <i>column</i>.</p>
<p>See also <a href="qtreeview.html#resizeColumnToContents">resizeColumnToContents</a>().</p>
<h3 class="fn"><a name="dataChanged" />QTreeView.dataChanged (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>topLeft</i>, <a href="qmodelindex.html">QModelIndex</a> <i>bottomRight</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void dataChanged(const QModelIndex&,const QModelIndex&)</tt>.</p><h3 class="fn"><a name="doItemsLayout" />QTreeView.doItemsLayout (<i>self</i>)</h3><p>Lays out the items in the tree view.</p>
<h3 class="fn"><a name="drawBranches" />QTreeView.drawBranches (<i>self</i>, <a href="qpainter.html">QPainter</a> <i>painter</i>, <a href="qrect.html">QRect</a> <i>rect</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>Draws the branches in the tree view on the same row as the model item <i>index</i>, using the <i>painter</i> given. The branches are drawn in the rectangle specified by <i>rect</i>.</p>
<h3 class="fn"><a name="drawRow" />QTreeView.drawRow (<i>self</i>, <a href="qpainter.html">QPainter</a> <i>painter</i>, <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a> <i>options</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>Draws the row in the tree view that contains the model item <i>index</i>, using the <i>painter</i> given. The <i>option</i> control how the item is displayed.</p>
<p>See also QStyleOptionViewItem() and <a href="qabstractitemview.html#alternatingRowColors-prop">setAlternatingRowColors</a>().</p>
<h3 class="fn"><a name="expand" />QTreeView.expand (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void expand(const QModelIndex&)</tt>.</p><p>Expands the model item specified by the <i>index</i>.</p>
<p>See also <a href="qtreeview.html#expanded">expanded</a>().</p>
<h3 class="fn"><a name="header" /><a href="qheaderview.html">QHeaderView</a> QTreeView.header (<i>self</i>)</h3><p>Returns the header for the tree view.</p>
<p>See also <a href="qtreeview.html#setHeader">setHeader</a>() and <a href="qabstractitemmodel.html#headerData">QAbstractItemModel.headerData</a>().</p>
<h3 class="fn"><a name="hideColumn" />QTreeView.hideColumn (<i>self</i>, int <i>column</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void hideColumn(int)</tt>.</p><p>Hides the <i>column</i> given.</p>
<p>See also <a href="qtreeview.html#showColumn">showColumn</a>() and <a href="qtreeview.html#setColumnHidden">setColumnHidden</a>().</p>
<h3 class="fn"><a name="horizontalOffset" />int QTreeView.horizontalOffset (<i>self</i>)</h3><p>Returns the horizontal offset of the items in the treeview.</p>
<p>Note that the tree view uses the horizontal header section positions to determine the positions of columns in the view.</p>
<p>Reimplemented from <a href="qabstractitemview.html#horizontalOffset">QAbstractItemView</a>.</p>
<p>See also <a href="qtreeview.html#verticalOffset">verticalOffset</a>().</p>
<h3 class="fn"><a name="horizontalScrollbarAction" />QTreeView.horizontalScrollbarAction (<i>self</i>, int <i>action</i>)</h3><h3 class="fn"><a name="indentation" />int QTreeView.indentation (<i>self</i>)</h3><h3 class="fn"><a name="indexAbove" /><a href="qmodelindex.html">QModelIndex</a> QTreeView.indexAbove (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>Returns the model index of the item above <i>index</i>.</p>
<h3 class="fn"><a name="indexAt" /><a href="qmodelindex.html">QModelIndex</a> QTreeView.indexAt (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>p</i>)</h3><h3 class="fn"><a name="indexBelow" /><a href="qmodelindex.html">QModelIndex</a> QTreeView.indexBelow (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>Returns the model index of the item below <i>index</i>.</p>
<h3 class="fn"><a name="indexRowSizeHint" />int QTreeView.indexRowSizeHint (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>Returns the size hint for the row indicated by <i>index</i>.</p>
<p>See also <a href="qtreeview.html#sizeHintForColumn">sizeHintForColumn</a>() and <a href="qtreeview.html#uniformRowHeights-prop">uniformRowHeights</a>().</p>
<h3 class="fn"><a name="isColumnHidden" />bool QTreeView.isColumnHidden (<i>self</i>, int <i>column</i>)</h3><p>Returns true if the <i>column</i> is hidden; otherwise returns false.</p>
<p>See also <a href="qtreeview.html#hideColumn">hideColumn</a>() and <a href="qtreeview.html#isRowHidden">isRowHidden</a>().</p>
<h3 class="fn"><a name="isExpanded" />bool QTreeView.isExpanded (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>Returns true if the model item <i>index</i> is expanded; otherwise returns false.</p>
<p><font color="red"><b><code>\da</code></b></font><a href="qtreeview.html#expand">expand</a>(), <a href="qtreeview.html#expanded">expanded</a>()</p>
<h3 class="fn"><a name="isIndexHidden" />bool QTreeView.isIndexHidden (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><h3 class="fn"><a name="isRowHidden" />bool QTreeView.isRowHidden (<i>self</i>, int <i>row</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>)</h3><p>Returns true if the item in the given <i>row</i> of the <i>parent</i> is hidden; otherwise returns false.</p>
<p>See also <a href="qtreeview.html#setRowHidden">setRowHidden</a>() and <a href="qtreeview.html#isColumnHidden">isColumnHidden</a>().</p>
<h3 class="fn"><a name="itemsExpandable" />bool QTreeView.itemsExpandable (<i>self</i>)</h3><h3 class="fn"><a name="keyboardSearch" />QTreeView.keyboardSearch (<i>self</i>, <a href="qstring.html">QString</a> <i>search</i>)</h3><h3 class="fn"><a name="mouseDoubleClickEvent" />QTreeView.mouseDoubleClickEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="mousePressEvent" />QTreeView.mousePressEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="mouseReleaseEvent" />QTreeView.mouseReleaseEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a> <i>event</i>)</h3><h3 class="fn"><a name="moveCursor" /><a href="qmodelindex.html">QModelIndex</a> QTreeView.moveCursor (<i>self</i>, <a href="qabstractitemview.html#CursorAction-enum">QAbstractItemView.CursorAction</a> <i>cursorAction</i>, <a href="qt-keyboardmodifiers.html">Qt.KeyboardModifiers</a> <i>modifiers</i>)</h3><p>Move the cursor in the way described by <i>cursorAction</i>, using the information provided by the button <i>modifiers</i>.</p>
<p>Reimplemented from <a href="qabstractitemview.html#moveCursor">QAbstractItemView</a>.</p>
<h3 class="fn"><a name="paintEvent" />QTreeView.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a> <i>e</i>)</h3><h3 class="fn"><a name="reexpand" />QTreeView.reexpand (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void reexpand()</tt>.</p><h3 class="fn"><a name="reset" />QTreeView.reset (<i>self</i>)</h3><h3 class="fn"><a name="resizeColumnToContents" />QTreeView.resizeColumnToContents (<i>self</i>, int <i>column</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void resizeColumnToContents(int)</tt>.</p><p>Resizes the <i>column</i> given to the size of its contents.</p>
<h3 class="fn"><a name="rootIsDecorated" />bool QTreeView.rootIsDecorated (<i>self</i>)</h3><h3 class="fn"><a name="rowsAboutToBeRemoved" />QTreeView.rowsAboutToBeRemoved (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>, int <i>start</i>, int <i>end</i>)</h3><p>Informs the view that the rows from the <i>start</i> row to the <i>end</i> row inclusive are about to removed from the given <i>parent</i> model item.</p>
<p>Reimplemented from <a href="qabstractitemview.html#rowsAboutToBeRemoved">QAbstractItemView</a>.</p>
<h3 class="fn"><a name="rowsInserted" />QTreeView.rowsInserted (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>, int <i>start</i>, int <i>end</i>)</h3><p>Informs the view that the rows from the <i>start</i> row to the <i>end</i> row inclusive have been inserted into the <i>parent</i> model item.</p>
<p>Reimplemented from <a href="qabstractitemview.html#rowsInserted">QAbstractItemView</a>.</p>
<h3 class="fn"><a name="rowsRemoved" />QTreeView.rowsRemoved (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>, int <i>first</i>, int <i>last</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void rowsRemoved(const QModelIndex&,int,int)</tt>.</p><p>Informs the view that the rows from the <i>start</i> row to the <i>end</i> row inclusive have been removed from the given <i>parent</i> model item.</p>
<p>This function was introduced in Qt 4.1.</p>
<h3 class="fn"><a name="scrollContentsBy" />QTreeView.scrollContentsBy (<i>self</i>, int <i>dx</i>, int <i>dy</i>)</h3><p>Scrolls the contents of the tree view by (<i>dx</i>, <i>dy</i>).</p>
<p>Reimplemented from <a href="qabstractscrollarea.html#scrollContentsBy">QAbstractScrollArea</a>.</p>
<h3 class="fn"><a name="scrollTo" />QTreeView.scrollTo (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>, <a href="qabstractitemview.html#ScrollHint-enum">QAbstractItemView.ScrollHint</a> <i>hint</i> = QAbstractItemView.EnsureVisible)</h3><p>Scroll the contents of the tree view until the given model item <i>index</i> is visible. The <i>hint</i> parameter specifies more precisely where the item should be located after the operation. If any of the parents of the model item are collapsed, they will be expanded to ensure that the model item is visible.</p>
<p>Reimplemented from <a href="qabstractitemview.html#scrollTo">QAbstractItemView</a>.</p>
<h3 class="fn"><a name="selectAll" />QTreeView.selectAll (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void selectAll()</tt>.</p><p>Selects all the items in the underlying model.</p>
<p>Reimplemented from <a href="qabstractitemview.html#selectAll">QAbstractItemView</a>.</p>
<h3 class="fn"><a name="selectedIndexes" />QModelIndex-list QTreeView.selectedIndexes (<i>self</i>)</h3><h3 class="fn"><a name="setColumnHidden" />QTreeView.setColumnHidden (<i>self</i>, int <i>column</i>, bool <i>hide</i>)</h3><p>If <i>hide</i> is true the <i>column</i> is hidden, otherwise the <i>column</i> is shown.</p>
<p>See also <a href="qtreeview.html#isColumnHidden">isColumnHidden</a>(), <a href="qtreeview.html#hideColumn">hideColumn</a>(), and <a href="qtreeview.html#setRowHidden">setRowHidden</a>().</p>
<h3 class="fn"><a name="setExpanded" />QTreeView.setExpanded (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>, bool <i>expand</i>)</h3><p>Sets the item referred to by <i>index</i> to either collapse or expanded, depending on the value of <i>expanded</i>.</p>
<p>See also <a href="qtreeview.html#expanded">expanded</a>() and <a href="qtreeview.html#expand">expand</a>().</p>
<h3 class="fn"><a name="setHeader" />QTreeView.setHeader (<i>self</i>, <a href="qheaderview.html">QHeaderView</a> <i>header</i>)</h3><p>Sets the header for the tree view, to the given <i>header</i>.</p>
<p>The view takes ownership over the given <i>header</i> and deletes it when a new header is set.</p>
<p>See also <a href="qabstractitemmodel.html#headerData">QAbstractItemModel.headerData</a>().</p>
<h3 class="fn"><a name="setIndentation" />QTreeView.setIndentation (<i>self</i>, int <i>i</i>)</h3><h3 class="fn"><a name="setItemsExpandable" />QTreeView.setItemsExpandable (<i>self</i>, bool <i>enable</i>)</h3><h3 class="fn"><a name="setModel" />QTreeView.setModel (<i>self</i>, <a href="qabstractitemmodel.html">QAbstractItemModel</a> <i>model</i>)</h3><h3 class="fn"><a name="setRootIndex" />QTreeView.setRootIndex (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><h3 class="fn"><a name="setRootIsDecorated" />QTreeView.setRootIsDecorated (<i>self</i>, bool <i>show</i>)</h3><h3 class="fn"><a name="setRowHidden" />QTreeView.setRowHidden (<i>self</i>, int <i>row</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>, bool <i>hide</i>)</h3><p>If <i>hide</i> is true the <i>row</i> with the given <i>parent</i> is hidden, otherwise the <i>row</i> is shown.</p>
<p>See also <a href="qtreeview.html#isRowHidden">isRowHidden</a>() and <a href="qtreeview.html#setColumnHidden">setColumnHidden</a>().</p>
<h3 class="fn"><a name="setSelection" />QTreeView.setSelection (<i>self</i>, <a href="qrect.html">QRect</a> <i>rect</i>, <a href="qitemselectionmodel-selectionflags.html">QItemSelectionModel.SelectionFlags</a> <i>command</i>)</h3><p>Applies the selection <i>command</i> to the items in or touched by the rectangle, <i>rect</i>.</p>
<p>Reimplemented from <a href="qabstractitemview.html#setSelection">QAbstractItemView</a>.</p>
<p>See also <a href="qabstractitemview.html#selectionCommand">selectionCommand</a>().</p>
<h3 class="fn"><a name="setSelectionModel" />QTreeView.setSelectionModel (<i>self</i>, <a href="qitemselectionmodel.html">QItemSelectionModel</a> <i>selectionModel</i>)</h3><h3 class="fn"><a name="setUniformRowHeights" />QTreeView.setUniformRowHeights (<i>self</i>, bool <i>uniform</i>)</h3><h3 class="fn"><a name="showColumn" />QTreeView.showColumn (<i>self</i>, int <i>column</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void showColumn(int)</tt>.</p><p>Shows the given <i>column</i> in the tree view.</p>
<p>See also <a href="qtreeview.html#hideColumn">hideColumn</a>() and <a href="qtreeview.html#setColumnHidden">setColumnHidden</a>().</p>
<h3 class="fn"><a name="sizeHintForColumn" />int QTreeView.sizeHintForColumn (<i>self</i>, int <i>column</i>)</h3><p>Returns the size hint for the <i>column</i>'s width or -1 if there is no model.</p>
<p>If you need to set the width of a given column to a fixed value, call <a href="qheaderview.html#resizeSection">QHeaderView.resizeSection</a>() on the view's header.</p>
<p>If you reimplement this function in a subclass, note that the value you return is only used when <a href="qtreeview.html#resizeColumnToContents">resizeColumnToContents</a>() is called. In that case, if a larger column width is required by either the view's header or the item delegate, that width will be used instead.</p>
<p>Reimplemented from <a href="qabstractitemview.html#sizeHintForColumn">QAbstractItemView</a>.</p>
<p>See also <a href="qwidget.html#sizeHint-prop">QWidget.sizeHint</a> and <a href="qtreeview.html#header">header</a>().</p>
<h3 class="fn"><a name="sortByColumn" />QTreeView.sortByColumn (<i>self</i>, int <i>column</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void sortByColumn(int)</tt>.</p><p>Sorts the model by the values in the given <i>column</i>.</p>
<h3 class="fn"><a name="timerEvent" />QTreeView.timerEvent (<i>self</i>, <a href="qtimerevent.html">QTimerEvent</a> <i>event</i>)</h3><h3 class="fn"><a name="uniformRowHeights" />bool QTreeView.uniformRowHeights (<i>self</i>)</h3><h3 class="fn"><a name="updateGeometries" />QTreeView.updateGeometries (<i>self</i>)</h3><h3 class="fn"><a name="verticalOffset" />int QTreeView.verticalOffset (<i>self</i>)</h3><p>Returns the vertical offset of the items in the tree view.</p>
<p>Reimplemented from <a href="qabstractitemview.html#verticalOffset">QAbstractItemView</a>.</p>
<p>See also <a href="qtreeview.html#horizontalOffset">horizontalOffset</a>().</p>
<h3 class="fn"><a name="visualRect" /><a href="qrect.html">QRect</a> QTreeView.visualRect (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>Returns the rectangle on the viewport occupied by the item at <i>index</i>. If the index is not visible or explicitly hidden, the returned rectangle is invalid.</p>
<p>Reimplemented from <a href="qabstractitemview.html#visualRect">QAbstractItemView</a>.</p>
<h3 class="fn"><a name="visualRegionForSelection" /><a href="qregion.html">QRegion</a> QTreeView.visualRegionForSelection (<i>self</i>, <a href="qitemselection.html">QItemSelection</a> <i>selection</i>)</h3><p>Returns the rectangle from the viewport of the items in the given <i>selection</i>.</p>
<p>Reimplemented from <a href="qabstractitemview.html#visualRegionForSelection">QAbstractItemView</a>.</p>
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="collapsed" />void collapsed (const QModelIndex&)</h3><p>This signal is emitted when the item specified by <i>index</i> is collapsed.</p>
<h3 class="fn"><a name="expanded" />void expanded (const QModelIndex&)</h3><p>This signal is emitted when the item specified by <i>index</i> is expanded.</p>
<p>See also <a href="qtreeview.html#setExpanded">setExpanded</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt 4.0.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.trolltech.com">Trolltech AS</a> 2006</td><td align="right" width="25%">Qt 4.1.4</td></tr></table></div></address></body></html>
|