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

Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends

QItemSelection Class Reference

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

Inheritance diagram for QItemSelection:
Inheritance graph
[legend]
Collaboration diagram for QItemSelection:
Collaboration graph
[legend]

List of all members.

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)
void append (const QList< QItemSelectionRange > &t)
const QItemSelectionRangeat (int i) const
QItemSelectionRangeback ()
const QItemSelectionRangeback () const
iterator begin ()
const_iterator begin () const
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 QItemSelectionRange &t) const
int count () const
void detach ()
bool empty () const
iterator end ()
const_iterator end () const
bool endsWith (const QItemSelectionRange &t) const
iterator erase (iterator pos)
iterator erase (iterator first, iterator last)
QItemSelectionRangefirst ()
const QItemSelectionRangefirst () const
QItemSelectionRangefront ()
const QItemSelectionRangefront () const
QModelIndexList indexes () const
int indexOf (const QItemSelectionRange &t, int from=0) const
void insert (int i, const QItemSelectionRange &t)
iterator insert (iterator before, const QItemSelectionRange &t)
bool isDetached () const
bool isEmpty () const
const QItemSelectionRangelast () const
QItemSelectionRangelast ()
int lastIndexOf (const QItemSelectionRange &t, int from=-1) const
int length () 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 QList< QItemSelectionRange > &l)
QList< QItemSelectionRange > & operator+= (const QItemSelectionRange &t)
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 ()
bool removeOne (const QItemSelectionRange &t)
void replace (int i, const QItemSelectionRange &t)
void select (const QModelIndex &topLeft, const QModelIndex &bottomRight)
void setSharable (bool sharable)
int size () const
bool startsWith (const QItemSelectionRange &t) 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::Datad
QListData p

Friends

class const_iterator
class iterator

Detailed Description

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 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.

doc/src/snippets/code/src_gui_itemviews_qitemselectionmodel.cpp 0

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:

doc/src/snippets/code/src_gui_itemviews_qitemselectionmodel.cpp 1

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.


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

Generated by  Doxygen 1.6.0   Back to index