CopperSpice API  1.9.2
QItemSelectionRange Class Reference

The QItemSelectionRange class manages information about a range of selected items in a model. More...

Public Methods

 QItemSelectionRange ()
 
 QItemSelectionRange (const QItemSelectionRange &other) = default
 
 QItemSelectionRange (const QModelIndex &index)
 
 QItemSelectionRange (const QModelIndex &topLeft, const QModelIndex &bottomRight)
 
 QItemSelectionRange (QItemSelectionRange &&other) = default
 
int bottom () const
 
const QPersistentModelIndexbottomRight () const
 
bool contains (const QModelIndex &index) const
 
bool contains (int row, int column, const QModelIndex &parentIndex) const
 
int height () const
 
QModelIndexList indexes () const
 
QItemSelectionRange intersected (const QItemSelectionRange &other) const
 
bool intersects (const QItemSelectionRange &other) const
 
bool isEmpty () const
 
bool isValid () const
 
int left () const
 
const QAbstractItemModelmodel () const
 
bool operator!= (const QItemSelectionRange &other) const
 
bool operator< (const QItemSelectionRange &other) const
 
QItemSelectionRange & operator= (const QItemSelectionRange &other) = default
 
QItemSelectionRange & operator= (QItemSelectionRange &&other) = default
 
bool operator== (const QItemSelectionRange &other) const
 
QModelIndex parent () const
 
int right () const
 
void swap (QItemSelectionRange &other)
 
int top () const
 
const QPersistentModelIndextopLeft () const
 
int width () const
 

Related Functions

These are not member functions

uint qHash (const QItemSelectionRange &key, uint seed=0)
 

Detailed Description

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 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
QAbstractItemModel, QItemSelection, QItemSelectionModel, Model/View Architecture

Constructor & Destructor Documentation

QItemSelectionRange::QItemSelectionRange ( )
inline

Constructs an empty selection range.

QItemSelectionRange::QItemSelectionRange ( const QItemSelectionRange &  other)
default

Copy constructs a new QItemSelectionRange from other.

QItemSelectionRange::QItemSelectionRange ( QItemSelectionRange &&  other)
default

Move constructs a new QItemSelectionRange from other.

QItemSelectionRange::QItemSelectionRange ( const QModelIndex topLeft,
const QModelIndex bottomRight 
)
inline

Constructs a new selection range containing only the index specified by the topLeft and the index bottomRight.

QItemSelectionRange::QItemSelectionRange ( const QModelIndex index)
inlineexplicit

Constructs a new selection range containing only the item specified by the given index.

Method Documentation

int QItemSelectionRange::bottom ( ) const
inline

Returns the row index corresponding to the lowermost selected row in the selection range.

const QPersistentModelIndex & QItemSelectionRange::bottomRight ( ) const
inline

Returns the index for the item located at the bottom-right corner of the selection range.

See also
bottom(), right(), topLeft()
bool QItemSelectionRange::contains ( const QModelIndex index) const
inline

Returns true if the model item specified by the index lies within the range of selected items, otherwise returns false.

bool QItemSelectionRange::contains ( int  row,
int  column,
const QModelIndex parentIndex 
) const
inline

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.

int QItemSelectionRange::height ( ) const
inline

Returns the number of selected rows in the selection range.

QModelIndexList QItemSelectionRange::indexes ( ) const

Returns the list of model index items stored in the selection.

QItemSelectionRange QItemSelectionRange::intersected ( const QItemSelectionRange &  other) const

Returns a new selection range containing only the items that are found in both the selection range and the other selection range.

bool QItemSelectionRange::intersects ( const QItemSelectionRange &  other) const

Returns true if this selection range intersects (overlaps with) the other range given, otherwise returns false.

bool QItemSelectionRange::isEmpty ( ) const

Returns true if the selection range contains no selectable item.

bool QItemSelectionRange::isValid ( ) const
inline

Returns true if the selection range is valid, otherwise returns false.

int QItemSelectionRange::left ( ) const
inline

Returns the column index corresponding to the leftmost selected column in the selection range.

const QAbstractItemModel * QItemSelectionRange::model ( ) const
inline

Returns the model that the items in the selection range belong to.

bool QItemSelectionRange::operator!= ( const QItemSelectionRange &  other) const
inline

Returns true if the selection range differs from the other range given, otherwise returns false.

bool QItemSelectionRange::operator< ( const QItemSelectionRange &  other) const
inline

Returns true if the selection range is less than the other range given, otherwise returns false.

QItemSelectionRange & QItemSelectionRange::operator= ( const QItemSelectionRange &  other)
default

Copy assigns from other and returns a reference to this object.

QItemSelectionRange & QItemSelectionRange::operator= ( QItemSelectionRange &&  other)
default

Move assigns from other and returns a reference to this object.

bool QItemSelectionRange::operator== ( const QItemSelectionRange &  other) const
inline

Returns true if the selection range is exactly the same as the other range given, otherwise returns false.

QModelIndex QItemSelectionRange::parent ( ) const
inline

Returns the parent model item index of the items in the selection range.

int QItemSelectionRange::right ( ) const
inline

Returns the column index corresponding to the rightmost selected column in the selection range.

void QItemSelectionRange::swap ( QItemSelectionRange &  other)
inline

Swaps this selection range contents with other. This method is very fast and never fails.

int QItemSelectionRange::top ( ) const
inline

Returns the row index corresponding to the uppermost selected row in the selection range.

const QPersistentModelIndex & QItemSelectionRange::topLeft ( ) const
inline

Returns the index for the item located at the top-left corner of the selection range.

See also
top(), left(), bottomRight()
int QItemSelectionRange::width ( ) const
inline

Returns the number of selected columns in the selection range.

Friends And Related Function Documentation

uint qHash ( const QItemSelectionRange &  key,
uint  seed = 0 
)
related

Returns the hash value for key using seed to seed the calculation.