Class TableModel
Represents a flat two-dimensional model with no parent-child hierarchy.
public abstract class TableModel : Model
- Inheritance
-
TableModel
- Derived
-
TableModel<T>
- Inherited Members
Remarks
Use TableModel or TableModel<T> when your data is naturally arranged as rows and columns, such as a spreadsheet, a database result set, or any grid of values. This base class fixes the hierarchical parts of Model so subclasses can focus on table-specific behavior.
In practical terms, every item in the model is addressed by a row and a column. Items do not have children, and valid parent indexes are treated as having no rows and no columns. If you need tree-like data, derive from Model instead.
Most applications should derive from TableModel<T> rather than directly from TableModel, because the generic form provides automatic role handling, editing support, and row/column change helpers for a strongly typed cell value.
Methods
HasChildren(ModelIndex)
Returns whether the specified parent item has any children.
public override sealed bool HasChildren(ModelIndex parent)
Parameters
parentModelIndex
Returns
Index(int, int, ModelIndex)
Creates an index that identifies the item at the specified row and column under a parent.
public override sealed ModelIndex Index(int row, int column, ModelIndex parent)
Parameters
Returns
- ModelIndex
Parent(ModelIndex)
Returns the parent index for the specified item.
public override sealed ModelIndex Parent(ModelIndex index)
Parameters
indexModelIndex
Returns
- ModelIndex
Sibling(int, int, ModelIndex)
Returns another item with the same parent as the specified item.
public override sealed ModelIndex Sibling(int row, int column, ModelIndex index)
Parameters
Returns
- ModelIndex