Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkRenderWindow_h
14 #define QmitkRenderWindow_h
15 
16 #include "mitkRenderWindowBase.h"
17 
18 #include "QmitkRenderWindowMenu.h"
19 #include <MitkQtWidgetsExports.h>
20 
21 #include <vtkGenericOpenGLRenderWindow.h>
22 #include <QVTKOpenGLNativeWidget.h>
23 
24 #include "mitkBaseRenderer.h"
26 
28 
29 class QDragEnterEvent;
30 class QDropEvent;
31 class QInputEvent;
32 class QMouseEvent;
33 
38 class MITKQTWIDGETS_EXPORT QmitkRenderWindow : public QVTKOpenGLNativeWidget, public mitk::RenderWindowBase
39 {
40  Q_OBJECT
41 
42 public:
44  QWidget *parent = nullptr,
45  const QString &name = "unnamed renderwindow",
46  mitk::VtkPropRenderer *renderer = nullptr);
47  ~QmitkRenderWindow() override;
48 
65  virtual void SetResendQtEvents(bool resend);
66 
67  // Set Layout Index to define the Layout Type
68  void SetLayoutIndex(QmitkRenderWindowMenu::LayoutIndex layoutIndex);
69 
70  // Get Layout Index to define the Layout Type
71  QmitkRenderWindowMenu::LayoutIndex GetLayoutIndex();
72 
73  // MenuWidget need to update the Layout Design List when Layout had changed
74  void UpdateLayoutDesignList(QmitkRenderWindowMenu::LayoutDesign layoutDesign);
75 
76  void UpdateCrosshairVisibility(bool);
77 
78  void UpdateCrosshairRotationMode(int);
79 
80  // Activate or Deactivate MenuWidget.
81  void ActivateMenuWidget(bool state);
82 
83  bool GetActivateMenuWidgetFlag() { return m_MenuWidgetActivated; }
84 
85  void ShowOverlayMessage(bool show);
86 
87  // Get it from the QVTKWidget parent
88  vtkRenderWindow *GetVtkRenderWindow() override { return this->renderWindow(); }
89 
90  vtkRenderWindowInteractor *GetVtkRenderWindowInteractor() override { return nullptr; }
91 
92 protected:
93 
94  // catch-all event handler
95  bool event(QEvent *e) override;
96  // overloaded move handler
97  void moveEvent(QMoveEvent *event) override;
98  // overloaded show handler
99  void showEvent(QShowEvent *event) override;
100  // overloaded enter handler
101  void enterEvent(QEvent *) override;
102  // overloaded leave handler
103  void leaveEvent(QEvent *) override;
104 
105  // Overloaded resize handler, see decs in QVTKOpenGLWidget.
106  // Basically, we have to ensure the VTK rendering is updated for each change in window size.
107  void resizeGL(int w, int h) override;
108 
110  void dragEnterEvent(QDragEnterEvent *event) override;
111 
114  void dropEvent(QDropEvent *event) override;
115 
116 Q_SIGNALS:
117 
118  void LayoutDesignChanged(QmitkRenderWindowMenu::LayoutDesign);
119 
120  void ResetView();
121 
122  void ResetGeometry();
123 
124  void CrosshairRotationModeChanged(int);
125 
126  void CrosshairVisibilityChanged(bool);
127 
128  void moved();
129 
131  void NodesDropped(QmitkRenderWindow *thisWindow, std::vector<mitk::DataNode *> nodes);
132 
133 private Q_SLOTS:
134 
135  void DeferredHideMenu();
136 
137 private:
138  // Helper Functions to Convert Qt-Events to Mitk-Events
139 
140  mitk::Point2D GetMousePosition(QMouseEvent *me) const;
141  mitk::Point2D GetMousePosition(QWheelEvent *we) const;
142  mitk::InteractionEvent::MouseButtons GetEventButton(QMouseEvent *me) const;
143  mitk::InteractionEvent::MouseButtons GetButtonState(QMouseEvent *me) const;
144  mitk::InteractionEvent::ModifierKeys GetModifiers(QInputEvent *me) const;
145  mitk::InteractionEvent::MouseButtons GetButtonState(QWheelEvent *we) const;
146  std::string GetKeyLetter(QKeyEvent *ke) const;
147  int GetDelta(QWheelEvent *we) const;
148 
149  void UpdateStatusBar(mitk::Point2D pointerPositionOnScreen);
150 
151  bool m_ResendQtEvents;
152 
153  QmitkRenderWindowMenu *m_MenuWidget;
154 
155  bool m_MenuWidgetActivated;
156 
158 
159  vtkSmartPointer<vtkGenericOpenGLRenderWindow> m_InternalRenderWindow;
160 
161  QmitkButtonOverlayWidget* m_GeometryViolationWarningOverlay;
162 
163 };
164 
165 #endif
QmitkRenderWindow::GetVtkRenderWindow
vtkRenderWindow * GetVtkRenderWindow() override
Definition: QmitkRenderWindow.h:88
QmitkRenderWindowMenu
The QmitkRenderWindowMenu is a popup Widget which shows up when the mouse cursor enter a QmitkRenderW...
Definition: QmitkRenderWindowMenu.h:48
QmitkMultiWidgetLayoutManager::LayoutDesign
LayoutDesign
Definition: QmitkMultiWidgetLayoutManager.h:41
MITKQTWIDGETS_EXPORT
#define MITKQTWIDGETS_EXPORT
Definition: MitkQtWidgetsExports.h:15
mitkRenderWindowBase.h
vtkSmartPointer< vtkGenericOpenGLRenderWindow >
mitk::RenderWindowBase
Base class of MITK RenderWindows.
Definition: mitkRenderWindowBase.h:39
mitk::InteractionEvent::MouseButtons
MouseButtons
Definition: mitkInteractionEvent.h:44
QmitkRenderWindow
MITK implementation of the QVTKWidget.
Definition: QmitkRenderWindow.h:38
mitk::VtkPropRenderer
VtkPropRenderer.
Definition: mitkVtkPropRenderer.h:55
QmitkRenderWindow::GetActivateMenuWidgetFlag
bool GetActivateMenuWidgetFlag()
Definition: QmitkRenderWindow.h:83
QmitkButtonOverlayWidget
Definition: QmitkButtonOverlayWidget.h:27
QmitkRenderWindow::GetVtkRenderWindowInteractor
vtkRenderWindowInteractor * GetVtkRenderWindowInteractor() override
Definition: QmitkRenderWindow.h:90
mitk::AnatomicalPlane
AnatomicalPlane
Definition: mitkAnatomicalPlanes.h:18
mitk::Point< ScalarType, 2 >
MitkQtWidgetsExports.h
mitk::InteractionEvent::ModifierKeys
ModifierKeys
Definition: mitkInteractionEvent.h:52
mitkInteractionEventConst.h
QmitkRenderWindowMenu.h
mitkBaseRenderer.h
QmitkButtonOverlayWidget.h