mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
dfb2575dff
commit
76e1fe3ee7
1 changed files with 10 additions and 15 deletions
|
@ -57,6 +57,16 @@ CREATE_CLEAR_FILTER_METHOD(LocationFilterModel);
|
|||
|
||||
#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)
|
||||
{
|
||||
}
|
||||
|
@ -73,11 +83,6 @@ QVariant TagFilterModel::data(const QModelIndex &index, int role) const
|
|||
return QVariant();
|
||||
}
|
||||
|
||||
Qt::ItemFlags TagFilterModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
return QStringListModel::flags(index) | Qt::ItemIsUserCheckable;
|
||||
}
|
||||
|
||||
void TagFilterModel::repopulate()
|
||||
{
|
||||
if (g_tag_list == NULL)
|
||||
|
@ -208,11 +213,6 @@ bool BuddyFilterModel::filterRow(int source_row, const QModelIndex &source_paren
|
|||
return doFilter(d, index0, sourceModel);
|
||||
}
|
||||
|
||||
Qt::ItemFlags BuddyFilterModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
return QStringListModel::flags(index) | Qt::ItemIsUserCheckable;
|
||||
}
|
||||
|
||||
void BuddyFilterModel::repopulate()
|
||||
{
|
||||
QStringList list;
|
||||
|
@ -317,11 +317,6 @@ bool LocationFilterModel::filterRow(int source_row, const QModelIndex &source_pa
|
|||
return doFilter(d, index0, sourceModel);
|
||||
}
|
||||
|
||||
Qt::ItemFlags LocationFilterModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
return QStringListModel::flags(index) | Qt::ItemIsUserCheckable;
|
||||
}
|
||||
|
||||
void LocationFilterModel::repopulate()
|
||||
{
|
||||
QStringList list;
|
||||
|
|
Loading…
Add table
Reference in a new issue