summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2012-09-27 11:12:15 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-02 10:43:48 +0200
commit8b41a29b2d90757d1efa168b342bc84c748adf46 (patch)
treebf2c51e25f4df6b8912d2c7cff1dc927a633f3a6 /src/corelib/itemmodels
parent12590582a2f6769126906aab710a8401409a4b4a (diff)
Forward the layout change hint through QSortFilterProxyModel.
Change-Id: Ic9ae7f011f63c4a53fec4d9425ac6cd6776153ee Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/corelib/itemmodels')
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.cpp36
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.h4
2 files changed, 20 insertions, 20 deletions
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
index 042c6ce7c2..8551db0c28 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
@@ -207,8 +207,8 @@ public:
void _q_sourceAboutToBeReset();
void _q_sourceReset();
- void _q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents);
- void _q_sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents);
+ void _q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint);
+ void _q_sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint);
void _q_sourceRowsAboutToBeInserted(const QModelIndex &source_parent,
int start, int end);
@@ -434,7 +434,7 @@ bool QSortFilterProxyModelPrivate::can_create_mapping(const QModelIndex &source_
void QSortFilterProxyModelPrivate::sort()
{
Q_Q(QSortFilterProxyModel);
- emit q->layoutAboutToBeChanged();
+ emit q->layoutAboutToBeChanged(QList<QPersistentModelIndex>(), QAbstractItemModel::VerticalSortHint);
QModelIndexPairList source_indexes = store_persistent_indexes();
IndexMap::const_iterator it = source_index_mapping.constBegin();
for (; it != source_index_mapping.constEnd(); ++it) {
@@ -444,7 +444,7 @@ void QSortFilterProxyModelPrivate::sort()
build_source_to_proxy_mapping(m->source_rows, m->proxy_rows);
}
update_persistent_indexes(source_indexes);
- emit q->layoutChanged();
+ emit q->layoutChanged(QList<QPersistentModelIndex>(), QAbstractItemModel::VerticalSortHint);
}
/*!
@@ -1188,7 +1188,7 @@ void QSortFilterProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &sourc
// Re-sort the rows of this level
QList<QPersistentModelIndex> parents;
parents << q->mapFromSource(source_parent);
- emit q->layoutAboutToBeChanged(parents);
+ emit q->layoutAboutToBeChanged(parents, QAbstractItemModel::VerticalSortHint);
QModelIndexPairList source_indexes = store_persistent_indexes();
remove_source_items(m->proxy_rows, m->source_rows, source_rows_resort,
source_parent, Qt::Vertical, false);
@@ -1196,7 +1196,7 @@ void QSortFilterProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &sourc
insert_source_items(m->proxy_rows, m->source_rows, source_rows_resort,
source_parent, Qt::Vertical, false);
update_persistent_indexes(source_indexes);
- emit q->layoutChanged(parents);
+ emit q->layoutChanged(parents, QAbstractItemModel::VerticalSortHint);
// Make sure we also emit dataChanged for the rows
source_rows_change += source_rows_resort;
}
@@ -1293,7 +1293,7 @@ void QSortFilterProxyModelPrivate::_q_sourceReset()
sort();
}
-void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents)
+void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint)
{
Q_Q(QSortFilterProxyModel);
saved_persistent_indexes.clear();
@@ -1314,14 +1314,14 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<Q
if (!sourceParents.isEmpty() && parents.isEmpty())
return;
- emit q->layoutAboutToBeChanged(parents);
+ emit q->layoutAboutToBeChanged(parents, hint);
if (persistent.indexes.isEmpty())
return;
saved_persistent_indexes = store_persistent_indexes();
}
-void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents)
+void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint)
{
Q_Q(QSortFilterProxyModel);
@@ -1353,7 +1353,7 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersisten
if (!sourceParents.isEmpty() && parents.isEmpty())
return;
- emit q->layoutChanged(parents);
+ emit q->layoutChanged(parents, hint);
}
void QSortFilterProxyModelPrivate::_q_sourceRowsAboutToBeInserted(
@@ -1768,11 +1768,11 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
disconnect(d->model, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)),
this, SLOT(_q_sourceColumnsMoved(QModelIndex,int,int,QModelIndex,int)));
- disconnect(d->model, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)),
- this, SLOT(_q_sourceLayoutAboutToBeChanged(QList<QPersistentModelIndex>)));
+ disconnect(d->model, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),
+ this, SLOT(_q_sourceLayoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)));
- disconnect(d->model, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)),
- this, SLOT(_q_sourceLayoutChanged(QList<QPersistentModelIndex>)));
+ disconnect(d->model, SIGNAL(layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),
+ this, SLOT(_q_sourceLayoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)));
disconnect(d->model, SIGNAL(modelAboutToBeReset()), this, SLOT(_q_sourceAboutToBeReset()));
disconnect(d->model, SIGNAL(modelReset()), this, SLOT(_q_sourceReset()));
@@ -1821,11 +1821,11 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
connect(d->model, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)),
this, SLOT(_q_sourceColumnsMoved(QModelIndex,int,int,QModelIndex,int)));
- connect(d->model, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)),
- this, SLOT(_q_sourceLayoutAboutToBeChanged(QList<QPersistentModelIndex>)));
+ connect(d->model, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),
+ this, SLOT(_q_sourceLayoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)));
- connect(d->model, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)),
- this, SLOT(_q_sourceLayoutChanged(QList<QPersistentModelIndex>)));
+ connect(d->model, SIGNAL(layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),
+ this, SLOT(_q_sourceLayoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)));
connect(d->model, SIGNAL(modelAboutToBeReset()), this, SLOT(_q_sourceAboutToBeReset()));
connect(d->model, SIGNAL(modelReset()), this, SLOT(_q_sourceReset()));
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.h b/src/corelib/itemmodels/qsortfilterproxymodel.h
index 855e145dee..905c401886 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.h
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.h
@@ -178,8 +178,8 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int start, int end))
Q_PRIVATE_SLOT(d_func(), void _q_sourceAboutToBeReset())
Q_PRIVATE_SLOT(d_func(), void _q_sourceReset())
- Q_PRIVATE_SLOT(d_func(), void _q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents))
- Q_PRIVATE_SLOT(d_func(), void _q_sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents))
+ Q_PRIVATE_SLOT(d_func(), void _q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint))
+ Q_PRIVATE_SLOT(d_func(), void _q_sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint))
Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsAboutToBeInserted(const QModelIndex &source_parent, int start, int end))
Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsInserted(const QModelIndex &source_parent, int start, int end))
Q_PRIVATE_SLOT(d_func(), void _q_sourceRowsAboutToBeRemoved(const QModelIndex &source_parent, int start, int end))