23 #include <QDragEnterEvent> 26 #include <QMouseEvent> 27 #include <QResizeEvent> 28 #include <QSurfaceFormat> 30 #include <QWheelEvent> 37 : QVTKOpenGLWidget(parent)
38 , m_ResendQtEvents(true)
39 , m_MenuWidget(nullptr)
40 , m_MenuWidgetActivated(false)
43 m_InternalRenderWindow = vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New();
44 m_InternalRenderWindow->SetMultiSamples(0);
45 m_InternalRenderWindow->SetAlphaBitPlanes(0);
47 SetRenderWindow(m_InternalRenderWindow);
51 setFocusPolicy(Qt::StrongFocus);
52 setMouseTracking(
true);
53 QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
54 setSizePolicy(sizePolicy);
64 m_ResendQtEvents = resend;
69 m_LayoutIndex = layoutIndex;
70 if (
nullptr != m_MenuWidget)
78 if (
nullptr != m_MenuWidget)
90 if (
nullptr != m_MenuWidget)
98 if (
nullptr == m_MenuWidget)
104 m_MenuWidgetActivated = state;
106 if (m_MenuWidgetActivated)
120 m_MenuWidget->hide();
126 QVTKOpenGLWidget::moveEvent(event);
134 QVTKOpenGLWidget::showEvent(event);
138 QTimer::singleShot(0,
this, SIGNAL(
moved()));
151 QVTKOpenGLWidget::mousePressEvent(me);
154 if (m_ResendQtEvents)
168 QVTKOpenGLWidget::mousePressEvent(me);
171 if (m_ResendQtEvents)
183 if (!this->
HandleEvent(mReleaseEvent.GetPointer()))
185 QVTKOpenGLWidget::mouseReleaseEvent(me);
188 if (m_ResendQtEvents)
205 QVTKOpenGLWidget::mouseMoveEvent(me);
217 QVTKOpenGLWidget::wheelEvent(we);
220 if (m_ResendQtEvents)
229 std::string key = GetKeyLetter(ke);
234 QVTKOpenGLWidget::keyPressEvent(ke);
237 if (m_ResendQtEvents)
246 QVTKOpenGLWidget::enterEvent(e);
255 if (
nullptr != m_MenuWidget)
260 QVTKOpenGLWidget::leaveEvent(e);
265 QVTKOpenGLWidget::resizeGL(w, h);
271 if (event->mimeData()->hasFormat(
"application/x-mitk-datanodes"))
280 if (!dataNodeList.empty())
282 emit
NodesDropped(
this, dataNodeList.toVector().toStdVector());
288 if (
nullptr != m_MenuWidget)
295 void QmitkRenderWindow::DeferredHideMenu()
297 MITK_DEBUG <<
"QmitkRenderWindow::DeferredHideMenu";
299 if (
nullptr != m_MenuWidget)
305 mitk::Point2D QmitkRenderWindow::GetMousePosition(QMouseEvent *me)
const 314 mitk::Point2D QmitkRenderWindow::GetMousePosition(QWheelEvent *we)
const 326 switch (me->button())
331 case Qt::RightButton:
348 if (me->buttons() & Qt::LeftButton)
352 if (me->buttons() & Qt::RightButton)
356 if (me->buttons() & Qt::MidButton)
367 if (me->modifiers() & Qt::ALT)
371 if (me->modifiers() & Qt::CTRL)
375 if (me->modifiers() & Qt::SHIFT)
386 if (we->buttons() & Qt::LeftButton)
390 if (we->buttons() & Qt::RightButton)
394 if (we->buttons() & Qt::MidButton)
401 std::string QmitkRenderWindow::GetKeyLetter(QKeyEvent *ke)
const 404 std::string key =
"";
405 int tkey = ke->key();
408 key = (char)toupper(tkey);
499 int QmitkRenderWindow::GetDelta(QWheelEvent *we)
const static const std::string KeyF1
void LayoutDesignChanged(QmitkRenderWindowMenu::LayoutDesign)
static const std::string KeyF12
virtual bool HandleEvent(InteractionEvent *interactionEvent)
static const std::string KeyF9
void NodesDropped(QmitkRenderWindow *thisWindow, std::vector< mitk::DataNode *> nodes)
Emits a signal to say that this window has had the following nodes dropped on it. ...
void dropEvent(QDropEvent *event) override
If the dropped type is application/x-mitk-datanodes we process the request by converting to mitk::Dat...
static const std::string KeyF4
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd, MouseButtons _arge)
static const std::string KeyPos1
void dragEnterEvent(QDragEnterEvent *event) override
Simply says we accept the event type.
static const std::string KeyF10
static const std::string KeyEsc
static const std::string KeyArrowLeft
static const std::string KeySpace
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd, MouseButtons _arge)
QmitkRenderWindowMenu::LayoutIndex GetLayoutIndex()
static QList< mitk::DataNode * > ToDataNodePtrList(const QByteArray &ba)
static const std::string KeyEnd
void mouseReleaseEvent(QMouseEvent *event) override
void ActivateMenuWidget(bool state)
void leaveEvent(QEvent *) override
static const std::string KeyArrowRight
static const std::string KeyEnter
void showEvent(QShowEvent *event) override
static const std::string KeyF7
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd, int _arge)
static const std::string KeyArrowDown
static const std::string KeyF2
static const std::string KeyF11
static Pointer New(BaseRenderer *_arga, const std::string &_argb, ModifierKeys _argc)
void enterEvent(QEvent *) override
mitk::VtkPropRenderer::Pointer m_Renderer
static RenderingManager * GetInstance()
QmitkRenderWindow(QWidget *parent=nullptr, const QString &name="unnamed renderwindow", mitk::VtkPropRenderer *renderer=nullptr)
static const std::string KeyInsert
void wheelEvent(QWheelEvent *) override
void CrosshairRotationModeChanged(int)
void LayoutDesignListChanged(QmitkRenderWindowMenu::LayoutDesign layoutDesign)
void Initialize(const char *name="unnamed renderer")
virtual void SetResendQtEvents(bool resend)
Whether Qt events should be passed to parent (default: true)
void mouseDoubleClickEvent(QMouseEvent *event) override
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd)
~QmitkRenderWindow() override
void CrosshairVisibilityChanged(bool)
void keyPressEvent(QKeyEvent *event) override
void ForceImmediateUpdate(vtkRenderWindow *renderWindow)
static const std::string KeyDelete
static const std::string KeyF5
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd, MouseButtons _arge)
void moveEvent(QMoveEvent *event) override
void mouseMoveEvent(QMouseEvent *event) override
ViewDirection
Possible view directions for render windows.
void resizeGL(int w, int h) override
static Pointer New(BaseRenderer *_arga, DataInteractor *_argb, const std::string &_argc)
static const std::string KeyF6
void mousePressEvent(QMouseEvent *event) override
static const std::string KeyF3
static const std::string KeyF8
static const std::string KeyPageDown
static const std::string KeyReturn
void SetLayoutIndex(QmitkRenderWindowMenu::LayoutIndex layoutIndex)
static const std::string KeyArrowUp
void AdjustRenderWindowMenuVisibility(const QPoint &pos)
static const std::string KeyPageUp