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

« back to all changes in this revision

Viewing changes to doc/html/qstringlistmodel.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/gui/itemviews/qstringlistmodel.cpp -->
 
6
<head>
 
7
    <title>Qt 4.0: QStringListModel 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">QStringListModel Class Reference</h1>
 
21
<p>The QStringListModel class provides a model that supplies strings to views. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;QStringListModel&gt;</pre><p>Part of the <a href="qtgui.html">QtGui</a> module.</p>
 
23
<p>Inherits <a href="qabstractlistmodel.html">QAbstractListModel</a>.</p>
 
24
<ul>
 
25
<li><a href="qstringlistmodel-members.html">List of all members, including inherited members</a></li>
 
26
</ul>
 
27
<a name="public-functions"></a>
 
28
<h3>Public Functions</h3>
 
29
<ul>
 
30
<li><div class="fn"/><b><a href="qstringlistmodel.html#QStringListModel">QStringListModel</a></b> ( QObject * <i>parent</i> = 0 )</li>
 
31
<li><div class="fn"/><b><a href="qstringlistmodel.html#QStringListModel-2">QStringListModel</a></b> ( const QStringList &amp; <i>strings</i>, QObject * <i>parent</i> = 0 )</li>
 
32
<li><div class="fn"/>virtual QVariant <b><a href="qstringlistmodel.html#data">data</a></b> ( const QModelIndex &amp; <i>index</i>, int <i>role</i> ) const</li>
 
33
<li><div class="fn"/>virtual Qt::ItemFlags <b><a href="qstringlistmodel.html#flags">flags</a></b> ( const QModelIndex &amp; <i>index</i> ) const</li>
 
34
<li><div class="fn"/>virtual bool <b><a href="qstringlistmodel.html#insertRows">insertRows</a></b> ( int <i>row</i>, int <i>count</i>, const QModelIndex &amp; <i>parent</i> = QModelIndex() )</li>
 
35
<li><div class="fn"/>virtual bool <b><a href="qstringlistmodel.html#removeRows">removeRows</a></b> ( int <i>row</i>, int <i>count</i>, const QModelIndex &amp; <i>parent</i> = QModelIndex() )</li>
 
36
<li><div class="fn"/>virtual int <b><a href="qstringlistmodel.html#rowCount">rowCount</a></b> ( const QModelIndex &amp; <i>parent</i> = QModelIndex() ) const</li>
 
37
<li><div class="fn"/>virtual bool <b><a href="qstringlistmodel.html#setData">setData</a></b> ( const QModelIndex &amp; <i>index</i>, const QVariant &amp; <i>value</i>, int <i>role</i> = Qt::EditRole )</li>
 
38
<li><div class="fn"/>void <b><a href="qstringlistmodel.html#setStringList">setStringList</a></b> ( const QStringList &amp; <i>strings</i> )</li>
 
39
<li><div class="fn"/>QStringList <b><a href="qstringlistmodel.html#stringList">stringList</a></b> () const</li>
 
40
</ul>
 
41
<ul>
 
42
<li><div class="fn"/>1 public function inherited from <a href="qabstractlistmodel.html#public-functions">QAbstractListModel</a></li>
 
43
<li><div class="fn"/>32 public functions inherited from <a href="qabstractitemmodel.html#public-functions">QAbstractItemModel</a></li>
 
44
<li><div class="fn"/>28 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
 
45
</ul>
 
46
<h3>Additional Inherited Members</h3>
 
47
<ul>
 
48
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
 
49
<li><div class="fn"/>2 public slots inherited from <a href="qabstractitemmodel.html#public-slots">QAbstractItemModel</a></li>
 
50
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
 
51
<li><div class="fn"/>3 signals inherited from <a href="qabstractitemmodel.html#signals">QAbstractItemModel</a></li>
 
52
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
 
53
<li><div class="fn"/>4 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
 
54
<li><div class="fn"/>12 protected functions inherited from <a href="qabstractitemmodel.html#protected-functions">QAbstractItemModel</a></li>
 
55
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
 
56
</ul>
 
57
<a name="details"></a>
 
58
<hr />
 
59
<h2>Detailed Description</h2>
 
60
<p>The QStringListModel class provides a model that supplies strings to views.</p>
 
61
<p>QStringListModel is an editable model that can be used for simple cases where you need to display a number of strings in a view widget, such as a <a href="qlistview.html">QListView</a> or a <a href="qcombobox.html">QComboBox</a>.</p>
 
62
<p>The model provides all the standard functions of an editable model, representing the data in the string list as a model with one column and a number of rows equal to the number of items in the list.</p>
 
63
<p>Model indexes corresponding to items are obtained with the <a href="qabstractlistmodel.html#index">index()</a> function, and item flags are obtained with <a href="qstringlistmodel.html#flags">flags</a>(). Item data is read with the <a href="qstringlistmodel.html#data">data</a>() function and written with <a href="qstringlistmodel.html#setData">setData</a>(). The number of rows (and number of items in the string list) can be found with the <a href="qstringlistmodel.html#rowCount">rowCount</a>() function.</p>
 
64
<p>The model can be constructed with an existing string list, or strings can be set later with the <a href="qstringlistmodel.html#setStringList">setStringList</a>() convenience function. Strings can also be inserted in the usual way with the <a href="qstringlistmodel.html#insertRows">insertRows</a>() function, and removed with <a href="qstringlistmodel.html#removeRows">removeRows</a>(). The contents of the string list can be retrieved with the <a href="qstringlistmodel.html#stringList">stringList</a>() convenience function.</p>
 
65
<p>See also <a href="qabstractlistmodel.html">QAbstractListModel</a> and <a href="qabstractitemmodel.html">QAbstractItemModel</a>.</p>
 
66
<hr />
 
67
<h2>Member Function Documentation</h2>
 
68
<h3 class="fn"><a name="QStringListModel"></a>QStringListModel::QStringListModel ( <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
 
69
<p>Constructs a string list model with the given <i>parent</i>.</p>
 
70
<h3 class="fn"><a name="QStringListModel-2"></a>QStringListModel::QStringListModel ( const <a href="qstringlist.html">QStringList</a> &amp; <i>strings</i>, <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
 
71
<p>Constructs a string list model containing the specified <i>strings</i> with the given <i>parent</i>.</p>
 
72
<h3 class="fn"><a name="data"></a><a href="qvariant.html">QVariant</a> QStringListModel::data ( const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>index</i>, int <i>role</i> ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
73
<p>Returns data from the item with the given <i>index</i> for the specified <i>role</i>.</p>
 
74
<p>If the view requests an invalid index, an invalid variant is returned.</p>
 
75
<p>Reimplemented from <a href="qabstractitemmodel.html#data">QAbstractItemModel</a>.</p>
 
76
<p>See also <a href="qstringlistmodel.html#setData">setData</a>().</p>
 
77
<h3 class="fn"><a name="flags"></a><a href="qt.html#ItemFlag-enum">Qt::ItemFlags</a> QStringListModel::flags ( const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>index</i> ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
78
<p>Returns the flags for the item that corresponds to the given <i>index</i>.</p>
 
79
<p>Valid items are enabled, selectable, and editable.</p>
 
80
<p>Reimplemented from <a href="qabstractitemmodel.html#flags">QAbstractItemModel</a>.</p>
 
81
<h3 class="fn"><a name="insertRows"></a>bool QStringListModel::insertRows ( int <i>row</i>, int <i>count</i>, const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>parent</i> = QModelIndex() )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
82
<p>Inserts <i>count</i> rows into the model beginning at the given <i>row</i>.</p>
 
83
<p>The <i>parent</i> index of the rows is optional and is only used for consistency with <a href="qabstractitemmodel.html">QAbstractItemModel</a>. By default, a null index is specified, indicating that the rows are inserted in the top level of the model.</p>
 
84
<p>Reimplemented from <a href="qabstractitemmodel.html#insertRows">QAbstractItemModel</a>.</p>
 
85
<p>See also <a href="qabstractitemmodel.html#insertRows">QAbstractItemModel::insertRows</a>().</p>
 
86
<h3 class="fn"><a name="removeRows"></a>bool QStringListModel::removeRows ( int <i>row</i>, int <i>count</i>, const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>parent</i> = QModelIndex() )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
87
<p>Removes <i>count</i> rows from the model beginning at the given <i>row</i>.</p>
 
88
<p>The <i>parent</i> index of the rows is optional and is only used for consistency with <a href="qabstractitemmodel.html">QAbstractItemModel</a>. By default, a null index is specified, indicating that the rows are removed in the top level of the model.</p>
 
89
<p>Reimplemented from <a href="qabstractitemmodel.html#removeRows">QAbstractItemModel</a>.</p>
 
90
<p>See also <a href="qabstractitemmodel.html#removeRows">QAbstractItemModel::removeRows</a>().</p>
 
91
<h3 class="fn"><a name="rowCount"></a>int QStringListModel::rowCount ( const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>parent</i> = QModelIndex() ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
92
<p>Returns the number of rows in the model. This value corresponds to the number of items in the model's internal string list.</p>
 
93
<p>The optional <i>parent</i> argument is used in most models to specify the parent of the rows to be counted. In this model, the parent is ignored.</p>
 
94
<p>Reimplemented from <a href="qabstractitemmodel.html#rowCount">QAbstractItemModel</a>.</p>
 
95
<p>See also <a href="qstringlistmodel.html#insertRows">insertRows</a>(), <a href="qstringlistmodel.html#removeRows">removeRows</a>(), and <a href="qabstractitemmodel.html#rowCount">QAbstractItemModel::rowCount</a>().</p>
 
96
<h3 class="fn"><a name="setData"></a>bool QStringListModel::setData ( const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>index</i>, const <a href="qvariant.html">QVariant</a> &amp; <i>value</i>, int <i>role</i> = Qt::EditRole )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
97
<p>Sets the data for the item corresponding to the given <i>index</i> in the model to the <i>value</i> for the specifed <i>role</i>.</p>
 
98
<p>The <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>() signal is emitted if the item is changed.</p>
 
99
<p>Reimplemented from <a href="qabstractitemmodel.html#setData">QAbstractItemModel</a>.</p>
 
100
<p>See also <a href="qstringlistmodel.html#data">data</a>().</p>
 
101
<h3 class="fn"><a name="setStringList"></a>void QStringListModel::setStringList ( const <a href="qstringlist.html">QStringList</a> &amp; <i>strings</i> )</h3>
 
102
<p>Sets the model's internal string list to <i>strings</i>. The model will notify any attached views that its underlying data has changed.</p>
 
103
<p>See also <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>().</p>
 
104
<h3 class="fn"><a name="stringList"></a><a href="qstringlist.html">QStringList</a> QStringListModel::stringList () const</h3>
 
105
<p>Returns the string list used by the model to store data.</p>
 
106
<p /><address><hr /><div align="center">
 
107
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
108
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
109
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
110
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
111
</tr></table></div></address></body>
 
112
</html>