summaryrefslogtreecommitdiff
path: root/tagscene.h
blob: 18f9f54408f56f1955569c3e53e46a0dd0a34dac (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
47
48
#ifndef TAGSCENE_H
#define TAGSCENE_H

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

#include <QGraphicsPixmapItem>
#include <QGraphicsScene>



class TagScene : public QGraphicsScene
{
    Q_OBJECT

public:
    TagScene() {}
    ~TagScene() { this->blockSignals(true); }
    const QGraphicsPixmapItem *backgroundPixmapItem() const { return pix_it; }

public slots:
    void reloadPicture();
    void reloadScene();
    void selectTag(const Tag &tag);

    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