summaryrefslogtreecommitdiff
path: root/tagproptablemodel.h
blob: 4ba0b3a98a38f6ec18c8cd500931704370de5bbb (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
34
35
36
37
38
39
40
#ifndef TAGPROPTABLEMODEL_H
#define TAGPROPTABLEMODEL_H

#include "sqlitebackend.h"

#include <qabstractitemmodel.h>



class TagPropTableModel : public QAbstractTableModel
{
    Q_OBJECT

public:
    TagPropTableModel(SQLiteSaveFile *backend, bool showBaseData=true);

    int rowCount(const QModelIndex &parent=QModelIndex()) const override;
    int columnCount(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;

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

    void showTag(const Tag &tag);

    QVariantMap metadata() { return tag_cached.metadata; }

private slots:
    void tagChange(TagChange change, const Tag &tag);

private:

    SQLiteSaveFile *backend = nullptr;
    Tag tag_cached;
    QStringList tag_keys;
    bool showBaseData;
};

#endif // TAGPROPTABLEMODEL_H