Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

QItemSelection Class Reference

Inheritance diagram for QItemSelection:

QList< QItemSelectionRange >

List of all members.

Detailed Description

The QItemSelection class manages information about selected items in a model.

The QItemSelection class is one of the {Model/View Classes} and is part of Qt's {Model/View Programming}{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.

See also:
{Model/View Programming}, QItemSelectionModel

Definition at line 205 of file qitemselectionmodel.h.

Public Types

typedef const value_typeconst_pointer
typedef const value_typeconst_reference
typedef const_iterator ConstIterator
typedef ptrdiff_t difference_type
typedef iterator Iterator
typedef value_typepointer
typedef value_typereference
typedef int size_type
typedef QItemSelectionRange value_type

Public Member Functions

void append (const QItemSelectionRange &t)
const QItemSelectionRangeat (int i) const
const QItemSelectionRangeback () const
QItemSelectionRangeback ()
const_iterator begin () const
iterator begin ()
void clear ()
const_iterator constBegin () const
const_iterator constEnd () const
QBool contains (const QItemSelectionRange &t) const
bool contains (const QModelIndex &index) const
int count () const
int count (const QItemSelectionRange &t) const
void detach ()
bool empty () const
const_iterator end () const
iterator end ()
iterator erase (iterator first, iterator last)
iterator erase (iterator pos)
const QItemSelectionRangefirst () const
QItemSelectionRangefirst ()
const QItemSelectionRangefront () const
QItemSelectionRangefront ()
QModelIndexList indexes () const
int indexOf (const QItemSelectionRange &t, int from=0) const
iterator insert (iterator before, const QItemSelectionRange &t)
void insert (int i, const QItemSelectionRange &t)
bool isDetached () const
bool isEmpty () const
const QItemSelectionRangelast () const
QItemSelectionRangelast ()
int lastIndexOf (const QItemSelectionRange &t, int from=-1) const
void merge (const QItemSelection &other, QItemSelectionModel::SelectionFlags command)
QList< QItemSelectionRangemid (int pos, int length=-1) const
void move (int from, int to)
bool operator!= (const QList< QItemSelectionRange > &l) const
QList< QItemSelectionRangeoperator+ (const QList< QItemSelectionRange > &l) const
QList< QItemSelectionRange > & operator+= (const QItemSelectionRange &t)
QList< QItemSelectionRange > & operator+= (const QList< QItemSelectionRange > &l)
QList< QItemSelectionRange > & operator<< (const QList< QItemSelectionRange > &l)
QList< QItemSelectionRange > & operator<< (const QItemSelectionRange &t)
bool operator== (const QList< QItemSelectionRange > &l) const
QItemSelectionRangeoperator[] (int i)
const QItemSelectionRangeoperator[] (int i) const
void pop_back ()
void pop_front ()
void prepend (const QItemSelectionRange &t)
void push_back (const QItemSelectionRange &t)
void push_front (const QItemSelectionRange &t)
 QItemSelection (const QModelIndex &topLeft, const QModelIndex &bottomRight)
 QItemSelection ()
int removeAll (const QItemSelectionRange &t)
void removeAt (int i)
void removeFirst ()
void removeLast ()
void replace (int i, const QItemSelectionRange &t)
void select (const QModelIndex &topLeft, const QModelIndex &bottomRight)
void setSharable (bool sharable)
int size () const
void swap (int i, int j)
QItemSelectionRange takeAt (int i)
QItemSelectionRange takeFirst ()
QItemSelectionRange takeLast ()
QSet< QItemSelectionRangetoSet () const
std::list< QItemSelectionRangetoStdList () const
QVector< QItemSelectionRangetoVector () const
QItemSelectionRange value (int i, const QItemSelectionRange &defaultValue) const
QItemSelectionRange value (int i) const

Static Public Member Functions

static QList< QItemSelectionRangefromSet (const QSet< QItemSelectionRange > &set)
static QList< QItemSelectionRangefromStdList (const std::list< QItemSelectionRange > &list)
static QList< QItemSelectionRangefromVector (const QVector< QItemSelectionRange > &vector)
static void split (const QItemSelectionRange &range, const QItemSelectionRange &other, QItemSelection *result)

Public Attributes

QListData::Data * d
QListData p


class const_iterator
class iterator

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index