Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# QPersistentModelIndex Class Reference

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

    #include <QPersistentModelIndex>

- List of all members, including inherited members

### Public Functions

- QPersistentModelIndex ( const QModelIndex & index, QAbstractItemModel * model )
- QPersistentModelIndex ( const QPersistentModelIndex & other )
- int column () const
- bool isValid () const
- int row () const
- operator const QModelIndex & () const
- bool operator!= ( const QModelIndex & other ) const
- bool operator< ( const QPersistentModelIndex & other ) const
- void operator= ( const QPersistentModelIndex & other )
- bool operator== ( const QPersistentModelIndex & other ) const
- bool operator== ( const QModelIndex & other ) const

## Detailed Description

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

A QPersistentModelIndex is a model index that can be stored by an application, and later used to access information in a model. Unlike the QModelIndex class, it is safe to store a QPersistentModelIndex since the model will ensure that references to data will continue to be valid as long as that data exists within the model.

It is good practice to check that persistent model indexes are valid before using them.

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

## Member Function Documentation

### QPersistentModelIndex::QPersistentModelIndex ( const QModelIndex & index, QAbstractItemModel * model )

Creates a new QPersistentModelIndex that is a copy of the model index in the given model.

### QPersistentModelIndex::QPersistentModelIndex ( const QPersistentModelIndex & other )

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

### int QPersistentModelIndex::column () const

Returns the column this persistent model index refers to.

### bool QPersistentModelIndex::isValid () const

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

### int QPersistentModelIndex::row () const

Returns the row this persistent model index refers to.

### QPersistentModelIndex::operator const QModelIndex & () const

Cast operator that returns a const QModelIndex&.

### bool QPersistentModelIndex::operator!= ( const QModelIndex & other ) const

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

### bool QPersistentModelIndex::operator< ( const QPersistentModelIndex & other ) const

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

### void QPersistentModelIndex::operator= ( const QPersistentModelIndex & other )

Sets the persistent model index to refer to the same item in a model as the other persistent model index.

### bool QPersistentModelIndex::operator== ( const QPersistentModelIndex & other ) const

Returns true if this persistent model index is equal to the other persistent model index, otherwist returns false.

### bool QPersistentModelIndex::operator== ( const QModelIndex & other ) const

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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