Class QtAbstractListModel
java.lang.Object
org.qtproject.qt.android.QtAbstractItemModel
org.qtproject.qt.android.QtAbstractListModel
-
Nested Class Summary
Nested classes/interfaces inherited from class org.qtproject.qt.android.QtAbstractItemModel
QtAbstractItemModel.OnDataChangedListener
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal int
columnCount
(QtModelIndex parent) Returns the number of columns for the children of the given parent.final boolean
hasChildren
(QtModelIndex parent) Returns true if the parent has any children; otherwise, returns false.index
(int row, int column, QtModelIndex parent) Returns the index for the specified row and column for the supplied parent index.final QtModelIndex
parent
(QtModelIndex index) Returns the parent of the model item with the given index.sibling
(int row, int column, QtModelIndex parent) Returns the sibling at row and column for the item at index or an invalid QModelIndex if there is no sibling at that location.Methods inherited from class org.qtproject.qt.android.QtAbstractItemModel
beginInsertColumns, beginInsertRows, beginMoveColumns, beginMoveRows, beginRemoveColumns, beginRemoveRows, beginResetModel, canFetchMore, createIndex, data, dataChanged, endInsertColumns, endInsertRows, endMoveColumns, endMoveRows, endRemoveColumns, endRemoveRows, endResetModel, fetchMore, hasIndex, roleNames, rowCount, setData, setOnDataChangedListener
-
Constructor Details
-
QtAbstractListModel
public QtAbstractListModel()
-
-
Method Details
-
columnCount
Description copied from class:QtAbstractItemModel
Returns the number of columns for the children of the given parent. In most subclasses, the number of columns is independent of the parent. For example:@Override int columnCount(const QtModelIndex parent) { return 3; }
When implementing a table-based model, columnCount() should return 0, when the parent is valid.- Specified by:
columnCount
in classQtAbstractItemModel
- Parameters:
parent
- The parent index.- Returns:
- The number of columns.
- See Also:
-
index
Description copied from class:QtAbstractItemModel
Returns the index for the specified row and column for the supplied parent index. When re-implementing this function in a subclass, call createIndex() to generate model indexes that other components can use to refer to items in your model.- Specified by:
index
in classQtAbstractItemModel
- Parameters:
row
- The row.column
- The column.parent
- The parent index.- Returns:
- The index.
- See Also:
-
parent
Description copied from class:QtAbstractItemModel
Returns the parent of the model item with the given index. If the item has no parent, then an invalid QtModelIndex is returned. A common convention used in models that expose tree data structures is that only items in the first column have children. For that case, when re-implementing this function in a subclass, the column of the returned QtModelIndex would be 0. When re-implementing this function in a subclass, be careful to avoid calling QtModelIndex member functions, such asQtAbstractItemModel.parent(QtModelIndex)
, since indexes belonging to your model will call your implementation, leading to infinite recursion.- Specified by:
parent
in classQtAbstractItemModel
- Parameters:
index
- The index.- Returns:
- The parent index.
- See Also:
-
hasChildren
Description copied from class:QtAbstractItemModel
Returns true if the parent has any children; otherwise, returns false. Use rowCount() on the parent to get the number of children.- Overrides:
hasChildren
in classQtAbstractItemModel
- Parameters:
parent
- The parent index.- Returns:
- True if the parent has children, false otherwise.
- See Also:
-
sibling
Description copied from class:QtAbstractItemModel
Returns the sibling at row and column for the item at index or an invalid QModelIndex if there is no sibling at that location. sibling() is just a convenience function that finds the item's parent and uses it to retrieve the index of the child item in the specified row and column. This method can optionally be overridden to optimize a specific implementation.- Overrides:
sibling
in classQtAbstractItemModel
- Parameters:
row
- The row.column
- The column.parent
- The parent index.- Returns:
- The sibling index.
-