1 /* 2 SPDX-License-Identifier: GPL-2.0-or-later 3 SPDX-FileCopyrightText: 2002-2020 Umbrello UML Modeller Authors <umbrello-devel@kde.org> 4 */ 5 6 #ifndef UMLVIEW_H 7 #define UMLVIEW_H 8 9 #include <QGraphicsView> 10 11 class QCloseEvent; 12 class QHideEvent; 13 class QShowEvent; 14 class UMLFolder; 15 class UMLScene; 16 17 /** 18 * UMLView instances represent views onto diagrams (scenes). 19 * The UMLApp instance manages the visibility of UMLView instances. 20 * The visible view (and therefore diagram) is at the top of stack. 21 * The UMLView class inherits from QGraphicsView. 22 * Construction of a UMLView implicitly constructs a UMLScene, i.e. 23 * there is a one to one relation between diagram and view. 24 * The UMLFolder instances own the UMLView instances. 25 * 26 * @author Paul Hensgen <phensgen@techie.com> 27 * Bugs and comments to umbrello-devel@kde.org or https://bugs.kde.org 28 */ 29 class UMLView : public QGraphicsView 30 { 31 Q_OBJECT 32 public: 33 explicit UMLView(UMLFolder *parentFolder); 34 virtual ~UMLView(); 35 36 UMLScene* umlScene() const; 37 38 qreal zoom() const ; 39 void setZoom(qreal zoom); 40 41 virtual bool showPropertiesDialog(QWidget *parent = 0); 42 43 public slots: 44 void zoomIn(); 45 void zoomOut(); 46 void show(); 47 48 protected: 49 virtual void wheelEvent(QWheelEvent* event); 50 virtual void showEvent(QShowEvent *se); 51 virtual void hideEvent(QHideEvent *he); 52 virtual void mousePressEvent(QMouseEvent* event); 53 virtual void mouseReleaseEvent(QMouseEvent* event); 54 virtual void resizeEvent(QResizeEvent *event); 55 }; 56 57 #endif // UMLVIEW_H 58