|
Q_CORE_EXPORT | QItemSelection (const QModelIndex &topLeft, const QModelIndex &bottomRight) |
| Constructs an empty selection.
|
|
Q_CORE_EXPORT void | select (const QModelIndex &topLeft, const 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.
|
|
Q_CORE_EXPORT bool | contains (const QModelIndex &index) const |
| Returns true if the selection contains the given index; otherwise returns false .
|
|
Q_CORE_EXPORT QModelIndexList | indexes () const |
| Returns a list of model indexes that correspond to the selected items.
|
|
Q_CORE_EXPORT void | merge (const QItemSelection &other, QItemSelectionModel::SelectionFlags command) |
| Merges the other selection with this QItemSelection using the command given.
|
|
DataPointer & | data_ptr () & |
|
const DataPointer & | data_ptr () const & |
|
DataPointer && | data_ptr () && |
|
| QList (DataPointer dd) noexcept |
|
constexpr | QList () noexcept=default |
|
| QList (qsizetype size) |
|
| QList (qsizetype size, parameter_type t) |
|
| QList (std::initializer_list< QItemSelectionRange > args) |
|
| QList (InputIterator i1, InputIterator i2) |
|
| QList (const String &str) |
|
| QList (qsizetype size, Qt::Initialization) |
|
QList< QItemSelectionRange > & | operator= (std::initializer_list< QItemSelectionRange > args) |
|
void | swap (QList &other) noexcept |
|
QTypeTraits::compare_eq_result_container< QList, U > | operator== (const QList &other) const |
|
QTypeTraits::compare_eq_result_container< QList, U > | operator!= (const QList &other) const |
|
QTypeTraits::compare_lt_result_container< QList, U > | operator< (const QList &other) const noexcept(noexcept(std::lexicographical_compare< typename QList< U >::const_iterator, typename QList::const_iterator >(std::declval< QList< U > >().begin(), std::declval< QList< U > >().end(), other.begin(), other.end()))) |
|
QTypeTraits::compare_lt_result_container< QList, U > | operator> (const QList &other) const noexcept(noexcept(other< std::declval< QList< U > >())) |
|
QTypeTraits::compare_lt_result_container< QList, U > | operator<= (const QList &other) const noexcept(noexcept(other< std::declval< QList< U > >())) |
|
QTypeTraits::compare_lt_result_container< QList, U > | operator>= (const QList &other) const noexcept(noexcept(std::declval< QList< U > >()< other)) |
|
constexpr qsizetype | size () const noexcept |
|
constexpr qsizetype | count () const noexcept |
|
qsizetype | count (const AT &t) const noexcept |
|
constexpr qsizetype | length () const noexcept |
|
constexpr bool | isEmpty () const noexcept |
|
void | resize (qsizetype size) |
|
void | resize (qsizetype size, parameter_type c) |
|
void | resizeForOverwrite (qsizetype size) |
|
qsizetype | capacity () const |
|
void | reserve (qsizetype size) |
|
void | squeeze () |
|
void | detach () |
|
bool | isDetached () const noexcept |
|
bool | isSharedWith (const QList< QItemSelectionRange > &other) const |
|
pointer | data () |
|
const_pointer | data () const noexcept |
|
const_pointer | constData () const noexcept |
|
void | clear () |
|
const_reference | at (qsizetype i) const noexcept |
|
reference | operator[] (qsizetype i) |
|
const_reference | operator[] (qsizetype i) const noexcept |
|
void | append (parameter_type t) |
|
void | append (const_iterator i1, const_iterator i2) |
|
void | append (rvalue_ref t) |
|
void | append (const QList< QItemSelectionRange > &l) |
|
void | append (QList< QItemSelectionRange > &&l) |
|
void | prepend (rvalue_ref t) |
|
void | prepend (parameter_type t) |
|
reference | emplaceBack (Args &&... args) |
|
reference | emplaceFront (Args &&... args) |
|
iterator | insert (qsizetype i, parameter_type t) |
|
iterator | insert (qsizetype i, qsizetype n, parameter_type t) |
|
iterator | insert (const_iterator before, parameter_type t) |
|
iterator | insert (const_iterator before, qsizetype n, parameter_type t) |
|
iterator | insert (const_iterator before, rvalue_ref t) |
|
iterator | insert (qsizetype i, rvalue_ref t) |
|
QList & | assign (qsizetype n, parameter_type t) |
|
QList & | assign (InputIterator first, InputIterator last) |
|
QList & | assign (std::initializer_list< QItemSelectionRange > l) |
|
iterator | emplace (const_iterator before, Args &&... args) |
|
iterator | emplace (qsizetype i, Args &&... args) |
|
void | replace (qsizetype i, parameter_type t) |
|
void | replace (qsizetype i, rvalue_ref t) |
|
void | remove (qsizetype i, qsizetype n=1) |
|
void | removeFirst () noexcept |
|
void | removeLast () noexcept |
|
value_type | takeFirst () |
|
value_type | takeLast () |
|
QList< QItemSelectionRange > & | fill (parameter_type t, qsizetype size=-1) |
|
void | removeAt (qsizetype i) |
|
qsizetype | removeAll (const AT &t) |
|
bool | removeOne (const AT &t) |
|
qsizetype | removeIf (Predicate pred) |
|
QItemSelectionRange | takeAt (qsizetype i) |
|
void | move (qsizetype from, qsizetype to) |
|
iterator | begin () |
|
const_iterator | begin () const noexcept |
|
iterator | end () |
|
const_iterator | end () const noexcept |
|
const_iterator | cbegin () const noexcept |
|
const_iterator | cend () const noexcept |
|
const_iterator | constBegin () const noexcept |
|
const_iterator | constEnd () const noexcept |
|
reverse_iterator | rbegin () |
|
const_reverse_iterator | rbegin () const noexcept |
|
reverse_iterator | rend () |
|
const_reverse_iterator | rend () const noexcept |
|
const_reverse_iterator | crbegin () const noexcept |
|
const_reverse_iterator | crend () const noexcept |
|
iterator | erase (const_iterator begin, const_iterator end) |
|
iterator | erase (const_iterator pos) |
|
QItemSelectionRange & | first () |
|
const QItemSelectionRange & | first () const noexcept |
|
QList< QItemSelectionRange > | first (qsizetype n) const |
|
const QItemSelectionRange & | constFirst () const noexcept |
|
QItemSelectionRange & | last () |
|
const QItemSelectionRange & | last () const noexcept |
|
QList< QItemSelectionRange > | last (qsizetype n) const |
|
const QItemSelectionRange & | constLast () const noexcept |
|
bool | startsWith (parameter_type t) const |
|
bool | endsWith (parameter_type t) const |
|
QList< QItemSelectionRange > | mid (qsizetype pos, qsizetype len=-1) const |
|
QList< QItemSelectionRange > | sliced (qsizetype pos) const |
|
QList< QItemSelectionRange > | sliced (qsizetype pos, qsizetype n) const |
|
QItemSelectionRange | value (qsizetype i) const |
|
QItemSelectionRange | value (qsizetype i, parameter_type defaultValue) const |
|
void | swapItemsAt (qsizetype i, qsizetype j) |
|
void | push_back (parameter_type t) |
|
void | push_back (rvalue_ref t) |
|
void | push_front (rvalue_ref t) |
|
void | push_front (parameter_type t) |
|
void | pop_back () noexcept |
|
void | pop_front () noexcept |
|
reference | emplace_back (Args &&... args) |
|
bool | empty () const noexcept |
|
reference | front () |
|
const_reference | front () const noexcept |
|
reference | back () |
|
const_reference | back () const noexcept |
|
void | shrink_to_fit () |
|
constexpr qsizetype | max_size () const noexcept |
|
QList< QItemSelectionRange > & | operator+= (const QList< QItemSelectionRange > &l) |
|
QList< QItemSelectionRange > & | operator+= (QList< QItemSelectionRange > &&l) |
|
QList< QItemSelectionRange > & | operator+= (parameter_type t) |
|
QList< QItemSelectionRange > & | operator+= (rvalue_ref t) |
|
QList< QItemSelectionRange > | operator+ (const QList< QItemSelectionRange > &l) const & |
|
QList< QItemSelectionRange > | operator+ (const QList< QItemSelectionRange > &l) && |
|
QList< QItemSelectionRange > | operator+ (QList< QItemSelectionRange > &&l) const & |
|
QList< QItemSelectionRange > | operator+ (QList< QItemSelectionRange > &&l) && |
|
QList< QItemSelectionRange > & | operator<< (parameter_type t) |
|
QList< QItemSelectionRange > & | operator<< (const QList< QItemSelectionRange > &l) |
|
QList< QItemSelectionRange > & | operator<< (QList< QItemSelectionRange > &&l) |
|
QList< QItemSelectionRange > & | operator<< (rvalue_ref t) |
|
QList< QItemSelectionRange > | toList () const noexcept |
|
QList< QItemSelectionRange > | toVector () const noexcept |
|
qsizetype | indexOf (const AT &t, qsizetype from=0) const noexcept |
|
qsizetype | lastIndexOf (const AT &t, qsizetype from=-1) const noexcept |
|
bool | contains (const AT &t) const noexcept |
|
\inmodule QtCore
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 \l{Model/View Classes} and is part of Qt's \l{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
.
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:
...
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 178 of file qitemselectionmodel.h.