pineapple-pictures/navigatorview.h
2019-10-04 20:41:27 +08:00

32 lines
750 B
C++

#ifndef NAVIGATORVIEW_H
#define NAVIGATORVIEW_H
#include <QGraphicsView>
class GraphicsView;
class NavigatorView : public QGraphicsView
{
Q_OBJECT
public:
NavigatorView(QWidget *parent = nullptr);
void setMainView(GraphicsView *mainView);
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;
};
#endif // NAVIGATORVIEW_H