Qt Jambi Home

com.trolltech.qt.core
Class QPersistentModelIndex

java.lang.Object
  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.Comparable

public class QPersistentModelIndex
extends QtJambiObject
implements java.lang.Comparable

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, QAbstractItemModel

Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Constructor Summary
QPersistentModelIndex()
          
QPersistentModelIndex(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
 QModelIndex child(int row, int column)
          Returns the child of the model index that is stored in the given row and column.
 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()
          Equivalent to data(Qt::DisplayRole).
 java.lang.Object data(int role)
          Returns the data for the given role for the item referred to by the index.
 boolean equals(java.lang.Object other)
          
 Qt.ItemFlags flags()
          Returns the flags for the item referred to by the index.
static QPersistentModelIndex fromNativePointer(QNativePointer nativePointer)
          This function returns the QPersistentModelIndex instance pointed to by nativePointer
 long internalId()
          
 boolean isValid()
          Returns true if this persistent model index is valid; otherwise returns false.
 QAbstractItemModel model()
          Returns the model that the index belongs to.
static QNativePointer nativePointerArray(QPersistentModelIndex[] array)
          This function returns a QNativePointer that is pointing to the specified QPersistentModelIndex array.
 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.
 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.
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QPersistentModelIndex

public QPersistentModelIndex(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.


QPersistentModelIndex

public QPersistentModelIndex()

Method Detail

child

public final 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, sibling

column

public final int column()

Returns the column this persistent model index refers to.


data

public final java.lang.Object data()

Equivalent to data(Qt::DisplayRole).


data

public final java.lang.Object data(int role)

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


flags

public final Qt.ItemFlags flags()

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


internalId

public final long internalId()


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, column

model

public final QAbstractItemModel model()

Returns the model that the index belongs to.


parent

public final QModelIndex parent()

Returns the parent QModelIndex for this persistent index, or QModelIndex() if it has no parent.

See Also:
child, sibling, model

row

public final int row()

Returns the row this persistent model index refers to.


sibling

public final 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, child

fromNativePointer

public static QPersistentModelIndex fromNativePointer(QNativePointer nativePointer)
This function returns the QPersistentModelIndex instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

nativePointerArray

public static QNativePointer nativePointerArray(QPersistentModelIndex[] array)
This function returns a QNativePointer that is pointing to the specified QPersistentModelIndex array.

Parameters:
array - the array that the returned pointer will point to.
Returns:
a QNativePointer that is pointing to the specified array.

equals

public boolean equals(java.lang.Object other)

Overrides:
equals in class java.lang.Object

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

Qt Jambi Home