~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qabstracttablemodel.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/corelib/kernel/qabstractitemmodel.cpp -->
 
6
<head>
 
7
    <title>Qt 4.0: QAbstractTableModel Class Reference</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QAbstractTableModel Class Reference</h1>
 
21
<p>The QAbstractTableModel class provides an abstract model that can be subclassed to create table models. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;QAbstractTableModel&gt;</pre><p>Part of the <a href="qtcore.html">QtCore</a> module.</p>
 
23
<p>Inherits <a href="qabstractitemmodel.html">QAbstractItemModel</a>.</p>
 
24
<p>Inherited by <a href="qsqlquerymodel.html">QSqlQueryModel</a>.</p>
 
25
<ul>
 
26
<li><a href="qabstracttablemodel-members.html">List of all members, including inherited members</a></li>
 
27
</ul>
 
28
<a name="public-functions"></a>
 
29
<h3>Public Functions</h3>
 
30
<ul>
 
31
<li><div class="fn"/><b><a href="qabstracttablemodel.html#QAbstractTableModel">QAbstractTableModel</a></b> ( QObject * <i>parent</i> = 0 )</li>
 
32
<li><div class="fn"/><b><a href="qabstracttablemodel.html#dtor.QAbstractTableModel">~QAbstractTableModel</a></b> ()</li>
 
33
<li><div class="fn"/>virtual QModelIndex <b><a href="qabstracttablemodel.html#index">index</a></b> ( int <i>row</i>, int <i>column</i>, const QModelIndex &amp; <i>parent</i> = QModelIndex() ) const</li>
 
34
</ul>
 
35
<ul>
 
36
<li><div class="fn"/>32 public functions inherited from <a href="qabstractitemmodel.html#public-functions">QAbstractItemModel</a></li>
 
37
<li><div class="fn"/>28 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
 
38
</ul>
 
39
<h3>Additional Inherited Members</h3>
 
40
<ul>
 
41
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
 
42
<li><div class="fn"/>2 public slots inherited from <a href="qabstractitemmodel.html#public-slots">QAbstractItemModel</a></li>
 
43
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
 
44
<li><div class="fn"/>3 signals inherited from <a href="qabstractitemmodel.html#signals">QAbstractItemModel</a></li>
 
45
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
 
46
<li><div class="fn"/>4 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
 
47
<li><div class="fn"/>12 protected functions inherited from <a href="qabstractitemmodel.html#protected-functions">QAbstractItemModel</a></li>
 
48
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
 
49
</ul>
 
50
<a name="details"></a>
 
51
<hr />
 
52
<h2>Detailed Description</h2>
 
53
<p>The QAbstractTableModel class provides an abstract model that can be subclassed to create table models.</p>
 
54
<p>QAbstractTableModel provides a standard interface for models that represent their data as a two-dimensional array of items. It is not used directly, but must be subclassed.</p>
 
55
<p>Since the model provides a more specialized interface than <a href="qabstractitemmodel.html">QAbstractItemModel</a>, it is not suitable for use with tree views, although it can be used to provide data to a <a href="qlistview.html">QListView</a>. If you need to represent a simple list of items, and only need a model to contain a single column of data, subclassing the <a href="qabstractlistmodel.html">QAbstractListModel</a> may be more appropriate.</p>
 
56
<p>The <a href="qabstractitemmodel.html#rowCount">rowCount</a>() and <a href="qabstractitemmodel.html#columnCount">columnCount</a>() functions return the dimensions of the table. To retrieve a model index corresponding to an item in the model, use <a href="qabstracttablemodel.html#index">index</a>() and provide only the row and column numbers.</p>
 
57
<a name="subclassing"></a>
 
58
<h3>Subclassing</h3>
 
59
<p>When subclassing QAbstractTableModel, you must implement <a href="qabstractitemmodel.html#rowCount">rowCount</a>(), <a href="qabstractitemmodel.html#columnCount">columnCount</a>(), and <a href="qabstractitemmodel.html#data">data</a>(). Default implementations of the <a href="qabstracttablemodel.html#index">index</a>() and <a href="qabstracttablemodel.html#parent">parent</a>() functions are provided by QAbstractTableModel. Well behaved models will also implement <a href="qabstractitemmodel.html#headerData">headerData</a>().</p>
 
60
<p>Editable models need to implement <a href="qabstractitemmodel.html#setData">setData</a>(), and implement <a href="qabstractitemmodel.html#flags">flags</a>() to return a value containing <a href="qt.html#ItemFlag-enum">Qt::ItemIsEditable</a>.</p>
 
61
<p>Models that provide interfaces to resizable data structures can provide implementations of <a href="qabstractitemmodel.html#insertRows">insertRows</a>(), <a href="qabstractitemmodel.html#removeRows">removeRows</a>(), <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(), and <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>(). When implementing these functions, it is important to call the appropriate functions so that all connected views are aware of any changes:</p>
 
62
<ul>
 
63
<li>An <a href="qabstractitemmodel.html#insertRows">insertRows</a>() implementation must call <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>() <i>before</i> inserting new rows into the data structure, and it must call <a href="qabstractitemmodel.html#endInsertRows">endInsertRows</a>() <i>immediately afterwards</i>.</li>
 
64
<li>An <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>() implementation must call <a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a>() <i>before</i> inserting new columns into the data structure, and it must call <a href="qabstractitemmodel.html#endInsertColumns">endInsertColumns</a>() <i>immediately afterwards</i>.</li>
 
65
<li>A <a href="qabstractitemmodel.html#removeRows">removeRows</a>() implementation must call <a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a>() <i>before</i> the rows are removed from the data structure, and it must call <a href="qabstractitemmodel.html#endRemoveRows">endRemoveRows</a>() <i>immediately afterwards</i>.</li>
 
66
<li>A <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>() implementation must call <a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a>() <i>before</i> the columns are removed from the data structure, and it must call <a href="qabstractitemmodel.html#endRemoveColumns">endRemoveColumns</a>() <i>immediately afterwards</i>.</li>
 
67
</ul>
 
68
<p>See also <a href="model-view-programming.html">Model/View Programming</a>, <a href="qabstractitemmodel.html">QAbstractItemModel</a>, and <a href="qabstractlistmodel.html">QAbstractListModel</a>.</p>
 
69
<hr />
 
70
<h2>Member Function Documentation</h2>
 
71
<h3 class="fn"><a name="QAbstractTableModel"></a>QAbstractTableModel::QAbstractTableModel ( <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
 
72
<p>Constructs an abstract table model for the given <i>parent</i>.</p>
 
73
<h3 class="fn"><a name="dtor.QAbstractTableModel"></a>QAbstractTableModel::~QAbstractTableModel ()</h3>
 
74
<p>Destroys the abstract table model.</p>
 
75
<h3 class="fn"><a name="index"></a><a href="qmodelindex.html">QModelIndex</a> QAbstractTableModel::index ( int <i>row</i>, int <i>column</i>, const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>parent</i> = QModelIndex() ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
76
<p>Returns the index of the data in <i>row</i> and <i>column</i> with <i>parent</i>.</p>
 
77
<p>Reimplemented from <a href="qabstractitemmodel.html#index">QAbstractItemModel</a>.</p>
 
78
<p>See also <a href="qabstracttablemodel.html#parent">parent</a>().</p>
 
79
<p /><address><hr /><div align="center">
 
80
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
81
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
82
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
83
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
84
</tr></table></div></address></body>
 
85
</html>