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

0001 /*
0002     SPDX-FileCopyrightText: 2007 Carsten Niehaus <cniehaus@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef ISOTOPEVIEW_H
0008 #define ISOTOPEVIEW_H
0009 
0010 #include <QGraphicsView>
0011 #include <QResizeEvent>
0012 #include <QWidget>
0013 
0014 class IsotopeScene;
0015 
0016 class IsotopeView : public QGraphicsView
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     explicit IsotopeView(QWidget *parent = nullptr);
0022     explicit IsotopeView(QWidget *parent, int mode);
0023     ~IsotopeView() override;
0024 
0025 private:
0026     void initialize();
0027 
0028 private:
0029     IsotopeScene *m_scene;
0030     double m_zoomLevel;
0031     int m_mode;
0032 
0033 public:
0034     double zoomLevel()
0035     {
0036         return m_zoomLevel;
0037     }
0038     QPolygonF visibleSceneRect() const
0039     {
0040         return mapToScene(viewport()->rect());
0041     }
0042 
0043 Q_SIGNALS:
0044     void zoomLevelChanged(double zoomLevel);
0045     void visibleSceneRectChanged(const QPolygonF &sceneRect);
0046 
0047 public Q_SLOTS:
0048     void setZoom(double zoom);
0049     void setMode(int mode);
0050 
0051 public:
0052     int mode() const;
0053 
0054 protected:
0055     void resizeEvent(QResizeEvent *event) override;
0056     void mouseMoveEvent(QMouseEvent *event) override;
0057     void wheelEvent(QWheelEvent *event) override;
0058 };
0059 
0060 #endif // ISOTOPEVIEW_H