Access your models from QML without views or delegates
- clone or download this repository
- add
include (<path/to/QmlModelHelper>/QmlModelHelper.pri)
in your.pro
import ModelHelper 0.1
to use this library in your QML files
To use the ModelHelper
, use it as an attached object of a model (it must be a subclass of a QAbstractItemModel
, meaning it can originate from c++ or be a ListModel
from QML).
This property holds the number of rows in the model.
This property holds the number of rows in the model. Alias for rowCount
.
This property holds the number of columns in the model.
This property holds an array of objects describing the roles of the model. Each object has 2 properties: role
, the number of the role; and roleName
, the name of the role.
Returns the role number for the given roleName
. If no role is found for this name, -1
is returned.
Return the item at row
in the model as a map of all its roles.
Return the data for the given roleName
of the item at row
in the model.
This library is licensed under the MIT License.