CustusX  2023.01.05-dev+develop.0da12
An IGT application
QVTKWidget3.h
Go to the documentation of this file.
1 #ifndef QVTKWIDGET3_H
2 #define QVTKWIDGET3_H
3 
4 #include "vtkSmartPointer.h"
5 #include "vtkGenericOpenGLRenderWindow.h"
6 #include "vtkEventQtSlotConnect.h"
7 
8 #include "QVTKInteractorAdapter.h"
9 #include "QVTKInteractor.h"
10 
11 #include <QOpenGLWidget>
12 #include <QSurfaceFormat>
13 
14 class QVTKWidget3 : public QOpenGLWidget
15 {
16  Q_OBJECT
17 
18 public:
19  QVTKWidget3(QWidget *parent = NULL, Qt::WindowFlags f = 0, QSurfaceFormat format = QSurfaceFormat::defaultFormat());
20  virtual ~QVTKWidget3();
21 
23  virtual void SetRenderWindow(vtkGenericOpenGLRenderWindow*);
25  virtual vtkGenericOpenGLRenderWindow* GetRenderWindow();
26 
28  virtual QVTKInteractor* GetInteractor();
29 
30 public slots:
32  virtual void MakeCurrent();
34  virtual void IsCurrent(vtkObject* caller, unsigned long vtk_event, void* client_data, void* call_data);
36  virtual void Frame();
38  virtual void Start();
40  virtual void End();
42  virtual void IsDirect(vtkObject* caller, unsigned long vtk_event, void* client_data, void* call_data);
44  virtual void SupportsOpenGL(vtkObject* caller, unsigned long vtk_event, void* client_data, void* call_data);
45 
46 protected:
48  virtual void initializeGL();
50  virtual void paintGL();
52  virtual void resizeGL(int, int);
54  virtual void moveEvent(QMoveEvent* event);
55 
56  virtual void mousePressEvent(QMouseEvent* event);
57  virtual void mouseMoveEvent(QMouseEvent* event);
58  virtual void mouseReleaseEvent(QMouseEvent* event);
59  virtual void keyPressEvent(QKeyEvent* event);
60  virtual void keyReleaseEvent(QKeyEvent* event);
61  virtual void enterEvent(QEvent*);
62  virtual void leaveEvent(QEvent*);
63  virtual void wheelEvent(QWheelEvent*);
64 
65  virtual void contextMenuEvent(QContextMenuEvent*);
66  virtual void dragEnterEvent(QDragEnterEvent*);
67  virtual void dragMoveEvent(QDragMoveEvent*);
68  virtual void dragLeaveEvent(QDragLeaveEvent*);
69  virtual void dropEvent(QDropEvent*);
70 
71  virtual bool focusNextPrevChild(bool);
72 
73  // Members
74  vtkGenericOpenGLRenderWindow* m_renWin;
75  QVTKInteractorAdapter* m_irenAdapter;
76  vtkSmartPointer<vtkEventQtSlotConnect> m_connect;
77 
78 private:
80  QVTKWidget3 const& operator=(QVTKWidget3 const&);
82  QVTKWidget3(const QVTKWidget3&);
83 };
84 
85 
86 #endif // QVTKWIDGET3_H
virtual void End()
Slot called when vtk wants to end the render.
virtual void MakeCurrent()
Slot to make this vtk render window current.
virtual void wheelEvent(QWheelEvent *)
virtual void SupportsOpenGL(vtkObject *caller, unsigned long vtk_event, void *client_data, void *call_data)
Slot called when vtk wants to know if a window supports OpenGL.
virtual void IsDirect(vtkObject *caller, unsigned long vtk_event, void *client_data, void *call_data)
Slot called when vtk wants to know if a window is direct.
virtual void leaveEvent(QEvent *)
virtual void dropEvent(QDropEvent *)
virtual void mouseReleaseEvent(QMouseEvent *event)
virtual void keyReleaseEvent(QKeyEvent *event)
vtkGenericOpenGLRenderWindow * m_renWin
Definition: QVTKWidget3.h:74
virtual vtkGenericOpenGLRenderWindow * GetRenderWindow()
Returns the curren render window (creates one if none exists)
Definition: QVTKWidget3.cpp:31
virtual void paintGL()
Paint handler.
virtual void Frame()
Slot called when vtk wants to frame the window.
virtual void IsCurrent(vtkObject *caller, unsigned long vtk_event, void *client_data, void *call_data)
Slot called when vtk wants to know if the context is current.
virtual void mouseMoveEvent(QMouseEvent *event)
QVTKWidget3(QWidget *parent=NULL, Qt::WindowFlags f=0, QSurfaceFormat format=QSurfaceFormat::defaultFormat())
Definition: QVTKWidget3.cpp:9
virtual void enterEvent(QEvent *)
virtual void contextMenuEvent(QContextMenuEvent *)
virtual void keyPressEvent(QKeyEvent *event)
virtual void dragLeaveEvent(QDragLeaveEvent *)
virtual void dragEnterEvent(QDragEnterEvent *)
virtual void initializeGL()
Initialize handler.
virtual void mousePressEvent(QMouseEvent *event)
virtual void SetRenderWindow(vtkGenericOpenGLRenderWindow *)
Set a custom render window.
Definition: QVTKWidget3.cpp:44
vtkSmartPointer< vtkEventQtSlotConnect > m_connect
Definition: QVTKWidget3.h:76
virtual QVTKInteractor * GetInteractor()
Returns interactor of the current render window.
virtual void moveEvent(QMoveEvent *event)
Move handler.
QVTKInteractorAdapter * m_irenAdapter
Definition: QVTKWidget3.h:75
virtual void Start()
Slot called when vtk wants to start the render.
virtual void resizeGL(int, int)
Resize handler.
virtual void dragMoveEvent(QDragMoveEvent *)
virtual bool focusNextPrevChild(bool)
virtual ~QVTKWidget3()
Definition: QVTKWidget3.cpp:23