#ifndef TAGSCENE_H #define TAGSCENE_H #include "sqlitebackend.h" #include "tagitem.h" #include "numberator.h" #include #include class TagScene : public QGraphicsScene { Q_OBJECT public: TagScene() : m_previewTag(new TagItem()) {} ~TagScene() { this->blockSignals(true); delete m_previewTag; } const QGraphicsPixmapItem *backgroundPixmapItem() const { return pix_it; } public slots: void reloadPicture(); void reloadScene(); void selectTag(const Tag &tag); void setTool(ToolType tool); void abortTool(); void setProject(SQLiteSaveFile *proj); signals: void tagDoubleClicked(const Tag &tag); void imageLoaded(); protected: void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override; void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override; void mousePressEvent(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 tags; ToolType m_tool; enum TagToolState { TAG_TOOL_ANCHOR, TAG_TOOL_LABEL } m_tagToolState = TAG_TOOL_ANCHOR; TagItem *m_previewTag; }; #endif // TAGSCENE_H