pineapple-pictures/app/navigatorview.h

39 lines
985 B
C
Raw Permalink Normal View History

// SPDX-FileCopyrightText: 2022 Gary Wang <wzc782970009@gmail.com>
//
// SPDX-License-Identifier: MIT
2019-10-03 17:57:14 +08:00
#ifndef NAVIGATORVIEW_H
#define NAVIGATORVIEW_H
#include <QGraphicsView>
2019-10-06 14:58:01 +08:00
class OpacityHelper;
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);
2019-10-06 14:58:01 +08:00
void setOpacity(qreal opacity, bool animated = true);
2019-10-04 09:54:13 +08:00
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-06 14:58:01 +08:00
OpacityHelper *m_opacityHelper = nullptr;
2019-10-03 17:57:14 +08:00
};
#endif // NAVIGATORVIEW_H