tageditor/application/targetlevelmodel.h

44 lines
1.3 KiB
C
Raw Normal View History

2016-05-26 02:15:41 +02:00
#ifndef TARGETLEVELMODEL_H
#define TARGETLEVELMODEL_H
#include <qtutilities/models/checklistmodel.h>
#include <QAbstractListModel>
#include <QList>
2018-03-06 23:10:13 +01:00
namespace TagParser {
2016-07-11 21:34:05 +02:00
DECLARE_ENUM_CLASS(TagTargetLevel, unsigned char);
2016-05-26 02:15:41 +02:00
}
namespace Settings {
class TargetLevelModel : public Models::ChecklistModel
{
Q_OBJECT
public:
enum class DefaultSelection
{
None,
MostUsefulTargets
};
2018-03-06 23:10:13 +01:00
static const char *fieldName(TagParser::TagTargetLevel targetLevel);
static QString translatedFieldName(TagParser::TagTargetLevel targetLevel);
static Models::ChecklistItem mkItem(TagParser::TagTargetLevel targetLevel, Qt::CheckState checkState = Qt::Checked);
2016-05-26 02:15:41 +02:00
explicit TargetLevelModel(QObject *parent = nullptr, DefaultSelection defaultSelection = DefaultSelection::None);
explicit TargetLevelModel(const QList<Models::ChecklistItem> &items, QObject *parent = nullptr);
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
virtual QString labelForId(const QVariant &id) const;
};
2018-03-06 23:10:13 +01:00
inline Models::ChecklistItem TargetLevelModel::mkItem(TagParser::TagTargetLevel field, Qt::CheckState checkState)
2016-05-26 02:15:41 +02:00
{
return Models::ChecklistItem(static_cast<int>(field), translatedFieldName(field), checkState);
}
}
#endif // TARGETLEVELMODEL_H