Salome HOME
fe24dadaae9558b52fe77e7f496a40c47761f590
[modules/gui.git] / src / GraphicsView / GraphicsView_Scene.h
1 // Copyright (C) 2013-2023  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef GRAPHICSVIEW_SCENE_H
21 #define GRAPHICSVIEW_SCENE_H
22
23 #include "GraphicsView.h"
24
25 #include <QGraphicsScene>
26
27 class QGraphicsRectItem;
28
29 /*
30   Class       : GraphicsView_Scene
31   Description : Scene of the graphics view
32 */
33 class GRAPHICSVIEW_API GraphicsView_Scene : public QGraphicsScene
34 {
35   Q_OBJECT
36
37 public:
38   GraphicsView_Scene( QObject* theParent = 0 );
39   ~GraphicsView_Scene();
40
41 public:
42   void                       processRectChanged();
43
44 protected slots:
45   void                       onSceneRectChanged( const QRectF& theRect ); // for debug
46
47 protected:
48   virtual void               keyPressEvent( QKeyEvent* );
49   virtual void               keyReleaseEvent( QKeyEvent* );
50   virtual void               mousePressEvent( QGraphicsSceneMouseEvent* );
51   virtual void               mouseMoveEvent( QGraphicsSceneMouseEvent* );
52   virtual void               mouseReleaseEvent( QGraphicsSceneMouseEvent* );
53   virtual void               mouseDoubleClickEvent( QGraphicsSceneMouseEvent* );
54   virtual void               wheelEvent( QGraphicsSceneWheelEvent* );
55   virtual void               contextMenuEvent( QGraphicsSceneContextMenuEvent* );
56
57   virtual void               dragEnterEvent( QGraphicsSceneDragDropEvent* );
58   virtual void               dragLeaveEvent( QGraphicsSceneDragDropEvent* );
59   virtual void               dragMoveEvent( QGraphicsSceneDragDropEvent* );
60   virtual void               dropEvent( QGraphicsSceneDragDropEvent* );
61
62 signals:
63   void                       gsKeyEvent( QKeyEvent* );
64   void                       gsMouseEvent( QGraphicsSceneMouseEvent* );
65   void                       gsWheelEvent( QGraphicsSceneWheelEvent* );
66   void                       gsContextMenuEvent( QGraphicsSceneContextMenuEvent* );
67
68   void                       gsBoundingRectChanged();
69
70 private:
71   QGraphicsRectItem*         mySceneRectItem; // for debug
72 };
73
74 #endif