summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels/qsortfilterproxymodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/itemmodels/qsortfilterproxymodel.cpp')
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
index 0b2b0e4188..7af95fe625 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
@@ -195,7 +195,8 @@ public:
}
void _q_sourceDataChanged(const QModelIndex &source_top_left,
- const QModelIndex &source_bottom_right);
+ const QModelIndex &source_bottom_right,
+ const QVector<int> &roles);
void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int start, int end);
void _q_sourceAboutToBeReset();
@@ -279,7 +280,7 @@ public:
void updateChildrenMapping(const QModelIndex &source_parent, Mapping *parent_mapping,
Qt::Orientation orient, int start, int end, int delta_item_count, bool remove);
- virtual void _q_sourceModelDestroyed();
+ virtual void _q_sourceModelDestroyed() Q_DECL_OVERRIDE;
};
typedef QHash<QModelIndex, QSortFilterProxyModelPrivate::Mapping *> IndexMap;
@@ -1131,7 +1132,8 @@ QSet<int> QSortFilterProxyModelPrivate::handle_filter_changed(
}
void QSortFilterProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &source_top_left,
- const QModelIndex &source_bottom_right)
+ const QModelIndex &source_bottom_right,
+ const QVector<int> &roles)
{
Q_Q(QSortFilterProxyModel);
if (!source_top_left.isValid() || !source_bottom_right.isValid())
@@ -1196,7 +1198,11 @@ void QSortFilterProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &sourc
parents << q->mapFromSource(source_parent);
emit q->layoutAboutToBeChanged(parents, QAbstractItemModel::VerticalSortHint);
QModelIndexPairList source_indexes = store_persistent_indexes();
- sort_source_rows(m->source_rows, source_parent);
+ remove_source_items(m->proxy_rows, m->source_rows, source_rows_resort,
+ source_parent, Qt::Vertical, false);
+ sort_source_rows(source_rows_resort, source_parent);
+ 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, QAbstractItemModel::VerticalSortHint);
// Make sure we also emit dataChanged for the rows
@@ -1224,7 +1230,7 @@ void QSortFilterProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &sourc
--source_right_column;
const QModelIndex proxy_bottom_right = create_index(
proxy_end_row, m->proxy_columns.at(source_right_column), it);
- emit q->dataChanged(proxy_top_left, proxy_bottom_right);
+ emit q->dataChanged(proxy_top_left, proxy_bottom_right, roles);
}
}
@@ -1728,8 +1734,8 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
beginResetModel();
- disconnect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex)));
+ disconnect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)),
+ this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QVector<int>)));
disconnect(d->model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
this, SLOT(_q_sourceHeaderDataChanged(Qt::Orientation,int,int)));
@@ -1781,8 +1787,8 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
QAbstractProxyModel::setSourceModel(sourceModel);
- connect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex)));
+ connect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)),
+ this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QVector<int>)));
connect(d->model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
this, SLOT(_q_sourceHeaderDataChanged(Qt::Orientation,int,int)));
@@ -2740,11 +2746,6 @@ QItemSelection QSortFilterProxyModel::mapSelectionFromSource(const QItemSelectio
return QAbstractProxyModel::mapSelectionFromSource(sourceSelection);
}
-/*!
- \fn QObject *QSortFilterProxyModel::parent() const
- \internal
-*/
-
QT_END_NAMESPACE
#include "moc_qsortfilterproxymodel.cpp"