5#include <private/qtransposeproxymodel_p.h>
6#include <QtCore/qlist.h>
7#include <QtCore/qmetaobject.h>
8#include <QtCore/qsize.h>
9#include <QtCore/qmap.h>
32 Q_ASSERT(layoutChangeProxyIndexes.
size() == layoutChangePersistentIndexes.
size());
36 toList <<
q->mapFromSource(persistIdx);
37 q->changePersistentIndexList(layoutChangeProxyIndexes,
toList);
38 layoutChangeProxyIndexes.
clear();
39 layoutChangePersistentIndexes.
clear();
43 proxyParents <<
q->mapFromSource(srcParent);
49 emit q->layoutChanged(proxyParents, proxyHint);
64 proxyParents << mappedParent;
71 emit q->layoutAboutToBeChanged(proxyParents, proxyHint);
73 layoutChangeProxyIndexes.
clear();
74 layoutChangePersistentIndexes.
clear();
75 layoutChangeProxyIndexes.
reserve(proxyPersistentIndexes.
size());
76 layoutChangePersistentIndexes.
reserve(proxyPersistentIndexes.
size());
77 for (
const QModelIndex &proxyPersistentIndex : proxyPersistentIndexes) {
78 layoutChangeProxyIndexes << proxyPersistentIndex;
79 Q_ASSERT(proxyPersistentIndex.isValid());
82 layoutChangePersistentIndexes << srcPersistentIndex;
90 emit q->dataChanged(
q->mapFromSource(topLeft),
q->mapFromSource(bottomRight), roles);
93void QTransposeProxyModelPrivate::onHeaderDataChanged(
Qt::Orientation orientation,
int first,
int last)
99void QTransposeProxyModelPrivate::onColumnsAboutToBeInserted(
const QModelIndex &
parent,
int first,
int last)
105void QTransposeProxyModelPrivate::onColumnsAboutToBeRemoved(
const QModelIndex &
parent,
int first,
int last)
111void QTransposeProxyModelPrivate::onColumnsAboutToBeMoved(
const QModelIndex &sourceParent,
int sourceStart,
int sourceEnd,
const QModelIndex &destinationParent,
int destinationColumn)
114 q->beginMoveRows(
q->mapFromSource(sourceParent), sourceStart, sourceEnd,
q->mapFromSource(destinationParent), destinationColumn);
120 q->beginInsertColumns(
q->mapFromSource(
parent),
first, last);
126 q->beginRemoveColumns(
q->mapFromSource(
parent),
first, last);
129void QTransposeProxyModelPrivate::onRowsAboutToBeMoved(
const QModelIndex &sourceParent,
int sourceStart,
int sourceEnd,
const QModelIndex &destinationParent,
int destinationRow)
132 q->beginMoveColumns(
q->mapFromSource(sourceParent), sourceStart, sourceEnd,
q->mapFromSource(destinationParent), destinationRow);
171 if (newSourceModel ==
d->model)
178 d->sourceConnections.clear();
181 using namespace std::placeholders;
188 connect(
d->model, &
QAbstractItemModel::columnsAboutToBeMoved,
this, std::bind(&QTransposeProxyModelPrivate::onColumnsAboutToBeMoved,
d, _1, _2, _3, _4, _5)),
194 connect(
d->model, &
QAbstractItemModel::rowsAboutToBeMoved,
this, std::bind(&QTransposeProxyModelPrivate::onRowsAboutToBeMoved,
d, _1, _2, _3, _4, _5)),
259 if (!
d->model || !
index.isValid())
271 if (!
d->model || !
index.isValid())
294 if (!
d->model || !sourceIndex.
isValid())
296 Q_ASSERT(
d->model->checkIndex(sourceIndex));
297 return d->uncheckedMapFromSource(sourceIndex);
307 if (!
d->model || !proxyIndex.
isValid())
309 return d->uncheckedMapToSource(proxyIndex);
319 if (!
d->model || !
index.isValid())
321 return d->uncheckedMapFromSource(
d->uncheckedMapToSource(
index).parent());
423#include "moc_qtransposeproxymodel.cpp"
void rowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow, QPrivateSignal)
Q_INVOKABLE int const QModelIndex & parent
Returns the parent of the model item with the given index.
void endResetModel()
Completes a model reset operation.
void modelAboutToBeReset(QPrivateSignal)
void endMoveColumns()
Ends a column move operation.
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)
void endRemoveRows()
Ends a row removal operation.
void endMoveRows()
Ends a row move operation.
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)
bool checkIndex(const QModelIndex &index, CheckIndexOptions options=CheckIndexOption::NoOption) const
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 endInsertRows()
Ends a row insertion operation.
void beginResetModel()
Begins a model reset operation.
void endRemoveColumns()
Ends a column removal 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.
void columnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn, QPrivateSignal)
void endInsertColumns()
Ends a column insertion operation.
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,...
virtual void setSourceModel(QAbstractItemModel *sourceModel)
Sets the given sourceModel to be processed by the proxy model.
qsizetype size() const noexcept
void reserve(qsizetype size)
constexpr int row() const noexcept
Returns the row this model index refers to.
constexpr int column() const noexcept
Returns the column this model index refers to.
void * internalPointer() const noexcept
Returns a {void} {*} pointer used by the model to associate the index with the internal data structur...
constexpr bool isValid() const noexcept
Returns {true} if this model index is valid; otherwise returns {false}.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
bool isValid() const
Returns {true} if this persistent model index is valid; otherwise returns {false}.
This proxy transposes the source model.
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role=Qt::EditRole) override
\reimp
bool moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild) override
\reimp
~QTransposeProxyModel()
Destructs the proxy model.
QMap< int, QVariant > itemData(const QModelIndex &index) const override
\reimp
QSize span(const QModelIndex &index) const override
\reimp
QModelIndex mapToSource(const QModelIndex &proxyIndex) const override
\reimp
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
\reimp
bool removeColumns(int column, int count, const QModelIndex &parent=QModelIndex()) override
\reimp
bool insertColumns(int column, int count, const QModelIndex &parent=QModelIndex()) override
\reimp
void sort(int column, Qt::SortOrder order=Qt::AscendingOrder) override
\reimp This method will perform no action.
QTransposeProxyModel(QObject *parent=nullptr)
Constructs a new proxy model with the given parent.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
\reimp
bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
\reimp
void setSourceModel(QAbstractItemModel *newSourceModel) override
\reimp
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override
\reimp
bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override
\reimp
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
\reimp
bool setItemData(const QModelIndex &index, const QMap< int, QVariant > &roles) override
\reimp
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
\reimp
int columnCount(const QModelIndex &parent=QModelIndex()) const override
\reimp
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum GLenum GLsizei count
GLenum GLenum GLsizei void GLsizei void * column
GLdouble GLdouble GLdouble GLdouble q
GLenum GLenum GLsizei void * row
GLfixed GLfixed GLint GLint order
static QList< QVariant > toList(char **buf, int count)
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
QSqlQueryModel * model
[16]
myObject disconnect()
[26]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent