KItemModels
kmodelindexproxymapper.cpp
20 KModelIndexProxyMapperPrivate(const QAbstractItemModel *leftModel, const QAbstractItemModel *rightModel, KModelIndexProxyMapper *qq)
37 qCDebug(KITEMMODELS_LOG) << selection << m_leftModel << m_rightModel << m_proxyChainDown << m_proxyChainUp;
58 The idea here is that <tt>this</tt> selection model and proxySelectionModel might be in different parts of the
86 We first build the chain from 1 to 5, then start building the chain from 7 to 1. We stop when we find that proxy 2 is
105 QPointer<const QAbstractProxyModel> selectionTargetProxyModel = qobject_cast<const QAbstractProxyModel *>(targetModel);
108 QObject::connect(selectionTargetProxyModel.data(), &QAbstractProxyModel::sourceModelChanged, q_ptr, [this] {
112 selectionTargetProxyModel = qobject_cast<const QAbstractProxyModel *>(selectionTargetProxyModel->sourceModel());
122 QPointer<const QAbstractProxyModel> sourceProxyModel = qobject_cast<const QAbstractProxyModel *>(sourceModel);
126 QObject::connect(sourceProxyModel.data(), &QAbstractProxyModel::sourceModelChanged, q_ptr, [this] {
146 auto konamiRight = m_proxyChainUp.isEmpty() ? m_leftModel : m_proxyChainUp.last()->sourceModel();
147 auto konamiLeft = m_proxyChainDown.isEmpty() ? m_rightModel : m_proxyChainDown.first()->sourceModel();
160KModelIndexProxyMapper::KModelIndexProxyMapper(const QAbstractItemModel *leftModel, const QAbstractItemModel *rightModel, QObject *parent)
188QItemSelection KModelIndexProxyMapper::mapSelectionLeftToRight(const QItemSelection &selection) const
197 qCDebug(KITEMMODELS_LOG) << "FAIL" << selection.first().model() << d->m_leftModel << d->m_rightModel;
236QItemSelection KModelIndexProxyMapper::mapSelectionRightToLeft(const QItemSelection &selection) const
245 qCDebug(KITEMMODELS_LOG) << "FAIL" << selection.first().model() << d->m_leftModel << d->m_rightModel;
This class facilitates easy mapping of indexes and selections through proxy models.
Definition kmodelindexproxymapper.h:75
QItemSelection mapSelectionLeftToRight(const QItemSelection &selection) const
Maps the selection from the left model to the right model.
Definition kmodelindexproxymapper.cpp:188
bool isConnected
Indicates whether there is a chain that can be followed from leftModel to rightModel.
Definition kmodelindexproxymapper.h:83
KModelIndexProxyMapper(const QAbstractItemModel *leftModel, const QAbstractItemModel *rightModel, QObject *parent=nullptr)
Constructor.
Definition kmodelindexproxymapper.cpp:160
QModelIndex mapLeftToRight(const QModelIndex &index) const
Maps the index from the left model to the right model.
Definition kmodelindexproxymapper.cpp:168
QItemSelection mapSelectionRightToLeft(const QItemSelection &selection) const
Maps the selection from the right model to the left model.
Definition kmodelindexproxymapper.cpp:236
QModelIndex mapRightToLeft(const QModelIndex &index) const
Maps the index from the right model to the left model.
Definition kmodelindexproxymapper.cpp:178
void sourceModelChanged()
QModelIndexList indexes() const const
void append(QList< T > &&value)
void clear()
T & first()
qsizetype indexOf(const AT &value, qsizetype from) const const
bool isEmpty() const const
T & last()
QList< T > mid(qsizetype pos, qsizetype length) const const
void prepend(parameter_type value)
qsizetype size() const const
bool hasNext() const const
bool hasPrevious() const const
const T & next()
const T & previous()
void toBack()
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
T * data() const const
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:18:35 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:18:35 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.