51 lines
944 B
C++
51 lines
944 B
C++
#ifndef TAGVIEW_H
|
|
#define TAGVIEW_H
|
|
|
|
#include "sqlitebackend.h"
|
|
#include "tagscene.h"
|
|
|
|
#include <QGraphicsView>
|
|
#include <QTimer>
|
|
|
|
|
|
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;
|
|
|
|
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
|