fw4spl
Scene2DGraphicsView.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWRENDERQT_SCENE2DGRAPHICSVIEW_HPP__
8 #define __FWRENDERQT_SCENE2DGRAPHICSVIEW_HPP__
9 
10 #include "fwRenderQt/config.hpp"
11 #include "fwRenderQt/data/Event.hpp"
12 #include "fwRenderQt/data/Viewport.hpp"
13 
14 #include <QGraphicsScene>
15 #include <QGraphicsView>
16 #include <QPaintEvent>
17 #include <QResizeEvent>
18 
19 namespace fwRenderQt
20 {
21 
22 class SRender;
23 
24 class FWRENDERQT_CLASS_API Scene2DGraphicsView : public QGraphicsView
25 {
26 Q_OBJECT
27 
28 public:
29 
30  FWRENDERQT_API Scene2DGraphicsView(QGraphicsScene* scene, QWidget* widget);
31 
33 
34  FWRENDERQT_API void keyPressEvent(QKeyEvent* _event);
35 
36  FWRENDERQT_API void keyReleaseEvent(QKeyEvent* _event);
37 
38  FWRENDERQT_API void resizeEvent(QResizeEvent* _event);
39 
40  FWRENDERQT_API void mouseReleaseEvent ( QMouseEvent* _event );
41 
42  FWRENDERQT_API void mousePressEvent ( QMouseEvent* _event );
43 
44  FWRENDERQT_API void mouseMoveEvent ( QMouseEvent* _event );
45 
46  FWRENDERQT_API void mouseDoubleClickEvent ( QMouseEvent* _event );
47 
48  FWRENDERQT_API void wheelEvent ( QWheelEvent* _event );
49 
50  FWRENDERQT_API void updateFromViewport();
51 
52  FWRENDERQT_API void setViewport( ::fwRenderQt::data::Viewport::sptr viewport );
53 
54  FWRENDERQT_API void setSceneRender( SPTR(::fwRenderQt::SRender) sceneRender );
55 
56 protected:
57 
58  ::fwRenderQt::data::Viewport::sptr m_viewport;
59  WPTR(::fwRenderQt::SRender) m_scene2DRender;
60 
61  ::fwRenderQt::data::Event::Button getScene2DButtonFromEvent( QMouseEvent* _event );
62  ::fwRenderQt::data::Event::Modifier getScene2DModifierFromEvent( QInputEvent* _event );
63 
64  void paintEvent ( QPaintEvent* event );
65 
66 };
67 } // namespace fwRenderQt
68 
69 #endif // __FWRENDERQT_SCENE2DGRAPHICSVIEW_HPP__
70 
#define SPTR(_cls_)
#define WPTR(_cls_)
The namespace fwRenderQt contains classes for rendering with Qt.
Definition: Axis.hpp:12