-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnavigatorview.h
35 lines (26 loc) · 900 Bytes
/
navigatorview.h
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
#ifndef NAVIGATORVIEW_H
#define NAVIGATORVIEW_H
class OpacityHelper;
class GraphicsView;
#include <QGraphicsView>
class NavigatorView : public QGraphicsView
{
Q_OBJECT
public:
NavigatorView(QWidget *parent = nullptr);
void setMainView(GraphicsView *mainView);
void setOpacity(qreal opacity, bool animated = true);
public slots:
void updateMainViewportRegion(); // 更新右下角预览框位置
private:
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void wheelEvent(QWheelEvent *event) override;
void paintEvent(QPaintEvent *event) override;
bool m_mouseDown = false;
QPolygon m_viewportRegion;
QGraphicsView *m_mainView = nullptr;
OpacityHelper *m_opacityHelper = nullptr;
};
#endif // NAVIGATORVIEW_H