6#include <private/qabstractproxymodel_p.h>
8#include <QtCore/QStringList>
52void QAbstractProxyModelPrivate::_q_sourceModelDestroyed()
63 if (
auto columnCount =
q->columnCount(); columnCount > 0)
68 if (
auto rowCount =
q->rowCount(); rowCount > 0)
87 if (!isUpdateScheduled) {
177 d->model.removeBindingUnlessInWrapper();
183 static const struct {
184 const char *signalName;
185 const char *slotName;
186 } connectionTable[] = {
200 for (
const auto &
c : connectionTable)
201 disconnect(currentModel,
c.signalName,
this,
c.slotName);
206 for (
const auto &
c : connectionTable)
229 return QBindable<QAbstractItemModel *>(&
d->model);
238 return d->model->submit();
278 for (
int i = 0;
i < proxyIndexes.
size(); ++
i) {
280 if (!proxyIdx.isValid())
284 return sourceSelection;
296 for (
int i = 0;
i < sourceIndexes.size(); ++
i) {
298 if (!srcIdx.isValid())
302 return proxySelection;
320 int sourceSection = section;
332 return d->model->headerData(sourceSection, orientation, role);
385 return d->model->setHeaderData(sourceSection, orientation,
value, role);
470 return d->model->mimeData(
list);
474 int *sourceRow,
int *sourceColumn,
QModelIndex *sourceParent)
const
480 *sourceParent =
q->mapToSource(
parent);
482 *sourceParent =
q->mapToSource(
parent);
487 *sourceRow = sourceIndex.
row();
488 *sourceColumn = sourceIndex.column();
489 *sourceParent = sourceIndex.parent();
501 int sourceDestinationRow;
502 int sourceDestinationColumn;
504 d->mapDropCoordinatesToSource(
row,
column,
parent, &sourceDestinationRow, &sourceDestinationColumn, &sourceParent);
505 return d->
model->canDropMimeData(
data, action, sourceDestinationRow, sourceDestinationColumn, sourceParent);
516 int sourceDestinationRow;
517 int sourceDestinationColumn;
519 d->mapDropCoordinatesToSource(
row,
column,
parent, &sourceDestinationRow, &sourceDestinationColumn, &sourceParent);
520 return d->
model->dropMimeData(
data, action, sourceDestinationRow, sourceDestinationColumn, sourceParent);
529 return d->model->mimeTypes();
538 return d->model->supportedDragActions();
547 return d->model->supportedDropActions();
556 return d->model->roleNames();
582#include "moc_qabstractproxymodel.cpp"
void invalidatePersistentIndexes()
static QAbstractItemModel * staticEmptyModel()
Q_INVOKABLE int const QModelIndex & parent
Returns the parent of the model item with the given index.
void columnsRemoved(const QModelIndex &parent, int first, int last, QPrivateSignal)
This signal is emitted after columns have been removed from the model.
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.
virtual Q_INVOKABLE int rowCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of rows under the given parent.
virtual Q_INVOKABLE int columnCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of columns for the children of the given parent.
void rowsInserted(const QModelIndex &parent, int first, int last, QPrivateSignal)
This signal is emitted after rows have been inserted into the model.
friend class QAbstractProxyModel
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.
void _q_sourceModelColumnsAboutToBeInserted(const QModelIndex &parent, int first, int last)
void _q_sourceModelColumnsRemoved(const QModelIndex &parent, int first, int last)
unsigned int updateHorizontalHeader
void _q_sourceModelRowsAboutToBeInserted(const QModelIndex &parent, int first, int last)
void mapDropCoordinatesToSource(int row, int column, const QModelIndex &parent, int *source_row, int *source_column, QModelIndex *source_parent) const
void scheduleHeaderUpdate(Qt::Orientation orientation)
void _q_sourceModelRowsRemoved(const QModelIndex &parent, int first, int last)
unsigned int sourceHadZeroColumns
unsigned int sourceHadZeroRows
unsigned int updateVerticalHeader
void emitHeaderDataChanged()
void _q_sourceModelColumnsInserted(const QModelIndex &parent, int first, int last)
void _q_sourceModelRowsInserted(const QModelIndex &parent, int first, int last)
The QAbstractProxyModel class provides a base class for proxy item models that can do sorting,...
QModelIndex buddy(const QModelIndex &index) const override
\reimp
void fetchMore(const QModelIndex &parent) override
\reimp
Qt::DropActions supportedDragActions() const override
\reimp
~QAbstractProxyModel()
Destroys the proxy model.
QSize span(const QModelIndex &index) const override
\reimp
QVariant data(const QModelIndex &proxyIndex, int role=Qt::DisplayRole) const override
\reimp
QModelIndex sibling(int row, int column, const QModelIndex &idx) const override
\reimp
QHash< int, QByteArray > roleNames() const override
\reimp
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
\reimp
virtual Q_INVOKABLE QItemSelection mapSelectionFromSource(const QItemSelection &selection) const
Returns a proxy selection mapped from the specified sourceSelection.
virtual Q_INVOKABLE QModelIndex mapToSource(const QModelIndex &proxyIndex) const =0
Reimplement this function to return the model index in the source model that corresponds to the proxy...
Qt::ItemFlags flags(const QModelIndex &index) const override
\reimp
virtual Q_INVOKABLE QModelIndex mapFromSource(const QModelIndex &sourceIndex) const =0
Reimplement this function to return the model index in the proxy model that corresponds to the source...
QModelIndex createSourceIndex(int row, int col, void *internalPtr) const
Equivalent to calling createIndex on the source model.
bool setItemData(const QModelIndex &index, const QMap< int, QVariant > &roles) override
\reimp
bool hasChildren(const QModelIndex &parent=QModelIndex()) const override
\reimp
bool canFetchMore(const QModelIndex &parent) const override
\reimp
QAbstractItemModel * sourceModel
the source model of this proxy model.
bool clearItemData(const QModelIndex &index) override
\reimp
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
\reimp
QMimeData * mimeData(const QModelIndexList &indexes) const override
\reimp
QMap< int, QVariant > itemData(const QModelIndex &index) const override
\reimp
void sort(int column, Qt::SortOrder order=Qt::AscendingOrder) override
\reimp
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
\reimp
bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override
\reimp
void revert() override
\reimp
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role=Qt::EditRole) override
\reimp
virtual Q_INVOKABLE QItemSelection mapSelectionToSource(const QItemSelection &selection) const
Returns a source selection mapped from the specified proxySelection.
Qt::DropActions supportedDropActions() const override
\reimp
virtual void setSourceModel(QAbstractItemModel *sourceModel)
Sets the given sourceModel to be processed by the proxy model.
QBindable< QAbstractItemModel * > bindableSourceModel()
QStringList mimeTypes() const override
\reimp
bool submit() override
\reimp
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
void reserve(qsizetype size)
constexpr int row() const noexcept
Returns the row this model index refers to.
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.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
int rowCount(const QModelIndex &parent=QModelIndex()) const override
If the database supports returning the size of a query (see QSqlDriver::hasFeature()),...
int columnCount(const QModelIndex &parent=QModelIndex()) const override
\reimp
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
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
GLfixed GLfixed GLint GLint order
QSqlQueryModel * model
[16]
myObject disconnect()
[26]