blob: 808b10043df8ab8dc524bef733500b6b6de18377 (
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
49
50
51
52
53
54
|
#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;
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
|