27 #include <QDragEnterEvent>
30 #include <QMouseEvent>
31 #include <QResizeEvent>
32 #include <QSurfaceFormat>
34 #include <QWheelEvent>
45 : QVTKWidget(parent), m_ResendQtEvents(true), m_MenuWidget(NULL), m_MenuWidgetActivated(false), m_LayoutIndex(0)
53 QSurfaceFormat surfaceFormat = windowHandle()->format();
54 surfaceFormat.setStencilBufferSize(8);
55 windowHandle()->setFormat(surfaceFormat);
59 GetRenderWindow()->SetMultiSamples(0);
60 GetRenderWindow()->SetAlphaBitPlanes(1);
64 GetRenderWindow()->SetMultiSamples(8);
68 GetRenderWindow()->SetMultiSamples(0);
71 Initialize(renderingManager, name.toStdString().c_str(), renderingMode);
73 setFocusPolicy(Qt::StrongFocus);
74 setMouseTracking(
true);
84 m_ResendQtEvents = resend;
89 m_LayoutIndex = layoutIndex;
118 QVTKWidget::mousePressEvent(me);
121 if (m_ResendQtEvents)
133 QVTKWidget::mousePressEvent(me);
136 if (m_ResendQtEvents)
146 if (!this->
HandleEvent(mReleaseEvent.GetPointer()))
148 QVTKWidget::mouseReleaseEvent(me);
151 if (m_ResendQtEvents)
166 QVTKWidget::mouseMoveEvent(me);
178 QVTKWidget::wheelEvent(we);
181 if (m_ResendQtEvents)
188 std::string key = GetKeyLetter(ke);
193 QVTKWidget::keyPressEvent(ke);
196 if (m_ResendQtEvents)
203 QVTKWidget::enterEvent(e);
208 MITK_DEBUG <<
"QmitkRenderWindow::DeferredHideMenu";
223 QVTKWidget::leaveEvent(e);
234 QVTKWidget::moveEvent(event);
242 QVTKWidget::showEvent(event);
246 QTimer::singleShot(0,
this, SIGNAL(
moved()));
251 m_MenuWidgetActivated = state;
253 if (!m_MenuWidgetActivated && m_MenuWidget)
256 disconnect(m_MenuWidget, SIGNAL(SignalChangeLayoutDesign(
int)),
this, SLOT(
OnChangeLayoutDesign(
int)));
263 else if (m_MenuWidgetActivated && !m_MenuWidget)
270 connect(m_MenuWidget, SIGNAL(SignalChangeLayoutDesign(
int)),
this, SLOT(
OnChangeLayoutDesign(
int)));
309 if (event->mimeData()->hasFormat(
"application/x-mitk-datanodes"))
318 if (!dataNodeList.empty())
320 emit
NodesDropped(
this, dataNodeList.toVector().toStdVector());
324 mitk::Point2D QmitkRenderWindow::GetMousePosition(QMouseEvent *me)
const
333 mitk::Point2D QmitkRenderWindow::GetMousePosition(QWheelEvent *we)
const
345 switch (me->button())
350 case Qt::RightButton:
367 if (me->buttons() & Qt::LeftButton)
371 if (me->buttons() & Qt::RightButton)
375 if (me->buttons() & Qt::MidButton)
386 if (me->modifiers() & Qt::ALT)
390 if (me->modifiers() & Qt::CTRL)
394 if (me->modifiers() & Qt::SHIFT)
405 if (we->buttons() & Qt::LeftButton)
409 if (we->buttons() & Qt::RightButton)
413 if (we->buttons() & Qt::MidButton)
420 std::string QmitkRenderWindow::GetKeyLetter(QKeyEvent *ke)
const
423 std::string key =
"";
424 int tkey = ke->key();
427 key = (char)toupper(tkey);
518 int QmitkRenderWindow::GetDelta(QWheelEvent *we)
const
static const std::string KeyF1
static const std::string KeyF12
virtual bool HandleEvent(InteractionEvent *interactionEvent)
void LayoutDesignListChanged(int layoutDesignIndex)
static const std::string KeyF9
void FullScreenMode(bool state)
virtual 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
void ChangeCrosshairRotationMode(int)
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd, MouseButtons _arge)
static const std::string KeyPos1
virtual 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
void HideRenderWindowMenu()
static const std::string KeySpace
void SignalLayoutDesignChanged(int layoutDesignIndex)
QmitkRenderWindow(QWidget *parent=0, QString name="unnamed renderwindow", mitk::VtkPropRenderer *renderer=NULL, mitk::RenderingManager *renderingManager=NULL, mitk::BaseRenderer::RenderingMode::Type renderingMode=mitk::BaseRenderer::RenderingMode::Standard)
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd, MouseButtons _arge)
void SetLayoutIndex(unsigned int layoutIndex)
static QList< mitk::DataNode * > ToDataNodePtrList(const QByteArray &ba)
static const std::string KeyEnd
virtual void mouseReleaseEvent(QMouseEvent *event) override
void OnWidgetPlaneModeChanged(int)
virtual 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)
virtual void enterEvent(QEvent *) override
virtual mitk::RenderingManager * GetRenderingManager() const
Setter for the RenderingManager that handles this instance of BaseRenderer.
Manager for coordinating the rendering process.
mitk::VtkPropRenderer::Pointer m_Renderer
virtual void paintEvent(QPaintEvent *event) override
static const std::string KeyInsert
virtual void wheelEvent(QWheelEvent *) override
virtual ~QmitkRenderWindow()
virtual void SetResendQtEvents(bool resend)
Whether Qt events should be passed to parent (default: true)
virtual void mouseDoubleClickEvent(QMouseEvent *event) override
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd)
virtual mitk::VtkPropRenderer * GetRenderer()
virtual void keyPressEvent(QKeyEvent *event) override
static const std::string KeyDelete
static const std::string KeyF5
void RequestUpdate(vtkRenderWindow *renderWindow)
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd, MouseButtons _arge)
virtual void moveEvent(QMoveEvent *event) override
virtual void mouseMoveEvent(QMouseEvent *event) override
void OnChangeLayoutDesign(int layoutDesignIndex)
void Initialize(mitk::RenderingManager *renderingManager=NULL, const char *name="unnamed renderer", mitk::BaseRenderer::RenderingMode::Type renderingMode=mitk::BaseRenderer::RenderingMode::Standard)
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. ...
unsigned int GetLayoutIndex()
static Pointer New(BaseRenderer *_arga, DataInteractor *_argb, const std::string &_argc)
void ActivateMenuWidget(bool state, QmitkStdMultiWidget *stdMultiWidget=0)
static const std::string KeyF6
virtual 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
static const std::string KeyArrowUp
void AdjustRenderWindowMenuVisibility(const QPoint &pos)
static const std::string KeyPageUp