Class QtAbstractListModel

java.lang.Object
org.qtproject.qt.android.QtAbstractItemModel
org.qtproject.qt.android.QtAbstractListModel

public abstract class QtAbstractListModel extends QtAbstractItemModel
  • Constructor Details

    • QtAbstractListModel

      public QtAbstractListModel()
  • Method Details

    • columnCount

      public final int columnCount(QtModelIndex parent)
      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 class QtAbstractItemModel
      Parameters:
      parent - The parent index.
      Returns:
      The number of columns.
      See Also:
    • index

      public QtModelIndex index(int row, int column, QtModelIndex parent)
      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 class QtAbstractItemModel
      Parameters:
      row - The row.
      column - The column.
      parent - The parent index.
      Returns:
      The index.
      See Also:
    • parent

      public final QtModelIndex parent(QtModelIndex index)
      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 as QtAbstractItemModel.parent(QtModelIndex), since indexes belonging to your model will call your implementation, leading to infinite recursion.
      Specified by:
      parent in class QtAbstractItemModel
      Parameters:
      index - The index.
      Returns:
      The parent index.
      See Also:
    • hasChildren

      public final boolean hasChildren(QtModelIndex parent)
      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 class QtAbstractItemModel
      Parameters:
      parent - The parent index.
      Returns:
      True if the parent has children, false otherwise.
      See Also:
    • sibling

      public QtModelIndex sibling(int row, int column, QtModelIndex parent)
      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 class QtAbstractItemModel
      Parameters:
      row - The row.
      column - The column.
      parent - The parent index.
      Returns:
      The sibling index.