Skip to content

Commit

Permalink
QSortFilterProxyModel: improve formal argument naming for lessThan
Browse files Browse the repository at this point in the history
Make it clear (just like the other methods) that the indexes refer
to the source model, not the proxy model. There was already a note
in the documentation, but it was at the end of it; instead, change
the formal arguments names.

Change-Id: Ia9592f2b080ff276a62de1713a9623e0f3a50cf6
Reviewed-by: Tobias Koenig
Reviewed-by: Sérgio Martins <[email protected]>
Reviewed-by: David Faure <[email protected]>
  • Loading branch information
dangelog committed May 1, 2015
1 parent 985e7d8 commit 70b085c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/corelib/itemmodels/qsortfilterproxymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2577,8 +2577,8 @@ void QSortFilterProxyModel::invalidateFilter()

/*!
Returns \c true if the value of the item referred to by the given
index \a left is less than the value of the item referred to by
the given index \a right, otherwise returns \c false.
index \a source_left is less than the value of the item referred to by
the given index \a source_right, otherwise returns \c false.
This function is used as the < operator when sorting, and handles
the following QVariant types:
Expand Down Expand Up @@ -2612,11 +2612,11 @@ void QSortFilterProxyModel::invalidateFilter()
\sa sortRole, sortCaseSensitivity, dynamicSortFilter
*/
bool QSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
bool QSortFilterProxyModel::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const
{
Q_D(const QSortFilterProxyModel);
QVariant l = (left.model() ? left.model()->data(left, d->sort_role) : QVariant());
QVariant r = (right.model() ? right.model()->data(right, d->sort_role) : QVariant());
QVariant l = (source_left.model() ? source_left.model()->data(source_left, d->sort_role) : QVariant());
QVariant r = (source_right.model() ? source_right.model()->data(source_right, d->sort_role) : QVariant());
switch (l.userType()) {
case QVariant::Invalid:
return (r.type() != QVariant::Invalid);
Expand Down
2 changes: 1 addition & 1 deletion src/corelib/itemmodels/qsortfilterproxymodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public Q_SLOTS:
protected:
virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
virtual bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const;
virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
virtual bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const;

void filterChanged();
void invalidateFilter();
Expand Down

0 comments on commit 70b085c

Please sign in to comment.