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

(5627e113793df3df24742d7af502a075c2c9e95d)

#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>
static void indexesFromRange ( const QItemSelectionRange & range,
ModelIndexContainer & result )
static

Definition at line 310 of file qitemselectionmodel.cpp.

◆ isSelectableAndEnabled()

static bool isSelectableAndEnabled ( Qt::ItemFlags flags)
inlinestatic

Definition at line 304 of file qitemselectionmodel.cpp.

◆ mergeIndexes()

static 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 963 of file qitemselectionmodel.cpp.

◆ mergeRowLengths()

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

Definition at line 923 of file qitemselectionmodel.cpp.

◆ operator<<()

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

Definition at line 2033 of file qitemselectionmodel.cpp.

◆ qHash()

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

Definition at line 1807 of file qitemselectionmodel.cpp.

References RowOrColumnDefinition::rowOrColumn.

◆ qSelectionIndexes()

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

Definition at line 328 of file qitemselectionmodel.cpp.

◆ qSelectionPersistentRowLengths()

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

Definition at line 478 of file qitemselectionmodel.cpp.

◆ qt_PersistentModelIndexLessThan()

static 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 1034 of file qitemselectionmodel.cpp.

◆ rowLengthsFromRange()

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

Definition at line 288 of file qitemselectionmodel.cpp.

◆ selectionIsEmpty()

static 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 1748 of file qitemselectionmodel.cpp.