Qyoto  4.0.7
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties
QtCore.QModelIndex Class Reference

The QModelIndex class is used to locate data in a data model. More...

Inheritance diagram for QtCore.QModelIndex:
Collaboration diagram for QtCore.QModelIndex:

Public Member Functions

override bool Equals (object o)
 
override int GetHashCode ()
 
 QModelIndex ()
  More...
 
 QModelIndex (QModelIndex other)
  More...
 
virtual void CreateProxy ()
 
new QModelIndex Child (int row, int column)
  More...
 
new object Data (int role=(int) Qt.ItemDataRole.DisplayRole)
  More...
 
new QModelIndex Sibling (int row, int column)
  More...
 
new void Dispose ()
 

Static Public Member Functions

static bool operator!= (QModelIndex one, QModelIndex other)
  More...
 
static bool operator< (QModelIndex one, QModelIndex other)
  More...
 
static bool operator== (QModelIndex one, QModelIndex other)
  More...
 
static bool operator> (QModelIndex one, QModelIndex other)
 

Protected Member Functions

 QModelIndex (System.Type dummy)
 

Protected Attributes

SmokeInvocation interceptor
 

Properties

int Column [get]
  More...
 
Qt.ItemFlag Flags [get]
  More...
 
long InternalId [get]
  More...
 
bool IsValid [get]
  More...
 
QAbstractItemModel Model [get]
  More...
 
QModelIndex Parent [get]
  More...
 
int Row [get]
  More...
 
virtual System.IntPtr SmokeObject [get, set]
 

Detailed Description

The QModelIndex class is used to locate data in a data model.

This class is used as an index into item models derived from QAbstractItemModel. The index is used by item views, delegates, and selection models to locate an item in the model.

New QModelIndex objects are created by the model using the QAbstractItemModel::createIndex() function. An invalid model index can be constructed with the QModelIndex constructor. Invalid indexes are often used as parent indexes when referring to top-level items in a model.

Model indexes refer to items in models, and contain all the information required to specify their locations in those models. Each index is located in a given row and column, and may have a parent index; use row(), column(), and parent() to obtain this information. Each top-level item in a model is represented by a model index that does not have a parent index - in this case, parent() will return an invalid model index, equivalent to an index constructed with the zero argument form of the QModelIndex() constructor.

To obtain a model index that refers to an existing item in a model, call QAbstractItemModel::index() with the required row and column values, and the model index of the parent. When referring to top-level items in a model, supply QModelIndex() as the parent index.

The model() function returns the model that the index references as a QAbstractItemModel. The child() function is used to examine items held under the index in the model. The sibling() function allows you to traverse items in the model on the same level as the index.

Note: Model indexes should be used immediately and then discarded. You should not rely on indexes to remain valid after calling model functions that change the structure of the model or delete items. If you need to keep a model index over time use a QPersistentModelIndex.

See also Model/View Programming, QPersistentModelIndex, and QAbstractItemModel.

Constructor & Destructor Documentation

QtCore.QModelIndex.QModelIndex ( System.Type  dummy)
protected
QtCore.QModelIndex.QModelIndex ( )

Creates a new empty model index. This type of model index is used to indicate that the position in the model is invalid.

See also isValid() and QAbstractItemModel.

Here is the call graph for this function:

Here is the caller graph for this function:

QtCore.QModelIndex.QModelIndex ( QModelIndex  other)

Creates a new model index that is a copy of the other model index.

Here is the call graph for this function:

Member Function Documentation

new QModelIndex QtCore.QModelIndex.Child ( int  row,
int  column 
)

Returns the child of the model index that is stored in the given row and column.

Note: This function does not work for an invalid model index which is often used as the root index.

See also parent() and sibling().

virtual void QtCore.QModelIndex.CreateProxy ( )
virtual

Here is the caller graph for this function:

new object QtCore.QModelIndex.Data ( int  role = (int) Qt.ItemDataRole.DisplayRole)

Returns the data for the given role for the item referred to by the index.

new void QtCore.QModelIndex.Dispose ( )
override bool QtCore.QModelIndex.Equals ( object  o)

Here is the call graph for this function:

override int QtCore.QModelIndex.GetHashCode ( )
static bool QtCore.QModelIndex.operator!= ( QModelIndex  one,
QModelIndex  other 
)
static

Returns true if this model index does not refer to the same location as the other model index; otherwise returns false.

static bool QtCore.QModelIndex.operator< ( QModelIndex  one,
QModelIndex  other 
)
static

Returns true if this model index is smaller than the other model index; otherwise returns false.

This function was introduced in Qt 4.1.

static bool QtCore.QModelIndex.operator== ( QModelIndex  one,
QModelIndex  other 
)
static

Returns true if this model index refers to the same location as the other model index; otherwise returns false.

All values in the model index are used when comparing with another model index.

static bool QtCore.QModelIndex.operator> ( QModelIndex  one,
QModelIndex  other 
)
static
new QModelIndex QtCore.QModelIndex.Sibling ( int  row,
int  column 
)

Returns the sibling at row and column. If there is no sibling at this position, an invalid QModelIndex is returned.

See also parent() and child().

Member Data Documentation

SmokeInvocation QtCore.QModelIndex.interceptor
protected

Property Documentation

int QtCore.QModelIndex.Column
get

Returns the column this model index refers to.

Qt.ItemFlag QtCore.QModelIndex.Flags
get

Returns the flags for the item referred to by the index.

This function was introduced in Qt 4.2.

long QtCore.QModelIndex.InternalId
get

Returns a qint64 used by the model to associate the index with the internal data structure.

See also QAbstractItemModel::createIndex().

bool QtCore.QModelIndex.IsValid
get

Returns true if this model index is valid; otherwise returns false.

A valid index belongs to a model, and has non-negative row and column numbers.

See also model(), row(), and column().

QAbstractItemModel QtCore.QModelIndex.Model
get

Returns a pointer to the model containing the item that this index refers to.

A const pointer to the model is returned because calls to non-const functions of the model might invalidate the model index and possibly crash your application.

QModelIndex QtCore.QModelIndex.Parent
get

Returns the parent of the model index, or QModelIndex() if it has no parent.

See also child(), sibling(), and model().

int QtCore.QModelIndex.Row
get

Returns the row this model index refers to.

virtual System.IntPtr QtCore.QModelIndex.SmokeObject
getset