summaryrefslogtreecommitdiff
path: root/tagscene.h
blob: 4c81fe5faa58580a0aaca87aa041db789b3c5c18 (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
41
42
43
44
45
46
#ifndef TAGSCENE_H
#define TAGSCENE_H

#include "sqlitebackend.h"
#include "tagitem.h"

#include <QGraphicsPixmapItem>
#include <QGraphicsScene>



class TagScene : public QGraphicsScene
{
    Q_OBJECT

public:
    TagScene() {}
    const QGraphicsPixmapItem *backgroundPixmapItem() const { return pix_it; }

public slots:
    void reloadPicture();
    void reloadScene();

    void setProject(SQLiteSaveFile *proj);

signals:
    void tagDoubleClicked(const Tag &tag);
    void imageLoaded();

protected:
    void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;

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

private:
    void addTag(const Tag tag);

    SQLiteSaveFile *m_proj = nullptr;

    QGraphicsPixmapItem *pix_it = nullptr;
    QPixmap pix;
    QMap<long long int, TagItem*> tags;
};

#endif // TAGSCENE_H