6
6
td.postheader { font-family: sans-serif }
7
7
tr.address { font-family: sans-serif }
8
8
body { background: #ffffff; color: black; }
9
</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">QStringListModel Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QStringListModel class provides a model that supplies strings to views. <a href="#details">More...</a></p>
10
<p>Inherits <a href="qabstractlistmodel.html">QAbstractListModel</a>.</p><p>Inherited by <a href="qhelpindexmodel.html">QHelpIndexModel</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qstringlistmodel.html#QStringListModel">__init__</a></b> (<i>self</i>, QObject <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qstringlistmodel.html#QStringListModel-2">__init__</a></b> (<i>self</i>, QStringList, QObject <i>parent</i> = None)</li><li><div class="fn" />QVariant <b><a href="qstringlistmodel.html#data">data</a></b> (<i>self</i>, QModelIndex, int)</li><li><div class="fn" />Qt.ItemFlags <b><a href="qstringlistmodel.html#flags">flags</a></b> (<i>self</i>, QModelIndex)</li><li><div class="fn" />bool <b><a href="qstringlistmodel.html#insertRows">insertRows</a></b> (<i>self</i>, int, int, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qstringlistmodel.html#removeRows">removeRows</a></b> (<i>self</i>, int, int, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />int <b><a href="qstringlistmodel.html#rowCount">rowCount</a></b> (<i>self</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qstringlistmodel.html#setData">setData</a></b> (<i>self</i>, QModelIndex, QVariant, int <i>role</i> = Qt.EditRole)</li><li><div class="fn" /><b><a href="qstringlistmodel.html#setStringList">setStringList</a></b> (<i>self</i>, QStringList)</li><li><div class="fn" /><b><a href="qstringlistmodel.html#sort">sort</a></b> (<i>self</i>, int, Qt.SortOrder <i>order</i> = Qt.AscendingOrder)</li><li><div class="fn" />QStringList <b><a href="qstringlistmodel.html#stringList">stringList</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.DropActions <b><a href="qstringlistmodel.html#supportedDropActions">supportedDropActions</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QStringListModel class provides a model that supplies strings to views.</p>
11
<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>
12
<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>
13
<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>
14
<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>
9
</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">QStringListModel Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QStringListModel class provides a model that supplies
10
strings to views. <a href="#details">More...</a></p>
12
<p>Inherits <a href="qabstractlistmodel.html">QAbstractListModel</a>.</p><p>Inherited by <a href="qhelpindexmodel.html">QHelpIndexModel</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qstringlistmodel.html#QStringListModel">__init__</a></b> (<i>self</i>, QObject <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qstringlistmodel.html#QStringListModel-2">__init__</a></b> (<i>self</i>, QStringList, QObject <i>parent</i> = None)</li><li><div class="fn" />QVariant <b><a href="qstringlistmodel.html#data">data</a></b> (<i>self</i>, QModelIndex, int)</li><li><div class="fn" />Qt.ItemFlags <b><a href="qstringlistmodel.html#flags">flags</a></b> (<i>self</i>, QModelIndex)</li><li><div class="fn" />bool <b><a href="qstringlistmodel.html#insertRows">insertRows</a></b> (<i>self</i>, int, int, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qstringlistmodel.html#removeRows">removeRows</a></b> (<i>self</i>, int, int, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />int <b><a href="qstringlistmodel.html#rowCount">rowCount</a></b> (<i>self</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qstringlistmodel.html#setData">setData</a></b> (<i>self</i>, QModelIndex, QVariant, int <i>role</i> = Qt.EditRole)</li><li><div class="fn" /><b><a href="qstringlistmodel.html#setStringList">setStringList</a></b> (<i>self</i>, QStringList)</li><li><div class="fn" /><b><a href="qstringlistmodel.html#sort">sort</a></b> (<i>self</i>, int, Qt.SortOrder <i>order</i> = Qt.AscendingOrder)</li><li><div class="fn" />QStringList <b><a href="qstringlistmodel.html#stringList">stringList</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.DropActions <b><a href="qstringlistmodel.html#supportedDropActions">supportedDropActions</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QStringListModel class provides a model that supplies
14
<p>QStringListModel is an editable model that can be used for
15
simple cases where you need to display a number of strings in a
16
view widget, such as a <a href="qlistview.html">QListView</a> or a
17
<a href="qcombobox.html">QComboBox</a>.</p>
18
<p>The model provides all the standard functions of an editable
19
model, representing the data in the string list as a model with one
20
column and a number of rows equal to the number of items in the
22
<p>Model indexes corresponding to items are obtained with the
23
<a href="qabstractlistmodel.html#index">index()</a> function, and
24
item flags are obtained with <a href="qstringlistmodel.html#flags">flags</a>(). Item data is read with
25
the <a href="qstringlistmodel.html#data">data</a>() function and
26
written with <a href="qstringlistmodel.html#setData">setData</a>().
27
The number of rows (and number of items in the string list) can be
28
found with the <a href="qstringlistmodel.html#rowCount">rowCount</a>() function.</p>
29
<p>The model can be constructed with an existing string list, or
30
strings can be set later with the <a href="qstringlistmodel.html#setStringList">setStringList</a>()
31
convenience function. Strings can also be inserted in the usual way
32
with the <a href="qstringlistmodel.html#insertRows">insertRows</a>() function, and
33
removed with <a href="qstringlistmodel.html#removeRows">removeRows</a>(). The contents
34
of the string list can be retrieved with the <a href="qstringlistmodel.html#stringList">stringList</a>() convenience
15
36
<p>An example usage of QStringListModel:</p>
16
<pre> QStringListModel *model = new QStringListModel();
37
<pre class="highlightedCode brush: cpp">
38
QStringListModel *model = new QStringListModel();
18
40
list << "a" << "b" << "c";
19
model->setStringList(list);</pre>
20
<p>See also <a href="qabstractlistmodel.html">QAbstractListModel</a>, <a href="qabstractitemmodel.html">QAbstractItemModel</a>, and <a href="model-view-model.html">Model Classes</a>.</p>
21
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QStringListModel" />QStringListModel.__init__ (<i>self</i>, <a href="qobject.html">QObject</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 string list model with the given <i>parent</i>.</p>
22
<h3 class="fn"><a name="QStringListModel-2" />QStringListModel.__init__ (<i>self</i>, QStringList, <a href="qobject.html">QObject</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 string list model containing the specified <i>strings</i> with the given <i>parent</i>.</p>
23
<a name="//apple_ref/cpp/instm/QStringListModel/data" />
41
model->setStringList(list);
42
</pre><hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QStringListModel" />QStringListModel.__init__ (<i>self</i>, <a href="qobject.html">QObject</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 string list model with the given <i>parent</i>.</p>
45
<h3 class="fn"><a name="QStringListModel-2" />QStringListModel.__init__ (<i>self</i>, QStringList, <a href="qobject.html">QObject</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 string list model containing the specified
46
<i>strings</i> with the given <i>parent</i>.</p>
24
49
<h3 class="fn"><a name="data" />QVariant QStringListModel.data (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, int)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#data">QAbstractItemModel.data</a>().</p>
25
<p>Returns data for the specified <i>role</i>, from the item with the given <i>index</i>.</p>
26
<p>If the view requests an invalid index, an invalid variant is returned.</p>
50
<p>Returns data for the specified <i>role</i>, from the item with
51
the given <i>index</i>.</p>
52
<p>If the view requests an invalid index, an invalid variant is
27
54
<p>See also <a href="qstringlistmodel.html#setData">setData</a>().</p>
28
<a name="//apple_ref/cpp/instm/QStringListModel/flags" />
29
57
<h3 class="fn"><a name="flags" /><a href="qt-itemflags.html">Qt.ItemFlags</a> QStringListModel.flags (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#flags">QAbstractItemModel.flags</a>().</p>
30
58
<p>Returns the flags for the item with the given <i>index</i>.</p>
31
<p>Valid items are enabled, selectable, editable, drag enabled and drop enabled.</p>
59
<p>Valid items are enabled, selectable, editable, drag enabled and
32
61
<p>See also <a href="qabstractitemmodel.html#flags">QAbstractItemModel.flags</a>().</p>
33
<a name="//apple_ref/cpp/instm/QStringListModel/insertRows" />
34
64
<h3 class="fn"><a name="insertRows" />bool QStringListModel.insertRows (<i>self</i>, int, int, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#insertRows">QAbstractItemModel.insertRows</a>().</p>
35
<p>Inserts <i>count</i> rows into the model, beginning at the given <i>row</i>.</p>
36
<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>
65
<p>Inserts <i>count</i> rows into the model, beginning at the given
67
<p>The <i>parent</i> index of the rows is optional and is only used
68
for consistency with <a href="qabstractitemmodel.html">QAbstractItemModel</a>. By default, a
69
null index is specified, indicating that the rows are inserted in
70
the top level of the model.</p>
37
71
<p>See also <a href="qabstractitemmodel.html#insertRows">QAbstractItemModel.insertRows</a>().</p>
38
<a name="//apple_ref/cpp/instm/QStringListModel/removeRows" />
39
74
<h3 class="fn"><a name="removeRows" />bool QStringListModel.removeRows (<i>self</i>, int, int, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#removeRows">QAbstractItemModel.removeRows</a>().</p>
40
<p>Removes <i>count</i> rows from the model, beginning at the given <i>row</i>.</p>
41
<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>
75
<p>Removes <i>count</i> rows from the model, beginning at the given
77
<p>The <i>parent</i> index of the rows is optional and is only used
78
for consistency with <a href="qabstractitemmodel.html">QAbstractItemModel</a>. By default, a
79
null index is specified, indicating that the rows are removed in
80
the top level of the model.</p>
42
81
<p>See also <a href="qabstractitemmodel.html#removeRows">QAbstractItemModel.removeRows</a>().</p>
43
<a name="//apple_ref/cpp/instm/QStringListModel/rowCount" />
44
84
<h3 class="fn"><a name="rowCount" />int QStringListModel.rowCount (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#rowCount">QAbstractItemModel.rowCount</a>().</p>
45
<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>
46
<p>The optional <i>parent</i> argument is in most models used to specify the parent of the rows to be counted. Because this is a list if a valid parent is specified, the result will always be 0.</p>
85
<p>Returns the number of rows in the model. This value corresponds
86
to the number of items in the model's internal string list.</p>
87
<p>The optional <i>parent</i> argument is in most models used to
88
specify the parent of the rows to be counted. Because this is a
89
list if a valid parent is specified, the result will always be
47
91
<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>
48
<a name="//apple_ref/cpp/instm/QStringListModel/setData" />
49
94
<h3 class="fn"><a name="setData" />bool QStringListModel.setData (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, QVariant, int <i>role</i> = Qt.EditRole)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#setData">QAbstractItemModel.setData</a>().</p>
50
<p>Sets the data for the specified <i>role</i> in the item with the given <i>index</i> in the model, to the provided <i>value</i>.</p>
51
<p>The <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>() signal is emitted if the item is changed.</p>
95
<p>Sets the data for the specified <i>role</i> in the item with the
96
given <i>index</i> in the model, to the provided <i>value</i>.</p>
97
<p>The <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>() signal is
98
emitted if the item is changed.</p>
52
99
<p>See also <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a> and <a href="qstringlistmodel.html#data">data</a>().</p>
53
<a name="//apple_ref/cpp/instm/QStringListModel/setStringList" />
54
<h3 class="fn"><a name="setStringList" />QStringListModel.setStringList (<i>self</i>, QStringList)</h3><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>
102
<h3 class="fn"><a name="setStringList" />QStringListModel.setStringList (<i>self</i>, QStringList)</h3><p>Sets the model's internal string list to <i>strings</i>. The
103
model will notify any attached views that its underlying data has
55
105
<p>See also <a href="qstringlistmodel.html#stringList">stringList</a>() and <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>().</p>
56
<a name="//apple_ref/cpp/instm/QStringListModel/sort" />
57
108
<h3 class="fn"><a name="sort" />QStringListModel.sort (<i>self</i>, int, <a href="qt.html#SortOrder-enum">Qt.SortOrder</a> <i>order</i> = Qt.AscendingOrder)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#sort">QAbstractItemModel.sort</a>().</p>
58
<a name="//apple_ref/cpp/instm/QStringListModel/stringList" />
59
111
<h3 class="fn"><a name="stringList" />QStringList QStringListModel.stringList (<i>self</i>)</h3><p>Returns the string list used by the model to store data.</p>
60
112
<p>See also <a href="qstringlistmodel.html#setStringList">setStringList</a>().</p>
61
<a name="//apple_ref/cpp/instm/QStringListModel/supportedDropActions" />
62
115
<h3 class="fn"><a name="supportedDropActions" /><a href="qt-dropactions.html">Qt.DropActions</a> QStringListModel.supportedDropActions (<i>self</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#supportedDropActions">QAbstractItemModel.supportedDropActions</a>().</p>
63
<p /><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.7.7 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt 4.6.3</td></tr></table></div></address></body></html>
b'\\ No newline at end of file'
116
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.8.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.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt 4.7.0</td></tr></table></div></address></body></html>
b'\\ No newline at end of file'