summaryrefslogtreecommitdiff
path: root/taglistmodel.h
blob: d7e102f5819be25d193ab51e10ebdd221b4bf5bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef TAGLISTMODEL_H
#define TAGLISTMODEL_H

#include "sqlitebackend.h"

#include <qabstractitemmodel.h>

class TagListModel : public QAbstractListModel
{
    Q_OBJECT

public:
    TagListModel(SQLiteSaveFile &backend);

    int rowCount(const QModelIndex &parent=QModelIndex()) const override;
    QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override;
    QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override;
   QModelIndex indexOf(const Tag &t) const;

    Qt::ItemFlags flags(const QModelIndex &index) const override;
    bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override;

    Tag getTag(const QModelIndex &index) const;

public slots:
    void reloadTags();

private:
    SQLiteSaveFile &backend;
    QList<Tag> cached_tags;
};

#endif // TAGLISTMODEL_H