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 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qidentityproxymodel.cpp -->
<title>Qt 4.8: QIdentityProxyModel Class Reference</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QIdentityProxyModel</li>
</ul>
</div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QIdentityProxyModel Class Reference</h1>
<!-- $$$QIdentityProxyModel-brief -->
<p>The QIdentityProxyModel class proxies its source model unmodified <a href="#details">More...</a></p>
<!-- @@@QIdentityProxyModel -->
<pre class="cpp"> <span class="preprocessor">#include <QIdentityProxyModel></span></pre><p><b>Inherits: </b><a href="qabstractproxymodel.html">QAbstractProxyModel</a>.</p>
<p>This class was introduced in Qt 4.8.</p>
<ul>
<li><a href="qidentityproxymodel-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qidentityproxymodel.html#QIdentityProxyModel">QIdentityProxyModel</a></b> ( QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qidentityproxymodel.html#dtor.QIdentityProxyModel">~QIdentityProxyModel</a></b> ()</td></tr>
</table>
<a name="reimplemented-public-functions"></a>
<h2>Reimplemented Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qidentityproxymodel.html#columnCount">columnCount</a></b> ( const QModelIndex & <i>parent</i> = QModelIndex() ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qidentityproxymodel.html#dropMimeData">dropMimeData</a></b> ( const QMimeData * <i>data</i>, Qt::DropAction <i>action</i>, int <i>row</i>, int <i>column</i>, const QModelIndex & <i>parent</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QModelIndex </td><td class="memItemRight bottomAlign"><b><a href="qidentityproxymodel.html#index">index</a></b> ( int <i>row</i>, int <i>column</i>, const QModelIndex & <i>parent</i> = QModelIndex() ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qidentityproxymodel.html#insertColumns">insertColumns</a></b> ( int <i>column</i>, int <i>count</i>, const QModelIndex & <i>parent</i> = QModelIndex() )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qidentityproxymodel.html#insertRows">insertRows</a></b> ( int <i>row</i>, int <i>count</i>, const QModelIndex & <i>parent</i> = QModelIndex() )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QModelIndex </td><td class="memItemRight bottomAlign"><b><a href="qidentityproxymodel.html#mapFromSource">mapFromSource</a></b> ( const QModelIndex & <i>sourceIndex</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QItemSelection </td><td class="memItemRight bottomAlign"><b><a href="qidentityproxymodel.html#mapSelectionFromSource">mapSelectionFromSource</a></b> ( const QItemSelection & <i>selection</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QItemSelection </td><td class="memItemRight bottomAlign"><b><a href="qidentityproxymodel.html#mapSelectionToSource">mapSelectionToSource</a></b> ( const QItemSelection & <i>selection</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QModelIndex </td><td class="memItemRight bottomAlign"><b><a href="qidentityproxymodel.html#mapToSource">mapToSource</a></b> ( const QModelIndex & <i>proxyIndex</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QModelIndexList </td><td class="memItemRight bottomAlign"><b><a href="qidentityproxymodel.html#match">match</a></b> ( const QModelIndex & <i>start</i>, int <i>role</i>, const QVariant & <i>value</i>, int <i>hits</i> = 1, Qt::MatchFlags <i>flags</i> = Qt::MatchFlags( Qt::MatchStartsWith | Qt::MatchWrap ) ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QModelIndex </td><td class="memItemRight bottomAlign"><b><a href="qidentityproxymodel.html#parent">parent</a></b> ( const QModelIndex & <i>child</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qidentityproxymodel.html#removeColumns">removeColumns</a></b> ( int <i>column</i>, int <i>count</i>, const QModelIndex & <i>parent</i> = QModelIndex() )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qidentityproxymodel.html#removeRows">removeRows</a></b> ( int <i>row</i>, int <i>count</i>, const QModelIndex & <i>parent</i> = QModelIndex() )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qidentityproxymodel.html#rowCount">rowCount</a></b> ( const QModelIndex & <i>parent</i> = QModelIndex() ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qidentityproxymodel.html#setSourceModel">setSourceModel</a></b> ( QAbstractItemModel * <i>newSourceModel</i> )</td></tr>
</table>
<ul>
<li class="fn">24 public functions inherited from <a href="qabstractproxymodel.html#public-functions">QAbstractProxyModel</a></li>
<li class="fn">35 public functions inherited from <a href="qabstractitemmodel.html#public-functions">QAbstractItemModel</a></li>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li class="fn">2 public slots inherited from <a href="qabstractitemmodel.html#public-slots">QAbstractItemModel</a></li>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li class="fn">18 signals inherited from <a href="qabstractitemmodel.html#signals">QAbstractItemModel</a></li>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li class="fn">21 protected functions inherited from <a href="qabstractitemmodel.html#protected-functions">QAbstractItemModel</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
<li class="fn">1 protected slot inherited from <a href="qabstractitemmodel.html#protected-slots">QAbstractItemModel</a></li>
</ul>
<a name="details"></a>
<!-- $$$QIdentityProxyModel-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QIdentityProxyModel class proxies its source model unmodified</p>
<p>QIdentityProxyModel can be used to forward the structure of a source model exactly, with no sorting, filtering or other transformation. This is similar in concept to an identity matrix where A.I = A.</p>
<p>Because it does no sorting or filtering, this class is most suitable to proxy models which transform the <a href="qabstractproxymodel.html#data">data</a>() of the source model. For example, a proxy model could be created to define the font used, or the background colour, or the tooltip etc. This removes the need to implement all data handling in the same class that creates the structure of the model, and can also be used to create re-usable components.</p>
<p>This also provides a way to change the data in the case where a source model is supplied by a third party which can not be modified.</p>
<pre class="cpp"> <span class="keyword">class</span> DateFormatProxyModel : <span class="keyword">public</span> <span class="type">QIdentityProxyModel</span>
{
<span class="comment">// ...</span>
<span class="type">void</span> setDateFormatString(<span class="keyword">const</span> <span class="type"><a href="qstring.html">QString</a></span> <span class="operator">&</span>formatString)
{
m_formatString <span class="operator">=</span> formatString;
}
<span class="type"><a href="qvariant.html">QVariant</a></span> data(<span class="keyword">const</span> <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> <span class="operator">&</span>index<span class="operator">,</span> <span class="type">int</span> role)
{
<span class="keyword">if</span> (role <span class="operator">!</span><span class="operator">=</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>DisplayRole)
<span class="keyword">return</span> <span class="type">QIdentityProxyModel</span><span class="operator">::</span>data(index<span class="operator">,</span> role);
<span class="keyword">const</span> <span class="type"><a href="qdatetime.html">QDateTime</a></span> dateTime <span class="operator">=</span> sourceModel()<span class="operator">-</span><span class="operator">></span>data(SourceClass<span class="operator">::</span>DateRole)<span class="operator">.</span>toDateTime();
<span class="keyword">return</span> dateTime<span class="operator">.</span>toString(m_formatString);
}
<span class="keyword">private</span>:
<span class="type"><a href="qstring.html">QString</a></span> m_formatString;
};</pre>
</div>
<p><b>See also </b><a href="qabstractproxymodel.html">QAbstractProxyModel</a>, <a href="model-view-programming.html">Model/View Programming</a>, and <a href="qabstractitemmodel.html">QAbstractItemModel</a>.</p>
<!-- @@@QIdentityProxyModel -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QIdentityProxyModel[overload1]$$$QIdentityProxyModelQObject* -->
<h3 class="fn"><a name="QIdentityProxyModel"></a>QIdentityProxyModel::<span class="name">QIdentityProxyModel</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0 )</h3>
<p>Constructs an identity model with the given <i>parent</i>.</p>
<!-- @@@QIdentityProxyModel -->
<!-- $$$~QIdentityProxyModel[overload1]$$$~QIdentityProxyModel -->
<h3 class="fn"><a name="dtor.QIdentityProxyModel"></a>QIdentityProxyModel::<span class="name">~QIdentityProxyModel</span> ()</h3>
<p>Destroys this identity model.</p>
<!-- @@@~QIdentityProxyModel -->
<!-- $$$columnCount[overload1]$$$columnCountconstQModelIndex& -->
<h3 class="fn"><a name="columnCount"></a><span class="type">int</span> QIdentityProxyModel::<span class="name">columnCount</span> ( const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> & <i>parent</i> = QModelIndex() ) const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qabstractitemmodel.html#columnCount">QAbstractItemModel::columnCount</a>().</p>
<!-- @@@columnCount -->
<!-- $$$dropMimeData[overload1]$$$dropMimeDataconstQMimeData*Qt::DropActionintintconstQModelIndex& -->
<h3 class="fn"><a name="dropMimeData"></a><span class="type">bool</span> QIdentityProxyModel::<span class="name">dropMimeData</span> ( const <span class="type"><a href="qmimedata.html">QMimeData</a></span> * <i>data</i>, <span class="type"><a href="qt.html#DropAction-enum">Qt::DropAction</a></span> <i>action</i>, <span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>column</i>, const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> & <i>parent</i> )<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qabstractitemmodel.html#dropMimeData">QAbstractItemModel::dropMimeData</a>().</p>
<!-- @@@dropMimeData -->
<!-- $$$index[overload1]$$$indexintintconstQModelIndex& -->
<h3 class="fn"><a name="index"></a><span class="type"><a href="qmodelindex.html">QModelIndex</a></span> QIdentityProxyModel::<span class="name">index</span> ( <span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>column</i>, const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> & <i>parent</i> = QModelIndex() ) const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qabstractitemmodel.html#index">QAbstractItemModel::index</a>().</p>
<!-- @@@index -->
<!-- $$$insertColumns[overload1]$$$insertColumnsintintconstQModelIndex& -->
<h3 class="fn"><a name="insertColumns"></a><span class="type">bool</span> QIdentityProxyModel::<span class="name">insertColumns</span> ( <span class="type">int</span> <i>column</i>, <span class="type">int</span> <i>count</i>, const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> & <i>parent</i> = QModelIndex() )<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qabstractitemmodel.html#insertColumns">QAbstractItemModel::insertColumns</a>().</p>
<!-- @@@insertColumns -->
<!-- $$$insertRows[overload1]$$$insertRowsintintconstQModelIndex& -->
<h3 class="fn"><a name="insertRows"></a><span class="type">bool</span> QIdentityProxyModel::<span class="name">insertRows</span> ( <span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>count</i>, const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> & <i>parent</i> = QModelIndex() )<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qabstractitemmodel.html#insertRows">QAbstractItemModel::insertRows</a>().</p>
<!-- @@@insertRows -->
<!-- $$$mapFromSource[overload1]$$$mapFromSourceconstQModelIndex& -->
<h3 class="fn"><a name="mapFromSource"></a><span class="type"><a href="qmodelindex.html">QModelIndex</a></span> QIdentityProxyModel::<span class="name">mapFromSource</span> ( const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> & <i>sourceIndex</i> ) const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qabstractproxymodel.html#mapFromSource">QAbstractProxyModel::mapFromSource</a>().</p>
<!-- @@@mapFromSource -->
<!-- $$$mapSelectionFromSource[overload1]$$$mapSelectionFromSourceconstQItemSelection& -->
<h3 class="fn"><a name="mapSelectionFromSource"></a><span class="type"><a href="qitemselection.html">QItemSelection</a></span> QIdentityProxyModel::<span class="name">mapSelectionFromSource</span> ( const <span class="type"><a href="qitemselection.html">QItemSelection</a></span> & <i>selection</i> ) const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qabstractproxymodel.html#mapSelectionFromSource">QAbstractProxyModel::mapSelectionFromSource</a>().</p>
<!-- @@@mapSelectionFromSource -->
<!-- $$$mapSelectionToSource[overload1]$$$mapSelectionToSourceconstQItemSelection& -->
<h3 class="fn"><a name="mapSelectionToSource"></a><span class="type"><a href="qitemselection.html">QItemSelection</a></span> QIdentityProxyModel::<span class="name">mapSelectionToSource</span> ( const <span class="type"><a href="qitemselection.html">QItemSelection</a></span> & <i>selection</i> ) const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qabstractproxymodel.html#mapSelectionToSource">QAbstractProxyModel::mapSelectionToSource</a>().</p>
<!-- @@@mapSelectionToSource -->
<!-- $$$mapToSource[overload1]$$$mapToSourceconstQModelIndex& -->
<h3 class="fn"><a name="mapToSource"></a><span class="type"><a href="qmodelindex.html">QModelIndex</a></span> QIdentityProxyModel::<span class="name">mapToSource</span> ( const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> & <i>proxyIndex</i> ) const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qabstractproxymodel.html#mapToSource">QAbstractProxyModel::mapToSource</a>().</p>
<!-- @@@mapToSource -->
<!-- $$$match[overload1]$$$matchconstQModelIndex&intconstQVariant&intQt::MatchFlags -->
<h3 class="fn"><a name="match"></a><span class="type"><a href="qmodelindex.html#QModelIndexList-typedef">QModelIndexList</a></span> QIdentityProxyModel::<span class="name">match</span> ( const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> & <i>start</i>, <span class="type">int</span> <i>role</i>, const <span class="type"><a href="qvariant.html">QVariant</a></span> & <i>value</i>, <span class="type">int</span> <i>hits</i> = 1, <span class="type"><a href="qt.html#MatchFlag-enum">Qt::MatchFlags</a></span> <i>flags</i> = Qt::MatchFlags( Qt::MatchStartsWith | Qt::MatchWrap ) ) const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qabstractitemmodel.html#match">QAbstractItemModel::match</a>().</p>
<!-- @@@match -->
<!-- $$$parent[overload1]$$$parentconstQModelIndex& -->
<h3 class="fn"><a name="parent"></a><span class="type"><a href="qmodelindex.html">QModelIndex</a></span> QIdentityProxyModel::<span class="name">parent</span> ( const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> & <i>child</i> ) const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qabstractitemmodel.html#parent">QAbstractItemModel::parent</a>().</p>
<!-- @@@parent -->
<!-- $$$removeColumns[overload1]$$$removeColumnsintintconstQModelIndex& -->
<h3 class="fn"><a name="removeColumns"></a><span class="type">bool</span> QIdentityProxyModel::<span class="name">removeColumns</span> ( <span class="type">int</span> <i>column</i>, <span class="type">int</span> <i>count</i>, const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> & <i>parent</i> = QModelIndex() )<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qabstractitemmodel.html#removeColumns">QAbstractItemModel::removeColumns</a>().</p>
<!-- @@@removeColumns -->
<!-- $$$removeRows[overload1]$$$removeRowsintintconstQModelIndex& -->
<h3 class="fn"><a name="removeRows"></a><span class="type">bool</span> QIdentityProxyModel::<span class="name">removeRows</span> ( <span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>count</i>, const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> & <i>parent</i> = QModelIndex() )<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qabstractitemmodel.html#removeRows">QAbstractItemModel::removeRows</a>().</p>
<!-- @@@removeRows -->
<!-- $$$rowCount[overload1]$$$rowCountconstQModelIndex& -->
<h3 class="fn"><a name="rowCount"></a><span class="type">int</span> QIdentityProxyModel::<span class="name">rowCount</span> ( const <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> & <i>parent</i> = QModelIndex() ) const<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qabstractitemmodel.html#rowCount">QAbstractItemModel::rowCount</a>().</p>
<!-- @@@rowCount -->
<!-- $$$setSourceModel[overload1]$$$setSourceModelQAbstractItemModel* -->
<h3 class="fn"><a name="setSourceModel"></a><span class="type">void</span> QIdentityProxyModel::<span class="name">setSourceModel</span> ( <span class="type"><a href="qabstractitemmodel.html">QAbstractItemModel</a></span> * <i>newSourceModel</i> )<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qabstractproxymodel.html#setSourceModel">QAbstractProxyModel::setSourceModel</a>().</p>
<!-- @@@setSourceModel -->
</div>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2012 Nokia Corporation and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.</p>
<br />
<p>
The documentation provided herein is licensed under the terms of the
<a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
License version 1.3</a> as published by the Free Software Foundation.</p>
<p>
Documentation sources may be obtained from <a href="http://www.qt-project.org">
www.qt-project.org</a>.</p>
<br />
<p>
Nokia, Qt and their respective logos are trademarks of Nokia Corporation
in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. <a title="Privacy Policy"
href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>
|