com.trolltech.qt.gui
Class QItemSelectionRange

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.gui.QItemSelectionRange
All Implemented Interfaces:
QtJambiInterface, java.lang.Cloneable

public class QItemSelectionRange
extends QtJambiObject
implements java.lang.Cloneable

The QItemSelectionRange class manages information about a range of selected items in a model. A QItemSelectionRange contains information about a range of selected items in a model. A range of items is a contiguous array of model items, extending to cover a number of adjacent rows and columns with a common parent item; this can be visualized as a two-dimensional block of cells in a table. A selection range has a top(), left() a bottom(), right() and a parent().

The QItemSelectionRange class is one of the Model/View Classes and is part of Qt's model/view framework.

The model items contained in the selection range can be obtained using the indexes() function. Use QItemSelectionModel::selectedIndexes() to get a list of all selected items for a view.

You can determine whether a given model item lies within a particular range by using the contains() function. Ranges can also be compared using the overloaded operators for equality and inequality, and the intersects() function allows you to determine whether two ranges overlap.

See also:
Model/View Programming, QAbstractItemModel, QItemSelection, and QItemSelectionModel.


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
QItemSelectionRange()
          Constructs an empty selection range.
QItemSelectionRange(QItemSelectionRange other)
          Copy constructor.
QItemSelectionRange(com.trolltech.qt.core.QModelIndex index)
          Constructs a new selection range containing only the model item specified by the model index index.
QItemSelectionRange(com.trolltech.qt.core.QModelIndex topLeft, com.trolltech.qt.core.QModelIndex bottomRight)
          Constructs a new selection range containing only the index specified by the topLeft and the index bottomRight.
 
Method Summary
 int bottom()
          Returns the row index corresponding to the lowermost selected row in the selection range.
 com.trolltech.qt.core.QModelIndex bottomRight()
          Returns the index for the item located at the bottom-right corner of the selection range.
 QItemSelectionRange clone()
          This method is reimplemented for internal reasons
 boolean contains(int row, int column, com.trolltech.qt.core.QModelIndex parentIndex)
          This is an overloaded member function, provided for convenience.
 boolean contains(com.trolltech.qt.core.QModelIndex index)
          Returns true if the model item specified by the index lies within the range of selected items; otherwise returns false.
 int height()
          Returns the number of selected rows in the selection range.
 java.util.List indexes()
          Returns the list of model index items stored in the selection.
 QItemSelectionRange intersected(QItemSelectionRange other)
          Returns a new selection range containing only the items that are found in both the selection range and the other selection range.
 boolean intersects(QItemSelectionRange other)
          Returns true if this selection range intersects (overlaps with) the other range given; otherwise returns false.
 boolean isValid()
          Returns true if the selection range is valid; otherwise returns false.
 int left()
          Returns the column index corresponding to the leftmost selected column in the selection range.
 QAbstractItemModel model()
          Returns the model that the items in the selection range belong to.
 com.trolltech.qt.core.QModelIndex parent()
          Returns the parent model item index of the items in the selection range.
 int right()
          Returns the column index corresponding to the rightmost selected column in the selection range.
 int top()
          Returns the row index corresponding to the uppermost selected row in the selection range.
 com.trolltech.qt.core.QModelIndex topLeft()
          Returns the index for the item located at the top-left corner of the selection range.
 java.lang.String toString()
          Returns a string representation of the this QItemSelectionRange.
 int width()
          Returns the number of selected columns in the selection range.
 
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

QItemSelectionRange

public QItemSelectionRange()
Constructs an empty selection range.


QItemSelectionRange

public QItemSelectionRange(QItemSelectionRange other)
Copy constructor. Constructs a new selection range with the same contents as the other range given.


QItemSelectionRange

public QItemSelectionRange(com.trolltech.qt.core.QModelIndex index)
Constructs a new selection range containing only the model item specified by the model index index.


QItemSelectionRange

public QItemSelectionRange(com.trolltech.qt.core.QModelIndex topLeft,
                           com.trolltech.qt.core.QModelIndex bottomRight)
Constructs a new selection range containing only the index specified by the topLeft and the index bottomRight.

Method Detail

bottom

public final int bottom()
Returns the row index corresponding to the lowermost selected row in the selection range.


bottomRight

public final com.trolltech.qt.core.QModelIndex bottomRight()
Returns the index for the item located at the bottom-right corner of the selection range.

See also:
bottom(), right(), and topLeft().


contains

public final boolean contains(com.trolltech.qt.core.QModelIndex index)
Returns true if the model item specified by the index lies within the range of selected items; otherwise returns false.


contains

public final boolean contains(int row,
                              int column,
                              com.trolltech.qt.core.QModelIndex parentIndex)
This is an overloaded member function, provided for convenience.

Returns true if the model item specified by (row, column) and with parentIndex as the parent item lies within the range of selected items; otherwise returns false.


height

public final int height()
Returns the number of selected rows in the selection range.


indexes

public final java.util.List indexes()
Returns the list of model index items stored in the selection.


intersected

public final QItemSelectionRange intersected(QItemSelectionRange other)
Returns a new selection range containing only the items that are found in both the selection range and the other selection range.


intersects

public final boolean intersects(QItemSelectionRange other)
Returns true if this selection range intersects (overlaps with) the other range given; otherwise returns false.


isValid

public final boolean isValid()
Returns true if the selection range is valid; otherwise returns false.


left

public final int left()
Returns the column index corresponding to the leftmost selected column in the selection range.


model

public final QAbstractItemModel model()
Returns the model that the items in the selection range belong to.


parent

public final com.trolltech.qt.core.QModelIndex parent()
Returns the parent model item index of the items in the selection range.


right

public final int right()
Returns the column index corresponding to the rightmost selected column in the selection range.


top

public final int top()
Returns the row index corresponding to the uppermost selected row in the selection range.


topLeft

public final com.trolltech.qt.core.QModelIndex topLeft()
Returns the index for the item located at the top-left corner of the selection range.

See also:
top(), left(), and bottomRight().


width

public final int width()
Returns the number of selected columns in the selection range.


toString

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

Overrides:
toString in class java.lang.Object

clone

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

Overrides:
clone in class java.lang.Object