Inherited by: QHelpIndexModel
QStringListModelis 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
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
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
An example usage of
QStringListModel:QStringListModel *model = new QStringListModel(); QStringList list; list << "a" << "b" << "c"; model->setStringList(list);
- param parent
- param strings
list of strings
Constructs a string list model with the given
Constructs a string list model containing the specified
stringswith the given
strings – list of strings
Sets the model’s internal string list to
strings. The model will notify any attached views that its underlying data has changed.
© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.