Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkRenderWindow.h
Go to the documentation of this file.
1 /*===================================================================
2 
3  The Medical Imaging Interaction Toolkit (MITK)
4 
5  Copyright (c) German Cancer Research Center,
6  Division of Medical and Biological Informatics.
7  All rights reserved.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without
10  even the implied warranty of MERCHANTABILITY or FITNESS FOR
11  A PARTICULAR PURPOSE.
12 
13  See LICENSE.txt or http://www.mitk.org for details.
14 
15  ===================================================================*/
16 
17 #ifndef QMITKRENDERWINDOW_H_HEADER_INCLUDED_C1C40D66
18 #define QMITKRENDERWINDOW_H_HEADER_INCLUDED_C1C40D66
19 
20 #include "mitkRenderWindowBase.h"
21 
22 #include "QVTKWidget.h"
23 #include "QmitkRenderWindowMenu.h"
24 #include <MitkQtWidgetsExports.h>
25 #include <vtkGenericOpenGLRenderWindow.h>
26 
27 #include "mitkBaseRenderer.h"
29 
31 class QDragEnterEvent;
32 class QDropEvent;
33 class QInputEvent;
34 
40 {
41  Q_OBJECT
42 
43 public:
45  QWidget *parent = 0,
46  QString name = "unnamed renderwindow",
47  mitk::VtkPropRenderer *renderer = NULL,
48  mitk::RenderingManager *renderingManager = NULL,
50  virtual ~QmitkRenderWindow();
51 
68  virtual void SetResendQtEvents(bool resend);
69 
70  // Set Layout Index to define the Layout Type
71  void SetLayoutIndex(unsigned int layoutIndex);
72 
73  // Get Layout Index to define the Layout Type
74  unsigned int GetLayoutIndex();
75 
76  // MenuWidget need to update the Layout Design List when Layout had changed
77  void LayoutDesignListChanged(int layoutDesignIndex);
78 
79  void HideRenderWindowMenu();
80 
81  // Activate or Deactivate MenuWidget.
82  void ActivateMenuWidget(bool state, QmitkStdMultiWidget *stdMultiWidget = 0);
83 
84  bool GetActivateMenuWidgetFlag() { return m_MenuWidgetActivated; }
85  // Get it from the QVTKWidget parent
86  virtual vtkRenderWindow *GetVtkRenderWindow() override { return GetRenderWindow(); }
87  virtual vtkRenderWindowInteractor *GetVtkRenderWindowInteractor() override { return NULL; }
88  void FullScreenMode(bool state);
89 
90 protected:
91  // overloaded move handler
92  virtual void moveEvent(QMoveEvent *event) override;
93  // overloaded show handler
94  void showEvent(QShowEvent *event) override;
95  // overloaded paint handler
96  virtual void paintEvent(QPaintEvent *event) override;
97  // overloaded mouse press handler
98  virtual void mousePressEvent(QMouseEvent *event) override;
99  // overloaded mouse double-click handler
100  virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
101  // overloaded mouse move handler
102  virtual void mouseMoveEvent(QMouseEvent *event) override;
103  // overloaded mouse release handler
104  virtual void mouseReleaseEvent(QMouseEvent *event) override;
105  // overloaded key press handler
106  virtual void keyPressEvent(QKeyEvent *event) override;
107  // overloaded enter handler
108  virtual void enterEvent(QEvent *) override;
109  // overloaded leave handler
110  virtual void leaveEvent(QEvent *) override;
111 
113  virtual void dragEnterEvent(QDragEnterEvent *event) override;
114 
117  virtual void dropEvent(QDropEvent *event) override;
118 
119 #ifndef QT_NO_WHEELEVENT
120  // overload wheel mouse event
121  virtual void wheelEvent(QWheelEvent *) override;
122 #endif
123 
124  void AdjustRenderWindowMenuVisibility(const QPoint &pos);
125 
126 signals:
127 
128  void ResetView();
129  // \brief int parameters are enum from QmitkStdMultiWidget
130  void ChangeCrosshairRotationMode(int);
131 
132  void SignalLayoutDesignChanged(int layoutDesignIndex);
133 
134  void moved();
135 
137  void NodesDropped(QmitkRenderWindow *thisWindow, std::vector<mitk::DataNode *> nodes);
138 
139 protected slots:
140 
141  void OnChangeLayoutDesign(int layoutDesignIndex);
142 
143  void OnWidgetPlaneModeChanged(int);
144 
145  void DeferredHideMenu();
146 
147 private:
148  // Helper Functions to Convert Qt-Events to Mitk-Events
149 
150  mitk::Point2D GetMousePosition(QMouseEvent *me) const;
151  mitk::Point2D GetMousePosition(QWheelEvent *we) const;
154  mitk::InteractionEvent::ModifierKeys GetModifiers(QInputEvent *me) const;
156  std::string GetKeyLetter(QKeyEvent *ke) const;
157  int GetDelta(QWheelEvent *we) const;
158  bool m_ResendQtEvents;
159 
160  QmitkRenderWindowMenu *m_MenuWidget;
161 
162  bool m_MenuWidgetActivated;
163 
164  unsigned int m_LayoutIndex;
165 };
166 
167 #endif
Base class of MITK RenderWindows.
The QmitkRenderWindowMenu is a popup Widget which shows up when the mouse curser enter a QmitkRenderW...
virtual vtkRenderWindowInteractor * GetVtkRenderWindowInteractor() override
#define MITKQTWIDGETS_EXPORT
virtual vtkRenderWindow * GetVtkRenderWindow() override
static std::string GetEventButton(mitk::InteractionEvent *event)
GetEventButton Return EventButton as String.
static std::string GetButtonState(mitk::InteractionEvent *event)
GetEventButton Return EventButton as String.
Manager for coordinating the rendering process.
bool GetActivateMenuWidgetFlag()
MITK implementation of the QVTKWidget.