Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qitemselectionmodel.cpp File Reference

(6324075a2dec4a70fc459e2ce471f89a533d7ddb)

#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  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 265 of file qitemselectionmodel.cpp.

References QModelIndex::column(), isSelectableAndEnabled(), QModelIndex::row(), and QModelIndex::sibling().

Referenced by QItemSelectionRange::indexes(), and qSelectionIndexes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSelectableAndEnabled()

static bool isSelectableAndEnabled ( Qt::ItemFlags flags)
static

Definition at line 259 of file qitemselectionmodel.cpp.

References Qt::ItemIsEnabled, and Qt::ItemIsSelectable.

Referenced by QItemSelectionModel::columnIntersectsSelection(), QItemSelection::contains(), indexesFromRange(), QItemSelectionModel::isColumnSelected(), QItemSelectionRange::isEmpty(), QItemSelectionModel::isRowSelected(), QItemSelectionModel::isSelected(), and QItemSelectionModel::rowIntersectsSelection().

+ Here is the caller graph for this function:

◆ 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 920 of file qitemselectionmodel.cpp.

References QPersistentModelIndex::column(), QModelIndex::column(), i, QPersistentModelIndex::isValid(), next, QModelIndex::parent(), QPersistentModelIndex::parent(), QPersistentModelIndex::row(), and QModelIndex::row().

Referenced by QItemSelectionModelPrivate::layoutChanged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mergeRowLengths()

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

Definition at line 880 of file qitemselectionmodel.cpp.

References QPersistentModelIndex::column(), i, QPersistentModelIndex::isValid(), next, QPersistentModelIndex::parent(), QPersistentModelIndex::row(), and QPersistentModelIndex::sibling().

Referenced by QItemSelectionModelPrivate::layoutChanged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<<()

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

Definition at line 1971 of file qitemselectionmodel.cpp.

◆ qHash()

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

Definition at line 1745 of file qitemselectionmodel.cpp.

References hash, and seed.

◆ qSelectionIndexes()

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

Definition at line 283 of file qitemselectionmodel.cpp.

References indexesFromRange(), and selection.

+ Here is the call graph for this function:

◆ qSelectionPersistentRowLengths()

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

Definition at line 437 of file qitemselectionmodel.cpp.

References rowLengthsFromRange().

Referenced by QItemSelectionModelPrivate::layoutAboutToBeChanged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 991 of file qitemselectionmodel.cpp.

References QModelIndex::parent().

Referenced by QItemSelectionModelPrivate::layoutChanged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rowLengthsFromRange()

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

Definition at line 243 of file qitemselectionmodel.cpp.

References QModelIndex::column(), QModelIndex::row(), and QModelIndex::sibling().

Referenced by qSelectionPersistentRowLengths().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ selectionIsEmpty()

static bool selectionIsEmpty ( const QItemSelection & selection)
static

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

References QList< T >::begin(), QList< T >::end(), and selection.

Referenced by QItemSelectionModel::hasSelection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: