<class name="QStringListModel" doc="/** <p>The <a href="QStringListModel.html#QStringListModel(java.util.List<java.lang.String>, com.trolltech.qt.core.QObject)"><tt>QStringListModel</tt></a> class provides a model that supplies strings to views.</p> <p><a href="QStringListModel.html#QStringListModel(java.util.List<java.lang.String>, com.trolltech.qt.core.QObject)"><tt>QStringListModel</tt></a> 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"><tt>QListView</tt></a> or a <a href="QComboBox.html"><tt>QComboBox</tt></a>.</p> <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> <p>Model indexes corresponding to items are obtained with the index() function, and item flags are obtained with <a href="QStringListModel.html#flags(com.trolltech.qt.core.QModelIndex)"><tt>flags</tt></a>. Item data is read with the <a href="QStringListModel.html#data(com.trolltech.qt.core.QModelIndex, int)"><tt>data</tt></a> function and written with <a href="QStringListModel.html#setData(com.trolltech.qt.core.QModelIndex, java.lang.Object, int)"><tt>setData</tt></a>. The number of rows (and number of items in the string list) can be found with the <a href="QStringListModel.html#rowCount(com.trolltech.qt.core.QModelIndex)"><tt>rowCount</tt></a> function.</p> <p>The model can be constructed with an existing string list, or strings can be set later with the <a href="QStringListModel.html#setStringList(java.util.List<java.lang.String>)"><tt>setStringList</tt></a> convenience function. Strings can also be inserted in the usual way with the <a href="QStringListModel.html#insertRows(int, int, com.trolltech.qt.core.QModelIndex)"><tt>insertRows</tt></a> function, and removed with <a href="QStringListModel.html#removeRows(int, int, com.trolltech.qt.core.QModelIndex)"><tt>removeRows</tt></a>. The contents of the string list can be retrieved with the <a href="QStringListModel.html#stringList()"><tt>stringList</tt></a> convenience function.</p> <p>An example usage of <a href="QStringListModel.html#QStringListModel(java.util.List<java.lang.String>, com.trolltech.qt.core.QObject)"><tt>QStringListModel</tt></a>:</p> <pre> QStringListModel *model = new QStringListModel(); QStringList list; list &lt;&lt; &quot;a&quot; &lt;&lt; &quot;b&quot; &lt;&lt; &quot;c&quot;; model-&gt;setStringList(list);</pre> @see <a href="%2E%2E/core/%2E%2E/core/QAbstractListModel.html#QAbstractListModel(com.trolltech.qt.core.QObject)"><tt>QAbstractListModel</tt></a> @see <a href="%2E%2E/core/%2E%2E/core/QAbstractItemModel.html#QAbstractItemModel(com.trolltech.qt.core.QObject)"><tt>QAbstractItemModel</tt></a> @see <a href="%2E%2E/model-view-model.html">Model Classes</tt></a> */"> <signal name="protected final void dataChanged(com.trolltech.qt.core.QModelIndex topLeft, com.trolltech.qt.core.QModelIndex bottomRight)" doc="/** <p>This signal is emitted whenever the data in an existing item changes. The affected items are those between <tt>topLeft</tt> and <tt>bottomRight</tt> inclusive (of the same parent).</p> <p>Note that this signal must be emitted explicitly when reimplementing the <a href="QStringListModel.html#setData(com.trolltech.qt.core.QModelIndex, java.lang.Object, int)"><tt>setData</tt></a> function.</p> <dl> <dt><b>Compatible Slot Signatures:</b></dt> <dd><tt>void mySlot(com.trolltech.qt.core.QModelIndex topLeft, com.trolltech.qt.core.QModelIndex bottomRight)</tt></dd> <dd><tt>void mySlot(com.trolltech.qt.core.QModelIndex topLeft)</tt></dd> <dd><tt>void mySlot()</tt></dd> </dl> <dl> <dt><b>See Also:</b></dt> <dd><a href="QStringListModel.html#headerDataChanged(com.trolltech.qt.core.Qt.Orientation, int, int)"><tt>headerDataChanged</tt></a>, <a href="QStringListModel.html#setData(com.trolltech.qt.core.QModelIndex, java.lang.Object, int)"><tt>setData</tt></a>, <a href="QStringListModel.html#layoutChanged()"><tt>layoutChanged</tt></a></dd> </dl> */"/> <signal name="protected final void headerDataChanged(com.trolltech.qt.core.Qt.Orientation orientation, int first, int last)" doc="/** <p>This signal is emitted whenever a header is changed. The <tt>orientation</tt> indicates whether the horizontal or vertical header has changed. The sections in the header from the <tt>first</tt> to the <tt>last</tt> need to be updated.</p> <p>Note that this signal must be emitted explicitly when reimplementing the <a href="%2E%2E/core/%2E%2E/core/QAbstractItemModel.html#setHeaderData(int, com.trolltech.qt.core.Qt.Orientation, java.lang.Object, int)"><tt>setHeaderData</tt></a> function.</p> <p>If you are changing the number of columns or rows you don't need to emit this signal, but use the begin/end functions.</p> <dl> <dt><b>Compatible Slot Signatures:</b></dt> <dd><tt>void mySlot(com.trolltech.qt.core.Qt.Orientation orientation, int first, int last)</tt></dd> <dd><tt>void mySlot(com.trolltech.qt.core.Qt.Orientation orientation, int first)</tt></dd> <dd><tt>void mySlot(com.trolltech.qt.core.Qt.Orientation orientation)</tt></dd> <dd><tt>void mySlot()</tt></dd> </dl> <dl> <dt><b>See Also:</b></dt> <dd><a href="%2E%2E/core/%2E%2E/core/QAbstractItemModel.html#headerData(int, com.trolltech.qt.core.Qt.Orientation, int)"><tt>headerData</tt></a>, <a href="%2E%2E/core/%2E%2E/core/QAbstractItemModel.html#setHeaderData(int, com.trolltech.qt.core.Qt.Orientation, java.lang.Object, int)"><tt>setHeaderData</tt></a>, <a href="QStringListModel.html#dataChanged(com.trolltech.qt.core.QModelIndex, com.trolltech.qt.core.QModelIndex)"><tt>dataChanged</tt></a></dd> </dl> */"/> <signal name="protected final void layoutAboutToBeChanged()" doc="/** <p>This signal is emitted just before the layout of a model is changed. Components connected to this signal use it to adapt to changes in the model's layout.</p> <p>Subclasses should update any persistent model indexes after emitting <a href="QStringListModel.html#layoutAboutToBeChanged()"><tt>layoutAboutToBeChanged</tt></a>.</p> <dl> <dt><b>Compatible Slot Signature:</b></dt> <dd><tt>void mySlot()</tt></dd> </dl> <dl> <dt><b>See Also:</b></dt> <dd><a href="QStringListModel.html#layoutChanged()"><tt>layoutChanged</tt></a>, <a href="%2E%2E/core/%2E%2E/core/QAbstractItemModel.html#changePersistentIndex(com.trolltech.qt.core.QModelIndex, com.trolltech.qt.core.QModelIndex)"><tt>changePersistentIndex</tt></a></dd> </dl> */"/> <signal name="protected final void layoutChanged()" doc="/** <p>This signal is emitted whenever the layout of items exposed by the model has changed; for example, when the model has been sorted. When this signal is received by a view, it should update the layout of items to reflect this change.</p> <p>When subclassing <a href="%2E%2E/core/%2E%2E/core/QAbstractItemModel.html#QAbstractItemModel(com.trolltech.qt.core.QObject)"><tt>QAbstractItemModel</tt></a> or <a href="QAbstractProxyModel.html"><tt>QAbstractProxyModel</tt></a>, ensure that you emit <a href="QStringListModel.html#layoutAboutToBeChanged()"><tt>layoutAboutToBeChanged</tt></a> before changing the order of items or altering the structure of the data you expose to views, and emit <a href="QStringListModel.html#layoutChanged()"><tt>layoutChanged</tt></a> after changing the layout.</p> <p>Subclasses should update any persistent model indexes before emitting <a href="QStringListModel.html#layoutChanged()"><tt>layoutChanged</tt></a>.</p> <dl> <dt><b>Compatible Slot Signature:</b></dt> <dd><tt>void mySlot()</tt></dd> </dl> <dl> <dt><b>See Also:</b></dt> <dd><a href="QStringListModel.html#layoutAboutToBeChanged()"><tt>layoutAboutToBeChanged</tt></a>, <a href="QStringListModel.html#dataChanged(com.trolltech.qt.core.QModelIndex, com.trolltech.qt.core.QModelIndex)"><tt>dataChanged</tt></a>, <a href="QStringListModel.html#headerDataChanged(com.trolltech.qt.core.Qt.Orientation, int, int)"><tt>headerDataChanged</tt></a>, <a href="%2E%2E/core/%2E%2E/core/QAbstractItemModel.html#reset()"><tt>reset</tt></a>, <a href="%2E%2E/core/%2E%2E/core/QAbstractItemModel.html#changePersistentIndex(com.trolltech.qt.core.QModelIndex, com.trolltech.qt.core.QModelIndex)"><tt>changePersistentIndex</tt></a></dd> </dl> */"/> <method name="public QStringListModel(com.trolltech.qt.core.QObject parent)" doc="/** <p>Constructs a string list model with the given <tt>parent</tt>.</p> */"/> <method name="public QStringListModel()" doc="/** <p>Equivalent to <a href="QStringListModel.html#QStringListModel(java.util.List<java.lang.String>, com.trolltech.qt.core.QObject)"><tt>QStringListModel</tt></a>(0). */"/> <method name="public QStringListModel(java.util.List<java.lang.String> strings, com.trolltech.qt.core.QObject parent)" doc="/** <p>Constructs a string list model containing the specified <tt>strings</tt> with the given <tt>parent</tt>.</p> */"/> <method name="public QStringListModel(java.util.List<java.lang.String> strings)" doc="/** <p>Equivalent to <a href="QStringListModel.html#QStringListModel(java.util.List<java.lang.String>, com.trolltech.qt.core.QObject)"><tt>QStringListModel</tt></a>(<tt>strings</tt>, 0). */"/> <method name="public final void setStringList(java.util.List<java.lang.String> strings)" doc="/** <p>Sets the model's internal string list to <tt>strings</tt>. The model will notify any attached views that its underlying data has changed.</p> @see <a href="QStringListModel.html#stringList()"><tt>stringList</tt></a> @see <a href="QStringListModel.html#dataChanged(com.trolltech.qt.core.QModelIndex, com.trolltech.qt.core.QModelIndex)"><tt>dataChanged</tt></a> */"/> <method name="public final java.util.List<java.lang.String> stringList()" doc="/** <p>Returns the string list used by the model to store data.</p> @see <a href="QStringListModel.html#setStringList(java.util.List<java.lang.String>)"><tt>setStringList</tt></a> */"/> <method name="public java.lang.Object data(com.trolltech.qt.core.QModelIndex index, int role)" doc="/** <p>Returns data for the specified <tt>role</tt>, from the item with the given <tt>index</tt>.</p> <p>If the view requests an invalid index, an invalid variant is returned.</p> @see <a href="QStringListModel.html#setData(com.trolltech.qt.core.QModelIndex, java.lang.Object, int)"><tt>setData</tt></a> */"/> <method name="public com.trolltech.qt.core.Qt.ItemFlags flags(com.trolltech.qt.core.QModelIndex index)" doc="/** <p>Returns the flags for the item with the given <tt>index</tt>.</p> <p>Valid items are enabled, selectable, and editable.</p> @see <tt>QAbstractItemModel::flags</tt> */"/> <method name="public boolean insertRows(int row, int count, com.trolltech.qt.core.QModelIndex parent)" doc="/** <p>Inserts <tt>count</tt> rows into the model, beginning at the given <tt>row</tt>.</p> <p>The <tt>parent</tt> index of the rows is optional and is only used for consistency with <a href="%2E%2E/core/%2E%2E/core/QAbstractItemModel.html#QAbstractItemModel(com.trolltech.qt.core.QObject)"><tt>QAbstractItemModel</tt></a>. By default, a null index is specified, indicating that the rows are inserted in the top level of the model.</p> @see <tt>QAbstractItemModel::insertRows</tt> */"/> <method name="public final boolean insertRows(int row, int count)" doc="/** <p>Equivalent to <a href="QStringListModel.html#insertRows(int, int, com.trolltech.qt.core.QModelIndex)"><tt>insertRows</tt></a>(<tt>row</tt>, <tt>count</tt>, QModelIndex()). */"/> <method name="public boolean removeRows(int row, int count, com.trolltech.qt.core.QModelIndex parent)" doc="/** <p>Removes <tt>count</tt> rows from the model, beginning at the given <tt>row</tt>.</p> <p>The <tt>parent</tt> index of the rows is optional and is only used for consistency with <a href="%2E%2E/core/%2E%2E/core/QAbstractItemModel.html#QAbstractItemModel(com.trolltech.qt.core.QObject)"><tt>QAbstractItemModel</tt></a>. By default, a null index is specified, indicating that the rows are removed in the top level of the model.</p> @see <tt>QAbstractItemModel::removeRows</tt> */"/> <method name="public final boolean removeRows(int row, int count)" doc="/** <p>Equivalent to <a href="QStringListModel.html#removeRows(int, int, com.trolltech.qt.core.QModelIndex)"><tt>removeRows</tt></a>(<tt>row</tt>, <tt>count</tt>, QModelIndex()). */"/> <method name="public int rowCount(com.trolltech.qt.core.QModelIndex parent)" doc="/** <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> <p>The optional <tt>parent</tt> 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> @see <a href="QStringListModel.html#insertRows(int, int, com.trolltech.qt.core.QModelIndex)"><tt>insertRows</tt></a> @see <a href="QStringListModel.html#removeRows(int, int, com.trolltech.qt.core.QModelIndex)"><tt>removeRows</tt></a> @see <tt>QAbstractItemModel::rowCount</tt> */"/> <method name="public final int rowCount()" doc="/** <p>Equivalent to <a href="QStringListModel.html#rowCount(com.trolltech.qt.core.QModelIndex)"><tt>rowCount</tt></a>(QModelIndex()). */"/> <method name="public boolean setData(com.trolltech.qt.core.QModelIndex index, java.lang.Object value, int role)" doc="/** <p>Sets the data for the specified <tt>role</tt> in the item with the given <tt>index</tt> in the model, to the provided <tt>value</tt>.</p> <p>The <a href="QStringListModel.html#dataChanged(com.trolltech.qt.core.QModelIndex, com.trolltech.qt.core.QModelIndex)"><tt>dataChanged</tt></a> signal is emitted if the item is changed.</p> @see <tt>Qt::ItemDataRole</tt> @see <a href="QStringListModel.html#data(com.trolltech.qt.core.QModelIndex, int)"><tt>data</tt></a> */"/> <method name="public final boolean setData(com.trolltech.qt.core.QModelIndex index, java.lang.Object value)" doc="/** <p>Equivalent to <a href="QStringListModel.html#setData(com.trolltech.qt.core.QModelIndex, java.lang.Object, int)"><tt>setData</tt></a>(<tt>index</tt>, <tt>value</tt>, Qt::EditRole). */"/> <method name="public void sort(int column, com.trolltech.qt.core.Qt.SortOrder order)" doc="/** <p>This function is reimplemented for internal reasons.</p> */"/> <method name="public final void sort(int column)" doc="/** <p>Equivalent to <a href="QStringListModel.html#sort(int, com.trolltech.qt.core.Qt.SortOrder)">sort</tt></a>(<tt>column</tt>, Qt::AscendingOrder). */"/> </class>