mirror of https://github.com/qt/qtbase.git
Remove the backwards compatibility signal emissions when moving items.
Change-Id: I29a44835d3397c1dbf37026daf0c5234dae770e0 Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
parent
5cb05091d2
commit
8021e2d5e7
|
@ -116,6 +116,11 @@ QtCore
|
|||
* drop a bogus QChar::NoCategory enum value; the proper QChar::Other_NotAssigned
|
||||
value is returned for an unassigned codepoints now.
|
||||
|
||||
* layoutAboutToBeChanged is no longer emitted by QAbstractItemModel::beginMoveRows.
|
||||
layoutChanged is no longer emitted by QAbstractItemModel::endMoveRows. Proxy models
|
||||
should now also connect to (and disconnect from) the rowsAboutToBeMoved and
|
||||
rowsMoved signals.
|
||||
|
||||
QtGui
|
||||
-----
|
||||
* Accessibility has been refactored. The hierachy of accessible objects is implemented via
|
||||
|
|
|
@ -2522,8 +2522,6 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star
|
|||
required to do yourself. Using beginMoveRows and endMoveRows
|
||||
is an alternative to emitting layoutAboutToBeChanged and
|
||||
layoutChanged directly along with changePersistentIndexes.
|
||||
layoutAboutToBeChanged is emitted by this method for compatibility
|
||||
reasons.
|
||||
|
||||
The \a sourceParent index corresponds to the parent from which the
|
||||
rows are moved; \a sourceFirst and \a sourceLast are the first and last
|
||||
|
@ -2623,7 +2621,6 @@ bool QAbstractItemModel::beginMoveRows(const QModelIndex &sourceParent, int sour
|
|||
d->changes.push(destinationChange);
|
||||
|
||||
emit rowsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild);
|
||||
emit layoutAboutToBeChanged();
|
||||
d->itemsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Vertical);
|
||||
return true;
|
||||
}
|
||||
|
@ -2635,8 +2632,6 @@ bool QAbstractItemModel::beginMoveRows(const QModelIndex &sourceParent, int sour
|
|||
function \e after moving data within the model's underlying data
|
||||
store.
|
||||
|
||||
layoutChanged is emitted by this method for compatibility reasons.
|
||||
|
||||
\sa beginMoveRows()
|
||||
|
||||
\since 4.6
|
||||
|
@ -2661,7 +2656,6 @@ void QAbstractItemModel::endMoveRows()
|
|||
d->itemsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first, Qt::Vertical);
|
||||
|
||||
emit rowsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first);
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -2795,8 +2789,6 @@ void QAbstractItemModel::endRemoveColumns()
|
|||
required to do yourself. Using beginMoveRows and endMoveRows
|
||||
is an alternative to emitting layoutAboutToBeChanged and
|
||||
layoutChanged directly along with changePersistentIndexes.
|
||||
layoutAboutToBeChanged is emitted by this method for compatibility
|
||||
reasons.
|
||||
|
||||
The \a sourceParent index corresponds to the parent from which the
|
||||
columns are moved; \a sourceFirst and \a sourceLast are the first and last
|
||||
|
@ -2848,7 +2840,6 @@ bool QAbstractItemModel::beginMoveColumns(const QModelIndex &sourceParent, int s
|
|||
d->itemsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Horizontal);
|
||||
|
||||
emit columnsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild);
|
||||
emit layoutAboutToBeChanged();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2859,8 +2850,6 @@ bool QAbstractItemModel::beginMoveColumns(const QModelIndex &sourceParent, int s
|
|||
function \e after moving data within the model's underlying data
|
||||
store.
|
||||
|
||||
layoutChanged is emitted by this method for compatibility reasons.
|
||||
|
||||
\sa beginMoveColumns()
|
||||
|
||||
\since 4.6
|
||||
|
@ -2885,7 +2874,6 @@ void QAbstractItemModel::endMoveColumns()
|
|||
d->itemsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first, Qt::Horizontal);
|
||||
|
||||
emit columnsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first);
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
@ -3499,6 +3499,16 @@ void QAbstractItemViewPrivate::_q_layoutChanged()
|
|||
#endif
|
||||
}
|
||||
|
||||
void QAbstractItemViewPrivate::_q_rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)
|
||||
{
|
||||
_q_layoutChanged();
|
||||
}
|
||||
|
||||
void QAbstractItemViewPrivate::_q_columnsMoved(const QModelIndex &, int, int, const QModelIndex &, int)
|
||||
{
|
||||
_q_layoutChanged();
|
||||
}
|
||||
|
||||
/*!
|
||||
This slot is called when the selection is changed. The previous
|
||||
selection (which may be empty), is specified by \a deselected, and the
|
||||
|
|
|
@ -357,6 +357,8 @@ private:
|
|||
Q_PRIVATE_SLOT(d_func(), void _q_columnsInserted(const QModelIndex&, int, int))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_rowsInserted(const QModelIndex&, int, int))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_rowsRemoved(const QModelIndex&, int, int))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_columnsMoved(const QModelIndex&, int, int, const QModelIndex&, int))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_rowsMoved(const QModelIndex&, int, int, const QModelIndex&, int))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_modelDestroyed())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_headerDataChanged())
|
||||
|
|
|
@ -114,6 +114,9 @@ public:
|
|||
virtual void _q_columnsInserted(const QModelIndex &parent, int start, int end);
|
||||
virtual void _q_modelDestroyed();
|
||||
virtual void _q_layoutChanged();
|
||||
virtual void _q_rowsMoved(const QModelIndex &source, int sourceStart, int sourceEnd, const QModelIndex &destination, int destinationStart);
|
||||
virtual void _q_columnsMoved(const QModelIndex &source, int sourceStart, int sourceEnd, const QModelIndex &destination, int destinationStart);
|
||||
|
||||
void _q_headerDataChanged() { doDelayedItemsLayout(); }
|
||||
void _q_scrollerStateChanged();
|
||||
|
||||
|
|
|
@ -51,16 +51,12 @@ QT_BEGIN_NAMESPACE
|
|||
class QIdentityProxyModelPrivate : public QAbstractProxyModelPrivate
|
||||
{
|
||||
QIdentityProxyModelPrivate()
|
||||
: ignoreNextLayoutAboutToBeChanged(false),
|
||||
ignoreNextLayoutChanged(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_PUBLIC(QIdentityProxyModel)
|
||||
|
||||
bool ignoreNextLayoutAboutToBeChanged;
|
||||
bool ignoreNextLayoutChanged;
|
||||
QList<QPersistentModelIndex> layoutChangePersistentIndexes;
|
||||
QModelIndexList proxyIndexes;
|
||||
|
||||
|
@ -481,9 +477,6 @@ void QIdentityProxyModelPrivate::_q_sourceHeaderDataChanged(Qt::Orientation orie
|
|||
|
||||
void QIdentityProxyModelPrivate::_q_sourceLayoutAboutToBeChanged()
|
||||
{
|
||||
if (ignoreNextLayoutAboutToBeChanged)
|
||||
return;
|
||||
|
||||
Q_Q(QIdentityProxyModel);
|
||||
|
||||
foreach(const QPersistentModelIndex &proxyPersistentIndex, q->persistentIndexList()) {
|
||||
|
@ -499,9 +492,6 @@ void QIdentityProxyModelPrivate::_q_sourceLayoutAboutToBeChanged()
|
|||
|
||||
void QIdentityProxyModelPrivate::_q_sourceLayoutChanged()
|
||||
{
|
||||
if (ignoreNextLayoutChanged)
|
||||
return;
|
||||
|
||||
Q_Q(QIdentityProxyModel);
|
||||
|
||||
for (int i = 0; i < proxyIndexes.size(); ++i) {
|
||||
|
|
|
@ -565,6 +565,14 @@ void QItemSelectionModelPrivate::initModel(QAbstractItemModel *model)
|
|||
q, SLOT(_q_rowsAboutToBeInserted(QModelIndex,int,int)));
|
||||
QObject::connect(model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),
|
||||
q, SLOT(_q_columnsAboutToBeInserted(QModelIndex,int,int)));
|
||||
QObject::connect(model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
|
||||
q, SLOT(_q_layoutAboutToBeChanged()));
|
||||
QObject::connect(model, SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
|
||||
q, SLOT(_q_layoutAboutToBeChanged()));
|
||||
QObject::connect(model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
|
||||
q, SLOT(_q_layoutChanged()));
|
||||
QObject::connect(model, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)),
|
||||
q, SLOT(_q_layoutChanged()));
|
||||
QObject::connect(model, SIGNAL(layoutAboutToBeChanged()),
|
||||
q, SLOT(_q_layoutAboutToBeChanged()));
|
||||
QObject::connect(model, SIGNAL(layoutChanged()),
|
||||
|
|
|
@ -1582,6 +1582,18 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
|
|||
disconnect(d->model, SIGNAL(layoutChanged()),
|
||||
this, SLOT(_q_sourceLayoutChanged()));
|
||||
|
||||
disconnect(d->model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
|
||||
this, SLOT(_q_sourceLayoutAboutToBeChanged()));
|
||||
|
||||
disconnect(d->model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
|
||||
this, SLOT(_q_sourceLayoutChanged()));
|
||||
|
||||
disconnect(d->model, SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
|
||||
this, SLOT(_q_sourceLayoutAboutToBeChanged()));
|
||||
|
||||
disconnect(d->model, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)),
|
||||
this, SLOT(_q_sourceLayoutChanged()));
|
||||
|
||||
disconnect(d->model, SIGNAL(modelAboutToBeReset()), this, SLOT(_q_sourceAboutToBeReset()));
|
||||
disconnect(d->model, SIGNAL(modelReset()), this, SLOT(_q_sourceReset()));
|
||||
|
||||
|
@ -1623,6 +1635,18 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
|
|||
connect(d->model, SIGNAL(layoutChanged()),
|
||||
this, SLOT(_q_sourceLayoutChanged()));
|
||||
|
||||
connect(d->model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
|
||||
this, SLOT(_q_sourceLayoutAboutToBeChanged()));
|
||||
|
||||
connect(d->model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
|
||||
this, SLOT(_q_sourceLayoutChanged()));
|
||||
|
||||
connect(d->model, SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
|
||||
this, SLOT(_q_sourceLayoutAboutToBeChanged()));
|
||||
|
||||
connect(d->model, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)),
|
||||
this, SLOT(_q_sourceLayoutChanged()));
|
||||
|
||||
connect(d->model, SIGNAL(modelAboutToBeReset()), this, SLOT(_q_sourceAboutToBeReset()));
|
||||
connect(d->model, SIGNAL(modelReset()), this, SLOT(_q_sourceReset()));
|
||||
|
||||
|
|
Loading…
Reference in New Issue