Create a common macro for flags

samething as the other commits, use common code.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-11-13 16:48:13 -02:00 committed by Dirk Hohndel
parent dfb2575dff
commit 76e1fe3ee7

View file

@ -57,6 +57,16 @@ CREATE_CLEAR_FILTER_METHOD(LocationFilterModel);
#undef CREATE_CLEAR_FILTER_METHOD #undef CREATE_CLEAR_FILTER_METHOD
#define CREATE_FLAGS_METHOD( CLASS ) \
Qt::ItemFlags CLASS::flags(const QModelIndex &index) const \
{ \
return QStringListModel::flags(index) | Qt::ItemIsUserCheckable; \
}
CREATE_FLAGS_METHOD(TagFilterModel);
CREATE_FLAGS_METHOD(BuddyFilterModel);
CREATE_FLAGS_METHOD(LocationFilterModel);
TagFilterModel::TagFilterModel(QObject *parent) : QStringListModel(parent) TagFilterModel::TagFilterModel(QObject *parent) : QStringListModel(parent)
{ {
} }
@ -73,11 +83,6 @@ QVariant TagFilterModel::data(const QModelIndex &index, int role) const
return QVariant(); return QVariant();
} }
Qt::ItemFlags TagFilterModel::flags(const QModelIndex &index) const
{
return QStringListModel::flags(index) | Qt::ItemIsUserCheckable;
}
void TagFilterModel::repopulate() void TagFilterModel::repopulate()
{ {
if (g_tag_list == NULL) if (g_tag_list == NULL)
@ -208,11 +213,6 @@ bool BuddyFilterModel::filterRow(int source_row, const QModelIndex &source_paren
return doFilter(d, index0, sourceModel); return doFilter(d, index0, sourceModel);
} }
Qt::ItemFlags BuddyFilterModel::flags(const QModelIndex &index) const
{
return QStringListModel::flags(index) | Qt::ItemIsUserCheckable;
}
void BuddyFilterModel::repopulate() void BuddyFilterModel::repopulate()
{ {
QStringList list; QStringList list;
@ -317,11 +317,6 @@ bool LocationFilterModel::filterRow(int source_row, const QModelIndex &source_pa
return doFilter(d, index0, sourceModel); return doFilter(d, index0, sourceModel);
} }
Qt::ItemFlags LocationFilterModel::flags(const QModelIndex &index) const
{
return QStringListModel::flags(index) | Qt::ItemIsUserCheckable;
}
void LocationFilterModel::repopulate() void LocationFilterModel::repopulate()
{ {
QStringList list; QStringList list;