com.trolltech.qt.core
Class QPersistentModelIndex

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.core.QPersistentModelIndex
All Implemented Interfaces:
QtJambiInterface, java.lang.Cloneable, java.lang.Comparable

public class QPersistentModelIndex
extends QtJambiObject
implements java.lang.Comparable, java.lang.Cloneable

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 items will continue to be valid as long as they can be accessed by 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.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal
 
Field Summary
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Constructor Summary
QPersistentModelIndex(com.trolltech.qt.core.QModelIndex index)
          Creates a new QPersistentModelIndex that is a copy of the model index.
QPersistentModelIndex(QPersistentModelIndex other)
          Creates a new QPersistentModelIndex that is a copy of the other persistent model index.
 
Method Summary
 com.trolltech.qt.core.QModelIndex child(int row, int column)
          Returns the child of the model index that is stored in the given row and column.
 QPersistentModelIndex clone()
          This method is reimplemented for internal reasons
 int column()
          Returns the column this persistent model index refers to.
 int compareTo(java.lang.Object other)
          Compares this object with the specified object for order.
 java.lang.Object data()
          Returns the data for the given role for the item referred to by the index.
 java.lang.Object data(int role)
          Returns the data for the given role for the item referred to by the index.
 Qt.ItemFlags flags()
          Returns the flags for the item referred to by the index.
 boolean isValid()
          Returns true if this persistent model index is valid; otherwise returns false.
 QAbstractItemModel model()
          Returns the model that the index belongs to.
 com.trolltech.qt.core.QModelIndex parent()
          Returns the parent QModelIndex for this persistent index, or QModelIndex() if it has no parent.
 int row()
          Returns the row this persistent model index refers to.
 com.trolltech.qt.core.QModelIndex sibling(int row, int column)
          Returns the sibling at row and column or an invalid QModelIndex if there is no sibling at this position.
 java.lang.String toString()
          Returns a string representation of the this QPersistentModelIndex.
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
__qt_signalInitialization
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QPersistentModelIndex

public QPersistentModelIndex(com.trolltech.qt.core.QModelIndex index)
Creates a new QPersistentModelIndex that is a copy of the model index.


QPersistentModelIndex

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

Method Detail

child

public final com.trolltech.qt.core.QModelIndex child(int row,
                                                     int column)
Returns the child of the model index that is stored in the given row and column.

See also:
parent(), and sibling().


column

public final int column()
Returns the column this persistent model index refers to.


data

public final java.lang.Object data()
Returns the data for the given role for the item referred to by the index.

See also:
Qt::ItemDataRole , and QAbstractItemModel::setData().


data

public final java.lang.Object data(int role)
Returns the data for the given role for the item referred to by the index.

See also:
Qt::ItemDataRole , and QAbstractItemModel::setData().


flags

public final Qt.ItemFlags flags()
Returns the flags for the item referred to by the index.


isValid

public final boolean isValid()
Returns true if this persistent 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().


model

public final QAbstractItemModel model()
Returns the model that the index belongs to.


parent

public final com.trolltech.qt.core.QModelIndex parent()
Returns the parent QModelIndex for this persistent index, or QModelIndex() if it has no parent.

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


row

public final int row()
Returns the row this persistent model index refers to.


sibling

public final com.trolltech.qt.core.QModelIndex sibling(int row,
                                                       int column)
Returns the sibling at row and column or an invalid QModelIndex if there is no sibling at this position.

See also:
parent(), and child().


compareTo

public int compareTo(java.lang.Object other)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Specified by:
compareTo in interface java.lang.Comparable

toString

public java.lang.String toString()
Returns a string representation of the this QPersistentModelIndex.

Overrides:
toString in class java.lang.Object

clone

public QPersistentModelIndex clone()
This method is reimplemented for internal reasons

Overrides:
clone in class java.lang.Object