|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.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
public class QStringListModel
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);
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)
|
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.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 |
---|
public QStringListModel()
public QStringListModel(QObject parent)
public QStringListModel(java.util.List strings)
public QStringListModel(java.util.List strings, QObject parent)
Method Detail |
---|
public final void setStringList(java.util.List strings)
stringList()
, and dataChanged()
.
public final java.util.List stringList()
setStringList()
.
public static QStringListModel fromNativePointer(QNativePointer nativePointer)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |