diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2014-10-31 15:27:33 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-10-31 13:52:51 -0700 |
commit | c68a94da6ade76a6ffe46c959c5b67446131aa72 (patch) | |
tree | fa0acd31531260076844e26ec97bad83b1753653 | |
parent | 19ac1dfa0983b98d9cc2680e9553020d1c936bb9 (diff) | |
download | subsurface-c68a94da6ade76a6ffe46c959c5b67446131aa72.tar.gz |
TagFilter -> MultiFilter
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/divelistview.cpp | 2 | ||||
-rw-r--r-- | qt-ui/models.cpp | 14 | ||||
-rw-r--r-- | qt-ui/models.h | 6 | ||||
-rw-r--r-- | qt-ui/simplewidgets.cpp | 4 |
4 files changed, 13 insertions, 13 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 6963958ac..98681197c 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -37,7 +37,7 @@ DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelec setItemDelegate(new DiveListDelegate(this)); setUniformRowHeights(true); setItemDelegateForColumn(DiveTripModel::RATING, new StarWidgetsDelegate(this)); - TagFilterSortModel *model = TagFilterSortModel::instance(); + MultiFilterSortModel *model = MultiFilterSortModel::instance(); model->setSortRole(DiveTripModel::SORT_ROLE); model->setFilterKeyColumn(-1); // filter all columns model->setFilterCaseSensitivity(Qt::CaseInsensitive); diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index 4b86605d3..e4df20504 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -2351,17 +2351,17 @@ bool TagFilterModel::filterRow(int source_row, const QModelIndex &source_parent, return false; } -TagFilterSortModel *TagFilterSortModel::instance() +MultiFilterSortModel *MultiFilterSortModel::instance() { - static TagFilterSortModel *self = new TagFilterSortModel(); + static MultiFilterSortModel *self = new MultiFilterSortModel(); return self; } -TagFilterSortModel::TagFilterSortModel(QObject *parent) : QSortFilterProxyModel(parent) +MultiFilterSortModel::MultiFilterSortModel(QObject *parent) : QSortFilterProxyModel(parent) { } -bool TagFilterSortModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const +bool MultiFilterSortModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { if (models.isEmpty()) { return true; @@ -2376,12 +2376,12 @@ bool TagFilterSortModel::filterAcceptsRow(int source_row, const QModelIndex &sou return false; } -void TagFilterSortModel::myInvalidate() +void MultiFilterSortModel::myInvalidate() { invalidate(); } -void TagFilterSortModel::addFilterModel(MultiFilterInterface *model) +void MultiFilterSortModel::addFilterModel(MultiFilterInterface *model) { QAbstractItemModel *itemModel = dynamic_cast<QAbstractItemModel *>(model); Q_ASSERT(itemModel); @@ -2389,7 +2389,7 @@ void TagFilterSortModel::addFilterModel(MultiFilterInterface *model) connect(itemModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(myInvalidate())); } -void TagFilterSortModel::removeFilterModel(MultiFilterInterface *model) +void MultiFilterSortModel::removeFilterModel(MultiFilterInterface *model) { QAbstractItemModel *itemModel = dynamic_cast<QAbstractItemModel *>(model); Q_ASSERT(itemModel); diff --git a/qt-ui/models.h b/qt-ui/models.h index a0b256594..032edc58f 100644 --- a/qt-ui/models.h +++ b/qt-ui/models.h @@ -443,17 +443,17 @@ private: explicit TagFilterModel(QObject *parent = 0); }; -class TagFilterSortModel : public QSortFilterProxyModel { +class MultiFilterSortModel : public QSortFilterProxyModel { Q_OBJECT public: - static TagFilterSortModel *instance(); + static MultiFilterSortModel *instance(); virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; void addFilterModel(MultiFilterInterface *model); void removeFilterModel(MultiFilterInterface *model); public slots: void myInvalidate(); private: - TagFilterSortModel(QObject *parent = 0); + MultiFilterSortModel(QObject *parent = 0); QList<MultiFilterInterface*> models; }; #endif // MODELS_H diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index 47952c323..d00fab81e 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -467,13 +467,13 @@ TagFilter::TagFilter(QWidget *parent) : QWidget(parent) void TagFilter::showEvent(QShowEvent *event) { - TagFilterSortModel::instance()->addFilterModel(TagFilterModel::instance()); + MultiFilterSortModel::instance()->addFilterModel(TagFilterModel::instance()); QWidget::showEvent(event); } void TagFilter::hideEvent(QHideEvent *event) { - TagFilterSortModel::instance()->removeFilterModel(TagFilterModel::instance()); + MultiFilterSortModel::instance()->removeFilterModel(TagFilterModel::instance()); QWidget::hideEvent(event); } |