Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QStringListModel

    java.lang.Object
      com.trolltech.qt.QSignalEmitter
          com.trolltech.qt.QtJambiObject
              com.trolltech.qt.core.QObject
                  com.trolltech.qt.core.QAbstractItemModel
                      com.trolltech.qt.core.QAbstractListModel
                          com.trolltech.qt.gui.QStringListModel

All Implemented Interfaces:
  QtJambiInterface

    public class QStringListModel

extends QAbstractListModel

The `QStringListModel` class provides a model that supplies strings to views. `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 `QListView` or a `QComboBox`.

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.

Model indexes corresponding to items are obtained with the `index()` function, and item flags are obtained with `flags()`. Item data is read with the `data()` function and written with `setData()`. The number of rows (and number of items in the string list) can be found with the `rowCount()` function.

The model can be constructed with an existing string list, or strings can be set later with the `setStringList()` convenience function. Strings can also be inserted in the usual way with the `insertRows()` function, and removed with `removeRows()`. The contents of the string list can be retrieved with the `stringList()` convenience function.

An example usage of `QStringListModel`:

            QStringListModel model = new QStringListModel();
            List<String> list = new Vector<String>();
            list.add("a");
            list.add("b");
            list.add("c");
            model.setStringList(list);

See also:
  `QAbstractListModel`, `QAbstractItemModel`, and Model Classes.

Nested Class Summary

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Field Summary

Fields inherited from class com.trolltech.qt.core.QAbstractItemModel
`dataChanged, headerDataChanged, layoutAboutToBeChanged, layoutChanged`

Constructor Summary
`QStringListModel()` Constructs a string list model with the given `parent`.
`QStringListModel(java.util.List strings)` Constructs a string list model containing the specified `strings` with the given `parent`.
`QStringListModel(java.util.List strings, QObject parent)` Constructs a string list model containing the specified `strings` with the given `parent`.
`QStringListModel(QObject parent)` Constructs a string list model with the given `parent`.

Method Summary
`static QStringListModel` | `fromNativePointer(QNativePointer nativePointer)` This method returns the QStringListModel instance pointed to by `nativePointer`.
`void` | `setStringList(java.util.List strings)` Sets the model's internal string list to `strings`.
`java.util.List` | `stringList()` Returns the string list used by the model to store data.

Methods inherited from class com.trolltech.qt.core.QAbstractItemModel
`beginInsertColumns, beginInsertRows, beginRemoveColumns, beginRemoveRows, buddy, canFetchMore, changePersistentIndex, changePersistentIndexList, columnCount, columnCount, createIndex, createIndex, createIndex, data, data, data, data, dropMimeData, endInsertColumns, endInsertRows, endRemoveColumns, endRemoveRows, fetchMore, flags, hasChildren, hasChildren, hasIndex, hasIndex, headerData, headerData, index, index, insertColumn, insertColumn, insertColumns, insertColumns, insertRow, insertRow, insertRows, insertRows, itemData, match, match, match, match, mimeData, mimeTypes, parent, persistentIndexList, removeColumn, removeColumn, removeColumns, removeColumns, removeRow, removeRow, removeRows, removeRows, reset, revert, rowCount, rowCount, setData, setData, setData, setData, setHeaderData, setHeaderData, setItemData, setSupportedDragActions, setSupportedDragActions, sibling, sort, sort, span, submit, supportedDragActions, supportedDropActions`

Methods inherited from class com.trolltech.qt.core.QObject
`childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty`

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class java.lang.Object
`clone, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Constructor Detail

### QStringListModel

    public QStringListModel()

  Constructs a string list model with the given `parent`.

### QStringListModel

    public QStringListModel(QObject parent)

  Constructs a string list model with the given `parent`.

### QStringListModel

    public QStringListModel(java.util.List strings)

  Constructs a string list model containing the specified `strings` with the given `parent`.

### QStringListModel

    public QStringListModel(java.util.List strings,
                            QObject parent)

  Constructs a string list model containing the specified `strings` with the given `parent`.

Method Detail

### setStringList

    public final void setStringList(java.util.List strings)

  Sets the model's internal string list to `strings`. The model will notify any attached views that its underlying data has changed.

See also:
  `stringList()`, and `dataChanged()` .

### stringList

    public final java.util.List stringList()

  Returns the string list used by the model to store data.

See also:
  `setStringList()`.

### fromNativePointer

    public static QStringListModel fromNativePointer(QNativePointer nativePointer)

  This method returns the QStringListModel instance pointed to by `nativePointer`.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD