2019-10-03 17:57:14 +08:00
|
|
|
#ifndef NAVIGATORVIEW_H
|
|
|
|
#define NAVIGATORVIEW_H
|
|
|
|
|
|
|
|
#include <QGraphicsView>
|
|
|
|
|
2019-10-04 09:54:13 +08:00
|
|
|
class GraphicsView;
|
2019-10-03 17:57:14 +08:00
|
|
|
class NavigatorView : public QGraphicsView
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
NavigatorView(QWidget *parent = nullptr);
|
|
|
|
|
2019-10-04 09:54:13 +08:00
|
|
|
void setMainView(GraphicsView *mainView);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void updateMainViewportRegion();
|
|
|
|
|
2019-10-03 17:57:14 +08:00
|
|
|
private:
|
2019-10-04 20:41:27 +08:00
|
|
|
void mousePressEvent(QMouseEvent * event) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent * event) override;
|
|
|
|
void mouseReleaseEvent(QMouseEvent * event) override;
|
|
|
|
|
2019-10-03 17:57:14 +08:00
|
|
|
void wheelEvent(QWheelEvent *event) override;
|
2019-10-04 09:54:13 +08:00
|
|
|
void paintEvent(QPaintEvent *event) override;
|
|
|
|
|
2019-10-04 20:41:27 +08:00
|
|
|
bool m_mouseDown = false;
|
2019-10-04 09:54:13 +08:00
|
|
|
QPolygon m_viewportRegion;
|
|
|
|
QGraphicsView *m_mainView = nullptr;
|
2019-10-03 17:57:14 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NAVIGATORVIEW_H
|