|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.gui.QItemSelection
public class QItemSelection
The QItemSelection class manages information about selected items in a model. A QItemSelection describes the items in a model that have been selected by the user. A QItemSelection is basically a list of selection ranges, see QItemSelectionRange
. It provides functions for creating and manipulating selections, and selecting a range of items from a model.
The QItemSelection class is one of the Model/View Classes and is part of Qt's model/view framework.
An item selection can be constructed and initialized to contain a range of items from an existing model. The following example constructs a selection that contains a range of items from the given model, beginning at the topLeft, and ending at the bottomRight.
QItemSelection selection = new QItemSelection(topLeft, bottomRight);An empty item selection can be constructed, and later populated as required. So, if the model is going to be unavailable when we construct the item selection, we can rewrite the above code in the following way:
QItemSelection selection = new QItemSelection(); // ... selection.select(topLeft, bottomRight);QItemSelection saves memory, and avoids unnecessary work, by working with selection ranges rather than recording the model item index for each item in the selection. Generally, an instance of this class will contain a list of non-overlapping selection ranges.
Use merge()
to merge one item selection into another without making overlapping ranges. Use split()
to split one selection range into smaller ranges based on a another selection range.
QItemSelectionModel
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.AbstractSignal, 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 | |
---|---|
QItemSelection()
Constructs an empty selection. |
|
QItemSelection(com.trolltech.qt.core.QModelIndex topLeft,
com.trolltech.qt.core.QModelIndex bottomRight)
Constructs an item selection that extends from the top-left model item, specified by the topLeft index, to the bottom-right item, specified by bottomRight. |
Method Summary | |
---|---|
void |
append(QItemSelectionRange t)
Appends t to this QItemSelection. |
QItemSelectionRange |
at(int i)
Returns the QItemSelectionRange at position i. |
QItemSelectionRange |
back()
Returns the last item selection range in this QItemSelection. |
void |
clear()
Clears this item selection of ranges. |
QItemSelection |
clone()
This method is reimplemented for internal reasons |
boolean |
contains(com.trolltech.qt.core.QModelIndex index)
Returns true if the selection contains the given index; otherwise returns false. |
int |
count()
Returns the number of QItemSelectionRanges in this QItemSelection. |
boolean |
empty()
Returns true if this QItemSelection is empty. |
QItemSelectionRange |
first()
Returns the first QItemSelectionRange in this item selection. |
static java.util.List |
fromVector(java.util.List vector)
Returns a java.util.List of all QItemSelections in this QItemSelection. |
QItemSelectionRange |
front()
Returns the font of this QItemSelection. |
java.util.List |
indexes()
Returns a list of model indexes that correspond to the selected items. |
int |
indexOf(QItemSelectionRange t)
Returns the index of t - searching from index from. |
int |
indexOf(QItemSelectionRange t,
int from)
Returns the index of t - searching from index from. |
boolean |
isEmpty()
Returns true if there are no QItemSelectionRanges in this QItemSelection; otherwise, returns false. |
QItemSelectionRange |
last()
Returns the last QItemSelectionRange in this QItemSelection. |
int |
lastIndexOf(QItemSelectionRange t)
Returns the last index if t in this QItemSelection. |
int |
lastIndexOf(QItemSelectionRange t,
int from)
Returns the last index if t in this QItemSelection. |
void |
merge(QItemSelection other,
QItemSelectionModel.SelectionFlag[] command)
|
void |
merge(QItemSelection other,
QItemSelectionModel.SelectionFlags command)
Merges the other selection with this QItemSelection using the command given. |
java.util.List |
mid(int pos)
Returns a java.util.List containinglength elements of the QItemSelectionRanges from index pos. |
java.util.List |
mid(int pos,
int length)
Returns a java.util.List containinglength elements of the QItemSelectionRanges from index pos. |
void |
pop_back()
Returns the last QItemSelectionRange in this QItemSelection, and then removes it. |
void |
pop_front()
Returns the first QItemSelectionRange in this QItemSelection, and then removes the range. |
void |
prepend(QItemSelectionRange t)
Inserts t as the first item selection range in this QItemSelection. |
void |
push_back(QItemSelectionRange t)
This function appends t to this QItemSelection's QItemSelectionRanges. |
void |
push_front(QItemSelectionRange t)
Inserts t to the front of this QItemSelection's QItemSelectionRanges. |
int |
removeAll(QItemSelectionRange t)
Removes all item selection ranges from the given QItemSlecectionRange t. |
void |
removeAt(int i)
Removes the QItemSelectionRange at index i. |
void |
removeFirst()
Removes the first item selection range in this QItemSelection. |
void |
removeLast()
Removes the last item selection range in this QItemSelection. |
boolean |
removeOne(QItemSelectionRange t)
Removes t from this QItemSelection. |
void |
replace(int i,
QItemSelectionRange t)
Replaces the QItemSelectionRange at index i with t. |
void |
select(com.trolltech.qt.core.QModelIndex topLeft,
com.trolltech.qt.core.QModelIndex bottomRight)
Adds the items in the range that extends from the top-left model item, specified by the topLeft index, to the bottom-right item, specified by bottomRight to the list. |
int |
size()
Returns the number of QItemSelectionRanges in this QItemSelection. |
static void |
split(QItemSelectionRange range,
QItemSelectionRange other,
QItemSelection result)
Splits the selection range using the selection other range. |
void |
swap(int i,
int j)
Swaps the positions of i and j in this QItemSelection. |
QItemSelectionRange |
takeAt(int i)
Removes the last item selection range from this QItemSelection. |
QItemSelectionRange |
takeFirst()
Removes the first QItemSelectionRange in this item selection, and then returns it. |
QItemSelectionRange |
takeLast()
Removes last QItemSelectionRange in this item selection, and then returns it. |
java.util.List |
toVector()
Returns all item selection ranges in this QItemSelection. |
QItemSelectionRange |
value(int i)
Returns the QItemSelectionRange at index i in this item selection. |
QItemSelectionRange |
value(int i,
QItemSelectionRange defaultValue)
Returns the QItemSelectionRange at index i. |
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, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QItemSelection()
public QItemSelection(com.trolltech.qt.core.QModelIndex topLeft, com.trolltech.qt.core.QModelIndex bottomRight)
Method Detail |
---|
public final void append(QItemSelectionRange t)
public final QItemSelectionRange at(int i)
public final QItemSelectionRange back()
public final void clear()
public final boolean contains(com.trolltech.qt.core.QModelIndex index)
public final int count()
public final boolean empty()
public final QItemSelectionRange first()
public final QItemSelectionRange front()
public final int indexOf(QItemSelectionRange t)
public final int indexOf(QItemSelectionRange t, int from)
public final java.util.List indexes()
public final boolean isEmpty()
public final QItemSelectionRange last()
public final int lastIndexOf(QItemSelectionRange t)
public final int lastIndexOf(QItemSelectionRange t, int from)
public final void merge(QItemSelection other, QItemSelectionModel.SelectionFlag[] command)
public final void merge(QItemSelection other, QItemSelectionModel.SelectionFlags command)
Note that only QItemSelectionModel::Select
, QItemSelectionModel::Deselect
, and QItemSelectionModel::Toggle
are supported.
split()
.
public final java.util.List mid(int pos)
public final java.util.List mid(int pos, int length)
public final void pop_back()
public final void pop_front()
public final void prepend(QItemSelectionRange t)
public final void push_back(QItemSelectionRange t)
public final void push_front(QItemSelectionRange t)
public final int removeAll(QItemSelectionRange t)
public final void removeAt(int i)
public final void removeFirst()
public final void removeLast()
public final boolean removeOne(QItemSelectionRange t)
public final void replace(int i, QItemSelectionRange t)
public final void select(com.trolltech.qt.core.QModelIndex topLeft, com.trolltech.qt.core.QModelIndex bottomRight)
Note:topLeft and bottomRight must have the same parent.
public final int size()
public final void swap(int i, int j)
public final QItemSelectionRange takeAt(int i)
public final QItemSelectionRange takeFirst()
public final QItemSelectionRange takeLast()
public final java.util.List toVector()
public final QItemSelectionRange value(int i)
public final QItemSelectionRange value(int i, QItemSelectionRange defaultValue)
public static java.util.List fromVector(java.util.List vector)
public static void split(QItemSelectionRange range, QItemSelectionRange other, QItemSelection result)
public QItemSelection clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |