Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qitemselectionmodel.cpp File Reference

(7fee5f840fe6e968cb30a3ee8a17a170364be409)

#include "qitemselectionmodel.h"
#include "qitemselectionmodel_p.h"
#include <private/qitemselectionmodel_p.h>
#include <private/qabstractitemmodel_p.h>
#include <private/qduplicatetracker_p.h>
#include <private/qoffsetstringarray_p.h>
#include <qdebug.h>
#include <algorithm>
#include <functional>
#include "moc_qitemselectionmodel.cpp"
Include dependency graph for qitemselectionmodel.cpp:

Go to the source code of this file.

Classes

struct  QItemSelectionRangeRefCache
struct  RowOrColumnDefinition

Namespaces

namespace  QtFunctionObjects

Functions

static void rowLengthsFromRange (const QItemSelectionRange &range, QList< std::pair< QPersistentModelIndex, uint > > &result)
static bool isSelectableAndEnabled (Qt::ItemFlags flags)
template<typename ModelIndexContainer>
static void indexesFromRange (const QItemSelectionRange &range, ModelIndexContainer &result)
template<typename ModelIndexContainer>
static ModelIndexContainer qSelectionIndexes (const QItemSelection &selection)
static QList< std::pair< QPersistentModelIndex, uint > > qSelectionPersistentRowLengths (const QItemSelection &sel)
static QItemSelection mergeRowLengths (const QList< std::pair< QPersistentModelIndex, uint > > &rowLengths)
static QItemSelection mergeIndexes (const QList< QPersistentModelIndex > &indexes)
static bool qt_PersistentModelIndexLessThan (const QPersistentModelIndex &i1, const QPersistentModelIndex &i2)
static bool selectionIsEmpty (const QItemSelection &selection)
size_t qHash (const RowOrColumnDefinition &key, size_t seed=0) noexcept
QDebug operator<< (QDebug dbg, const QItemSelectionRange &range)

Function Documentation

◆ indexesFromRange()

template<typename ModelIndexContainer>
void indexesFromRange ( const QItemSelectionRange & range,
ModelIndexContainer & result )
static

Definition at line 311 of file qitemselectionmodel.cpp.

◆ isSelectableAndEnabled()

bool isSelectableAndEnabled ( Qt::ItemFlags flags)
inlinestatic

Definition at line 305 of file qitemselectionmodel.cpp.

◆ mergeIndexes()

QItemSelection mergeIndexes ( const QList< QPersistentModelIndex > & indexes)
static

Merges indexes into an item selection made up of ranges. Assumes that the indexes are sorted.

Definition at line 964 of file qitemselectionmodel.cpp.

◆ mergeRowLengths()

QItemSelection mergeRowLengths ( const QList< std::pair< QPersistentModelIndex, uint > > & rowLengths)
static

Definition at line 924 of file qitemselectionmodel.cpp.

◆ operator<<()

QDebug operator<< ( QDebug dbg,
const QItemSelectionRange & range )

Definition at line 2038 of file qitemselectionmodel.cpp.

◆ qHash()

size_t qHash ( const RowOrColumnDefinition & key,
size_t seed = 0 )
noexcept

Definition at line 1815 of file qitemselectionmodel.cpp.

References RowOrColumnDefinition::rowOrColumn.

◆ qSelectionIndexes()

template<typename ModelIndexContainer>
ModelIndexContainer qSelectionIndexes ( const QItemSelection & selection)
static

Definition at line 329 of file qitemselectionmodel.cpp.

◆ qSelectionPersistentRowLengths()

QList< std::pair< QPersistentModelIndex, uint > > qSelectionPersistentRowLengths ( const QItemSelection & sel)
static

Definition at line 479 of file qitemselectionmodel.cpp.

◆ qt_PersistentModelIndexLessThan()

bool qt_PersistentModelIndexLessThan ( const QPersistentModelIndex & i1,
const QPersistentModelIndex & i2 )
static

Sort predicate function for QItemSelectionModelPrivate::layoutChanged(), sorting by parent first in addition to operator<(). This is to prevent fragmentation of the selection by grouping indexes with the same row, column of different parents next to each other, which may happen when a selection spans sub-trees.

Definition at line 1035 of file qitemselectionmodel.cpp.

◆ rowLengthsFromRange()

void rowLengthsFromRange ( const QItemSelectionRange & range,
QList< std::pair< QPersistentModelIndex, uint > > & result )
static

Definition at line 289 of file qitemselectionmodel.cpp.

◆ selectionIsEmpty()

bool selectionIsEmpty ( const QItemSelection & selection)
inlinestatic

Check whether the selection is empty. In contrast to selection.isEmpty(), this takes into account whether items are enabled and whether they are selectable.

Definition at line 1756 of file qitemselectionmodel.cpp.