#ifndef TAGVIEW_H #define TAGVIEW_H #include "sqlitebackend.h" #include "tagscene.h" #include #include class TagView : public QGraphicsView { Q_OBJECT public: TagView(QWidget *parent=nullptr); virtual ~TagView(); TagScene *scene() { return &m_scene; } public slots: void zoomToFit(); void setZoom(qreal zoom); void zoomIn(qreal delta=120); void zoomOut(qreal delta=120) { zoomIn(-delta); } void rotate(int angle); void setProject(SQLiteSaveFile *proj); signals: void tagDoubleClicked(const Tag &tag); protected: void wheelEvent(QWheelEvent *evt) override; void scrollContentsBy(int dx, int dy) override; void keyPressEvent(QKeyEvent *event) override; void keyReleaseEvent(QKeyEvent *event) override; void focusInEvent(QFocusEvent *event) override; private slots: void saveCenter(); private: void restoreViewport(); QTimer saveCenterTimer; bool were_done = false; TagScene m_scene; SQLiteSaveFile *m_proj = nullptr; int rotation; double zoom; }; #endif // TAGVIEW_H