summaryrefslogtreecommitdiff
path: root/tagproptablemodel.h
blob: b127f90e26c6fec5db6b04a985c1c5669c1c5a3d (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
#ifndef TAGPROPTABLEMODEL_H
#define TAGPROPTABLEMODEL_H

#include "sqlitebackend.h"

#include <qabstractitemmodel.h>



class TagPropTableModel : public QAbstractTableModel
{
public:
    TagPropTableModel(SQLiteSaveFile &backend);
    TagPropTableModel(SQLiteSaveFile &backend, const Tag tag);

    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);

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

private:
    SQLiteSaveFile &backend;
    Tag tag_cached;
    QStringList tag_keys;
    bool tagIsValid;
};

#endif // TAGPROPTABLEMODEL_H