From 819d358f8c790e4c1846ce4e5ba9b31291acf82a Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Tue, 11 Nov 2014 17:28:52 -0200 Subject: [PATCH] A bit of code cleanup. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/models.cpp | 6 +++--- qt-ui/models.h | 9 +++------ qt-ui/simplewidgets.cpp | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index 7c0b35cee..199a9c057 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -2253,7 +2253,7 @@ int LanguageModel::rowCount(const QModelIndex &parent) const } -TagFilterModel::TagFilterModel(QObject *parent) : QStringListModel(parent), checkState(NULL) +TagFilterModel::TagFilterModel(QObject *parent) : QStringListModel(parent) { } @@ -2366,7 +2366,7 @@ bool TagFilterModel::filterRow(int source_row, const QModelIndex &source_parent, return false; } -BuddyFilterModel::BuddyFilterModel(QObject *parent) : QStringListModel(parent), checkState(NULL) +BuddyFilterModel::BuddyFilterModel(QObject *parent) : QStringListModel(parent) { } @@ -2482,7 +2482,7 @@ bool BuddyFilterModel::setData(const QModelIndex &index, const QVariant &value, return false; } -LocationFilterModel::LocationFilterModel(QObject *parent) : QStringListModel(parent), checkState(NULL) +LocationFilterModel::LocationFilterModel(QObject *parent) : QStringListModel(parent) { } diff --git a/qt-ui/models.h b/qt-ui/models.h index 8750492a1..0d385babd 100644 --- a/qt-ui/models.h +++ b/qt-ui/models.h @@ -440,7 +440,10 @@ private: class MultiFilterInterface { public: + MultiFilterInterface() : checkState(NULL){}; virtual bool filterRow(int source_row, const QModelIndex &source_parent, QAbstractItemModel *sourceModel) const = 0; + bool *checkState; + bool anyChecked; }; class TagFilterModel : public QStringListModel, public MultiFilterInterface{ @@ -451,8 +454,6 @@ public: virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); virtual Qt::ItemFlags flags(const QModelIndex &index) const; virtual bool filterRow(int source_row, const QModelIndex &source_parent, QAbstractItemModel *sourceModel) const; - bool *checkState; - bool anyChecked; public slots: void repopulate(); @@ -469,8 +470,6 @@ public: virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); virtual Qt::ItemFlags flags(const QModelIndex &index) const; virtual bool filterRow(int source_row, const QModelIndex &source_parent, QAbstractItemModel *sourceModel) const; - bool *checkState; - bool anyChecked; public slots: void repopulate(); @@ -487,8 +486,6 @@ public: virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); virtual Qt::ItemFlags flags(const QModelIndex &index) const; virtual bool filterRow(int source_row, const QModelIndex &source_parent, QAbstractItemModel *sourceModel) const; - bool *checkState; - bool anyChecked; public slots: void repopulate(); diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index a46a22c97..850bdcf03 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -569,7 +569,7 @@ MultiFilter::MultiFilter(QWidget *parent) : QScrollArea(parent) tb->addWidget(closeBtn); connect(closeBtn, SIGNAL(clicked(bool)), this, SLOT(hide())); - + connect(clearBtn, SIGNAL(clicked(bool)), MultiFilterSortModel::instance(), SLOT(clearFilter())); l->addWidget(tb); l->addWidget(tagFilter); l->addWidget(new BuddyFilter());