7#include <private/qabstractproxymodel_p.h>
127 if (!
d->model || !sourceIndex.isValid())
130 Q_ASSERT(sourceIndex.model() ==
d->model);
131 return createIndex(sourceIndex.row(), sourceIndex.column(), sourceIndex.internalPointer());
143 return proxySelection;
151 proxySelection.append(
range);
154 return proxySelection;
166 return sourceSelection;
174 sourceSelection.append(
range);
177 return sourceSelection;
186 if (!
d->model || !proxyIndex.isValid())
188 Q_ASSERT(proxyIndex.model() ==
this);
189 return createSourceIndex(proxyIndex.row(), proxyIndex.column(), proxyIndex.internalPointer());
203 QModelIndexList::const_iterator
it = sourceList.
constBegin();
204 const QModelIndexList::const_iterator
end = sourceList.constEnd();
206 proxyList.
reserve(sourceList.size());
249 Q_ASSERT(sourceParent.isValid() ? sourceParent.model() ==
this :
true);
261 Q_ASSERT(sourceParent.isValid() ? sourceParent.model() ==
this :
true);
283 return d->model->headerData(section, orientation, role);
298 for (
const auto &
c :
d->m_sourceModelConnections)
305 d->m_sourceModelConnections = {
340 if (
d->m_handleLayoutChanges) {
341 d->m_sourceModelConnections.emplace_back(
344 d->m_sourceModelConnections.emplace_back(
370 d_func()->m_handleLayoutChanges =
b;
381 return d_func()->m_handleLayoutChanges;
392 int sourceStart,
int sourceEnd,
396 Q_ASSERT(sourceParent.isValid() ? sourceParent.model() ==
model :
true);
397 Q_ASSERT(destParent.isValid() ? destParent.model() ==
model :
true);
399 q->beginMoveColumns(
q->mapFromSource(sourceParent), sourceStart, sourceEnd,
q->mapFromSource(destParent), dest);
416 q->endInsertColumns();
420 int sourceStart,
int sourceEnd,
423 Q_ASSERT(sourceParent.isValid() ? sourceParent.model() ==
model :
true);
424 Q_ASSERT(destParent.isValid() ? destParent.model() ==
model :
true);
441 q->endRemoveColumns();
446 const QList<int> &roles)
451 emit q->dataChanged(
q->mapFromSource(topLeft),
q->mapFromSource(bottomRight), roles);
458 emit q->headerDataChanged(orientation,
first, last);
466 QList<QPersistentModelIndex> parents;
467 parents.reserve(sourceParents.size());
475 parents << mappedParent;
478 emit q->layoutAboutToBeChanged(parents,
hint);
480 const auto proxyPersistentIndexes =
q->persistentIndexList();
481 for (
const QModelIndex &proxyPersistentIndex : proxyPersistentIndexes) {
483 Q_ASSERT(proxyPersistentIndex.isValid());
485 Q_ASSERT(srcPersistentIndex.isValid());
502 QList<QPersistentModelIndex> parents;
503 parents.reserve(sourceParents.size());
511 parents << mappedParent;
520 q->beginResetModel();
538 int sourceStart,
int sourceEnd,
541 Q_ASSERT(sourceParent.isValid() ? sourceParent.model() ==
model :
true);
542 Q_ASSERT(destParent.isValid() ? destParent.model() ==
model :
true);
544 q->beginMoveRows(
q->mapFromSource(sourceParent), sourceStart, sourceEnd,
q->mapFromSource(destParent), dest);
569 Q_ASSERT(sourceParent.isValid() ? sourceParent.model() ==
model :
true);
570 Q_ASSERT(destParent.isValid() ? destParent.model() ==
model :
true);
592#include "moc_qidentityproxymodel.cpp"
void rowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow, QPrivateSignal)
void endResetModel()
Completes a model reset operation.
void modelAboutToBeReset(QPrivateSignal)
void columnsRemoved(const QModelIndex &parent, int first, int last, QPrivateSignal)
This signal is emitted after columns have been removed from the model.
LayoutChangeHint
This enum describes the way the model changes layout.
void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last, QPrivateSignal)
This signal is emitted just before rows are inserted into the model.
void columnsAboutToBeInserted(const QModelIndex &parent, int first, int last, QPrivateSignal)
This signal is emitted just before columns are inserted into the model.
void modelReset(QPrivateSignal)
Q_INVOKABLE int int const QModelIndex & destinationParent
void layoutAboutToBeChanged(const QList< QPersistentModelIndex > &parents=QList< QPersistentModelIndex >(), QAbstractItemModel::LayoutChangeHint hint=QAbstractItemModel::NoLayoutChangeHint)
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles=QList< int >())
This signal is emitted whenever the data in an existing item changes.
void columnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn, QPrivateSignal)
void columnsAboutToBeRemoved(const QModelIndex &parent, int first, int last, QPrivateSignal)
This signal is emitted just before columns are removed from the model.
Q_INVOKABLE int int const QModelIndex int destinationChild
void layoutChanged(const QList< QPersistentModelIndex > &parents=QList< QPersistentModelIndex >(), QAbstractItemModel::LayoutChangeHint hint=QAbstractItemModel::NoLayoutChangeHint)
Q_INVOKABLE int sourceRow
void headerDataChanged(Qt::Orientation orientation, int first, int last)
This signal is emitted whenever a header is changed.
void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last, QPrivateSignal)
This signal is emitted just before rows are removed from the model.
void beginResetModel()
Begins a model reset operation.
void rowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow, QPrivateSignal)
void rowsInserted(const QModelIndex &parent, int first, int last, QPrivateSignal)
This signal is emitted after rows have been inserted into the model.
Q_INVOKABLE int sourceColumn
void columnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn, QPrivateSignal)
QModelIndex createIndex(int row, int column, const void *data=nullptr) const
Creates a model index for the given row and column with the internal pointer ptr.
void columnsInserted(const QModelIndex &parent, int first, int last, QPrivateSignal)
This signal is emitted after columns have been inserted into the model.
void rowsRemoved(const QModelIndex &parent, int first, int last, QPrivateSignal)
This signal is emitted after rows have been removed from the model.
The QAbstractProxyModel class provides a base class for proxy item models that can do sorting,...
QModelIndex createSourceIndex(int row, int col, void *internalPtr) const
Equivalent to calling createIndex on the source model.
QAbstractItemModel * sourceModel
the source model of this proxy model.
virtual void setSourceModel(QAbstractItemModel *sourceModel)
Sets the given sourceModel to be processed by the proxy model.
void sourceRowsAboutToBeInserted(const QModelIndex &parent, int start, int end)
QList< QPersistentModelIndex > layoutChangePersistentIndexes
void sourceRowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest)
QModelIndexList proxyIndexes
void sourceColumnsRemoved(const QModelIndex &parent, int start, int end)
void sourceColumnsAboutToBeInserted(const QModelIndex &parent, int start, int end)
void sourceLayoutAboutToBeChanged(const QList< QPersistentModelIndex > &sourceParents, QAbstractItemModel::LayoutChangeHint hint)
void sourceColumnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest)
void sourceModelAboutToBeReset()
void sourceColumnsInserted(const QModelIndex &parent, int start, int end)
void sourceLayoutChanged(const QList< QPersistentModelIndex > &sourceParents, QAbstractItemModel::LayoutChangeHint hint)
void sourceRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
void sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last)
void sourceColumnsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
void sourceRowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest)
void sourceColumnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest)
void sourceRowsRemoved(const QModelIndex &parent, int start, int end)
void sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles)
void sourceRowsInserted(const QModelIndex &parent, int start, int end)
The QIdentityProxyModel class proxies its source model unmodified.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
\reimp
bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override
\reimp
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
\reimp
void setSourceModel(QAbstractItemModel *sourceModel) override
\reimp
bool moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild) override
\reimp
QItemSelection mapSelectionFromSource(const QItemSelection &selection) const override
\reimp
QItemSelection mapSelectionToSource(const QItemSelection &selection) const override
\reimp
bool insertColumns(int column, int count, const QModelIndex &parent=QModelIndex()) override
\reimp
bool removeColumns(int column, int count, const QModelIndex &parent=QModelIndex()) override
\reimp
QObject * parent() const
Returns a pointer to the parent object.
QModelIndex sibling(int row, int column, const QModelIndex &idx) const override
\reimp
int rowCount(const QModelIndex &parent=QModelIndex()) const override
\reimp
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
\reimp
bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
\reimp
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override
\reimp
bool isHandleSourceLayoutChanges() const
QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits=1, Qt::MatchFlags flags=Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const override
\reimp
QIdentityProxyModel(QObject *parent=nullptr)
Constructs an identity model with the given parent.
QModelIndex mapToSource(const QModelIndex &proxyIndex) const override
\reimp
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
\reimp
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
\reimp
~QIdentityProxyModel()
Destroys this identity model.
void setHandleSourceLayoutChanges(bool)
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
const_iterator constBegin() const noexcept
void reserve(qsizetype size)
void append(parameter_type t)
const_iterator constEnd() const noexcept
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
constexpr const QAbstractItemModel * model() const noexcept
Returns a pointer to the model containing the item that this index refers to.
constexpr bool isValid() const noexcept
Returns {true} if this model index is valid; otherwise returns {false}.
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
const_iterator constBegin() const noexcept
QSet< QString >::iterator it
Combined button and popup list for selecting options.
QList< QModelIndex > QModelIndexList
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLboolean GLboolean GLboolean b
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei void GLsizei void * column
GLdouble GLdouble GLdouble GLdouble q
GLenum GLenum GLsizei void * row
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
QSqlQueryModel * model
[16]
QItemSelection * selection
[0]