File indexing completed on 2022-11-29 12:50:41

0001 /*
0002     SPDX-FileCopyrightText: 2007 Carsten Niehaus <cniehaus@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef ISOTOPEGUIDEVIEW_H
0008 #define ISOTOPEGUIDEVIEW_H
0009 
0010 #include <QGraphicsView>
0011 #include <QMouseEvent>
0012 #include <QResizeEvent>
0013 
0014 #include "isotopeview.h"
0015 
0016 class IsotopeGuideView : public QGraphicsView
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     explicit IsotopeGuideView(QWidget *parent = nullptr);
0022     void setGuidedView(IsotopeView *guidedView);
0023 
0024 protected:
0025     void drawForeground(QPainter *painter, const QRectF &rect) override;
0026 
0027 private:
0028     IsotopeView *m_guidedView = nullptr;
0029     double m_zoomLevel;
0030     double m_scale;
0031     QPolygonF m_visibleSceneRect;
0032     QPoint m_lastMousePos;
0033     bool m_dragEvent;
0034 
0035     void resizeEvent(QResizeEvent *event) override;
0036     void mousePressEvent(QMouseEvent *event) override;
0037     void mouseReleaseEvent(QMouseEvent *event) override;
0038     void mouseMoveEvent(QMouseEvent *event) override;
0039 
0040 public Q_SLOTS:
0041     void updateScene();
0042 
0043 private Q_SLOTS:
0044     void setZoomLevel(double zoomLevel);
0045     void setVisibleSceneRect(const QPolygonF &sceneRect);
0046 };
0047 
0048 #endif // ISOTOPEGUIDEVIEW_H