digikam
gpsitemsortproxymodel.cpp
Go to the documentation of this file.
82 // qCDebug(DIGIKAM_GENERAL_LOG) << itemLeft << itemRight << column << rowCount() << d->imageModel->rowCount();
142 m_indexMapper = new GPSModelIndexProxyMapper(q_ptr->model(), m_linkedItemSelectionModel->model(), q_ptr);
143 const QItemSelection mappedSelection = m_indexMapper->mapSelectionRightToLeft(m_linkedItemSelectionModel->selection());
185 void GPSLinkItemSelectionModel::setLinkedItemSelectionModel(QItemSelectionModel* const selectionModel)
215 void GPSLinkItemSelectionModel::select(const QModelIndex& index, QItemSelectionModel::SelectionFlags command)
228 // Doing so would end up calling GPSLinkItemSelectionModel::select(QItemSelection, QItemSelectionModel::SelectionFlags)
230 // This is because the code for QItemSelectionModel::select(QModelIndex, QItemSelectionModel::SelectionFlags) looks like this:
245 d->m_linkedItemSelectionModel->select(d->m_indexMapper->mapSelectionLeftToRight(QItemSelection(index, index)), command);
253 void GPSLinkItemSelectionModel::select(const QItemSelection& selection, QItemSelectionModel::SelectionFlags command)
278 void GPSLinkItemSelectionModelPrivate::sourceSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected)
333 qCDebug(DIGIKAM_GENERAL_LOG) << selection << m_leftModel << m_rightModel << m_proxyChainDown << m_proxyChainUp;
380 QPointer<const QAbstractProxyModel> selectionTargetProxyModel = qobject_cast<const QAbstractProxyModel *>(targetModel);
393 selectionTargetProxyModel = qobject_cast<const QAbstractProxyModel*>(selectionTargetProxyModel->sourceModel());
404 QPointer<const QAbstractProxyModel> sourceProxyModel = qobject_cast<const QAbstractProxyModel *>(sourceModel);
433 auto konamiRight = m_proxyChainUp.isEmpty() ? m_leftModel : m_proxyChainUp.last()->sourceModel();
434 auto konamiLeft = m_proxyChainDown.isEmpty() ? m_rightModel : m_proxyChainDown.first()->sourceModel();
485 QItemSelection GPSModelIndexProxyMapper::mapSelectionLeftToRight(const QItemSelection& selection) const
496 qCDebug(DIGIKAM_GENERAL_LOG) << "FAIL" << selection.first().model() << d->m_leftModel << d->m_rightModel;
539 Q_ASSERT((!seekSelection.isEmpty() && seekSelection.first().model() == d->m_rightModel) || true);
543 QItemSelection GPSModelIndexProxyMapper::mapSelectionRightToLeft(const QItemSelection& selection) const
554 qCDebug(DIGIKAM_GENERAL_LOG) << "FAIL" << selection.first().model() << d->m_leftModel << d->m_rightModel;
597 Q_ASSERT((!seekSelection.isEmpty() && seekSelection.first().model() == d->m_leftModel) || true);
QModelIndexList indexes() const
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
QModelIndex mapLeftToRight(const QModelIndex &index) const
Maps the index from the left model to the right model.
Definition: gpsitemsortproxymodel.cpp:461
T * data() const
const T & next()
bool isConnected() const
const T & previous()
void linkedItemSelectionModelChanged()
void select(const QModelIndex &topLeft, const QModelIndex &bottomRight)
Makes it possible to share a selection in multiple views which do not have the same source model...
Definition: gpsitemsortproxymodel.h:77
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
int size() const
QItemSelectionModel * linkedItemSelectionModel() const
int indexOf(const T &value, int from) const
void setLinkedItemSelectionModel(QItemSelectionModel *const selectionModel)
Definition: gpsitemsortproxymodel.cpp:185
void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) override
Definition: gpsitemsortproxymodel.cpp:215
GPSLinkItemSelectionModelPrivate *const d_ptr
Definition: gpsitemsortproxymodel.h:105
bool isValid() const
GPSLinkItemSelectionModel(QAbstractItemModel *const targetModel, QItemSelectionModel *const linkedItemSelectionModel, QObject *const parent=nullptr)
Definition: gpsitemsortproxymodel.cpp:158
const QItemSelection selection() const
bool isEmpty() const
virtual void select(const QModelIndex &index, QFlags< QItemSelectionModel::SelectionFlag > command)
~GPSLinkItemSelectionModel()
Definition: gpsitemsortproxymodel.cpp:173
QModelIndex mapRightToLeft(const QModelIndex &index) const
Maps the index from the right model to the left model.
Definition: gpsitemsortproxymodel.cpp:473
void toBack()
T & first()
Definition: piwigotalker.h:47
QItemSelection mapSelectionRightToLeft(const QItemSelection &selection) const
Maps the selection from the right model to the left model.
Definition: gpsitemsortproxymodel.cpp:543
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
bool hasPrevious() const
#define p
QItemSelection mapSelectionLeftToRight(const QItemSelection &selection) const
Maps the selection from the left model to the right model.
Definition: gpsitemsortproxymodel.cpp:485
This class facilitates easy mapping of indexes and selections through proxy models.
Definition: gpsitemsortproxymodel.h:136
GPSModelIndexProxyMapper(const QAbstractItemModel *const leftModel, const QAbstractItemModel *const rightModel, QObject *const parent=nullptr)
Definition: gpsitemsortproxymodel.cpp:448
~GPSModelIndexProxyMapper()
Definition: gpsitemsortproxymodel.cpp:456
QList< T > mid(int pos, int length) const
int column() const
void prepend(const T &value)
bool isValid() const
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
typedef SelectionFlags
#define q
bool hasNext() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Wed Dec 11 2019 07:34:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2019 The KDE developers.
Generated on Wed Dec 11 2019 07:34:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.