Filter: remove unused parameters from doFilter functions

Change the signature from of the virtual doFilter() functions from
 bool doFilter(struct dive *d, QModelIndex&, QAbstractItemModel*) const;
to
 bool LocationFilterModel::doFilter(struct dive *d) const;
as the QModelIndex and QAbstractItemModel parameters were not used.

This makes this functions independent from Qt's model/view
framework. This is in preparation for making the undo-machinery
compatible with the filtering.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-08-14 13:03:33 -04:00
parent 612f1b478f
commit fb47c15cd8
2 changed files with 10 additions and 10 deletions

View file

@ -132,7 +132,7 @@ int SuitsFilterModel::countDives(const char *s) const
return count_dives_with_suit(s);
}
bool SuitsFilterModel::doFilter(dive *d, QModelIndex&, QAbstractItemModel*) const
bool SuitsFilterModel::doFilter(dive *d) const
{
// rowCount() == 0 should never happen, because we have the "no suits" row
// let's handle it gracefully anyway.
@ -196,7 +196,7 @@ void TagFilterModel::repopulate()
updateList(list);
}
bool TagFilterModel::doFilter(dive *d, QModelIndex&, QAbstractItemModel*) const
bool TagFilterModel::doFilter(dive *d) const
{
// If there's nothing checked, this should show everything
// rowCount() == 0 should never happen, because we have the "no tags" row
@ -234,7 +234,7 @@ int BuddyFilterModel::countDives(const char *s) const
return count_dives_with_person(s);
}
bool BuddyFilterModel::doFilter(dive *d, QModelIndex&, QAbstractItemModel*) const
bool BuddyFilterModel::doFilter(dive *d) const
{
// If there's nothing checked, this should show everything
// rowCount() == 0 should never happen, because we have the "no tags" row
@ -289,7 +289,7 @@ int LocationFilterModel::countDives(const char *s) const
return count_dives_with_location(s);
}
bool LocationFilterModel::doFilter(struct dive *d, QModelIndex&, QAbstractItemModel*) const
bool LocationFilterModel::doFilter(struct dive *d) const
{
// rowCount() == 0 should never happen, because we have the "no location" row
// let's handle it gracefully anyway.
@ -412,7 +412,7 @@ bool MultiFilterSortModel::filterAcceptsRow(int source_row, const QModelIndex &s
return showTrip;
}
Q_FOREACH (FilterModelBase *model, models) {
if (!model->doFilter(d, index0, sourceModel()))
if (!model->doFilter(d))
shouldShow = false;
}

View file

@ -10,7 +10,7 @@
class FilterModelBase : public QStringListModel {
Q_OBJECT
public:
virtual bool doFilter(struct dive *d, QModelIndex &index0, QAbstractItemModel *sourceModel) const = 0;
virtual bool doFilter(struct dive *d) const = 0;
void clearFilter();
void selectAll();
void invertSelection();
@ -34,7 +34,7 @@ class TagFilterModel : public FilterModelBase {
Q_OBJECT
public:
static TagFilterModel *instance();
bool doFilter(struct dive *d, QModelIndex &index0, QAbstractItemModel *sourceModel) const;
bool doFilter(struct dive *d) const;
public
slots:
void repopulate();
@ -48,7 +48,7 @@ class BuddyFilterModel : public FilterModelBase {
Q_OBJECT
public:
static BuddyFilterModel *instance();
bool doFilter(struct dive *d, QModelIndex &index0, QAbstractItemModel *sourceModel) const;
bool doFilter(struct dive *d) const;
public
slots:
void repopulate();
@ -62,7 +62,7 @@ class LocationFilterModel : public FilterModelBase {
Q_OBJECT
public:
static LocationFilterModel *instance();
bool doFilter(struct dive *d, QModelIndex &index0, QAbstractItemModel *sourceModel) const;
bool doFilter(struct dive *d) const;
public
slots:
void repopulate();
@ -78,7 +78,7 @@ class SuitsFilterModel : public FilterModelBase {
Q_OBJECT
public:
static SuitsFilterModel *instance();
bool doFilter(struct dive *d, QModelIndex &index0, QAbstractItemModel *sourceModel) const;
bool doFilter(struct dive *d) const;
public
slots:
void repopulate();