Header: | #include <QSListModel> |
Inherits: | QSPatchable and |
QSListModel(QObject * parent = 0) | |
int | count() const |
QVariant | data(const QModelIndex & index, int role) const |
QHash<int, QByteArray> | roleNames() const |
int | rowCount(const QModelIndex & parent) const |
void | setRoleNames(const QVariantMap & value) |
void | setRoleNames(const QStringList & list) |
void | setStorage(const QVariantList & value) |
QVariantList | storage() const |
virtual void | insert(int index, const QVariantList & value) |
void | append(const QVariantMap & value) |
void | clear() |
QVariantMap | get(int i) const |
int | indexOf(QString field, QVariant value) const |
void | insert(int index, const QVariantMap & value) |
virtual void | move(int from, int to, int n = 1) |
virtual void | remove(int i, int count = 1) |
virtual void | set(int index, QVariantMap data) |
void | setProperty(int idx, QString property, QVariant value) |
void | countChanged() |
QSListModel is an implementation of QAbstactItemModel. It stores data in a list of QVariantMap. Moreover, it has implemented the QSPatchable interface. You may use QSDiffRunner to patch QSListModel, and it will emit insert, remove, move and data changed signals according to the patch applied.
No. of items in this list model.
Access functions:
int | count() const |
Notifier signal:
void | countChanged() |
[slot]
void QSListModel::append(const QVariantMap & value)Append an items at the end of list
[slot]
void QSListModel::clear()Clear the content of list model.
Returns the data stored under the given role for the item referred to by the index.
Note: If you do not have a value to return, return an invalid QVariant instead of returning 0.
[slot]
QVariantMap QSListModel::get(int i) constReturns the item at index in the list model.
[slot]
int QSListModel::indexOf(QString field, QVariant value) constReturns the index position of the first occurrence of the item with field equal to value
[virtual]
void QSListModel::insert(int index, const QVariantList & value)Reimplemented from QSPatchable::insert().
Returns the index position of the first occurrence of the byte array ba in this byte array,
[slot]
void QSListModel::insert(int index, const QVariantMap & value)Inserts an item at index position.
[virtual slot]
void QSListModel::move(int from, int to, int n = 1)Reimplemented from QSPatchable::move().
Moves n items from one position to another.
[virtual slot]
void QSListModel::remove(int i, int count = 1)Reimplemented from QSPatchable::remove().
Deletes the content at index from the model. You may specific the no. of items to be removed by count argument.
Returns the model's role names.
See also setRoleNames().
Returns no. of items in this list model
[virtual slot]
void QSListModel::set(int index, QVariantMap data)[slot]
void QSListModel::setProperty(int idx, QString property, QVariant value)Apply the changes to a record at index. Only modified value will be set.
Sets the model's role names to roleNames.
This function allows mapping of role identifiers to role property names in scripting languages.
See also roleNames().
Sets the model's role names to roleNames.
This function allows mapping of role identifiers to role property names in scripting languages.
Replace the content of this list model by input value.
See also storage().
Get the content ot this list model
See also setStorage().