diff --git a/Modules/QmlMitk/QmlMitkBigRenderLock.h b/Modules/QmlMitk/QmlMitkBigRenderLock.h index 7037e48fba..3a4bd52aaa 100644 --- a/Modules/QmlMitk/QmlMitkBigRenderLock.h +++ b/Modules/QmlMitk/QmlMitkBigRenderLock.h @@ -1,21 +1,33 @@ #ifndef QmlMitkBigRenderLock_h #define QmlMitkBigRenderLock_h #include #include "QmlMitkExports.h" +/** + \brief Workaround lock around MITK rendering. + + QtQuick renders in a thread, MITK datastructures do not + tolerate this well. The current work-around is a big + lock that delays signal delivery while rendering is in + progress. + + The proper solution would be to make data structures + in rendering thread safe. This solution is much more + work though, so it will come later. +*/ class QmlMitk_EXPORT QmlMitkBigRenderLock : public QObject { Q_OBJECT public: static QMutex& GetMutex(); QmlMitkBigRenderLock(QObject* parent = 0); protected: bool eventFilter(QObject *obj, QEvent *event); }; #endif diff --git a/Modules/QmlMitk/QmlMitkFourRenderWindowWidget.h b/Modules/QmlMitk/QmlMitkFourRenderWindowWidget.h index a9527048aa..41d486fc22 100644 --- a/Modules/QmlMitk/QmlMitkFourRenderWindowWidget.h +++ b/Modules/QmlMitk/QmlMitkFourRenderWindowWidget.h @@ -1,50 +1,58 @@ #ifndef QmlMitkFourRenderWindowWidget_h #define QmlMitkFourRenderWindowWidget_h #include #include "QmlMitkRenderWindowItem.h" #include "mitkDataStorage.h" #include "QmlMitkExports.h" +/** + \brief QML replacement for QmitkStdMultiWidget. + + A proof-of-concept "multi-widget". Currently exclusively + for use in the QuickRender demo application. + + \warning Subject to change. +*/ class QmlMitk_EXPORT QmlMitkFourRenderWindowWidget : public QQuickItem { Q_OBJECT public: QmlMitkFourRenderWindowWidget(QQuickItem* parent = 0); virtual ~QmlMitkFourRenderWindowWidget(); void SetDataStorage( mitk::DataStorage::Pointer storage ); signals: public slots: protected slots: protected: virtual void SetupWidget( QQuickItem* parent ); virtual void InitializeMoveZoomInteraction(); mitk::DataStorage::Pointer m_DataStorage; private slots: private: QQuickItem* m_ChildrenContainer; QmlMitkRenderWindowItem* m_RenderItemAxial; QmlMitkRenderWindowItem* m_RenderItemSagittal; QmlMitkRenderWindowItem* m_RenderItemFrontal; QmlMitkRenderWindowItem* m_RenderItem3D; }; #endif diff --git a/Modules/QmlMitk/QmlMitkRenderWindowItem.h b/Modules/QmlMitk/QmlMitkRenderWindowItem.h index 8ab3e0c368..435292d0ef 100644 --- a/Modules/QmlMitk/QmlMitkRenderWindowItem.h +++ b/Modules/QmlMitk/QmlMitkRenderWindowItem.h @@ -1,79 +1,87 @@ #ifndef QmlMitkRenderWindowItem_h #define QmlMitkRenderWindowItem_h #include #include "mitkRenderWindowBase.h" #include #include "QmlMitkExports.h" +/** + \brief QML replacement for QmitkRenderWindow. + + A proof-of-concept render window. Currently exclusively + for use in the QuickRender demo application. + + \warning Subject to change. +*/ class QmlMitk_EXPORT QmlMitkRenderWindowItem : public QVTKQuickItem, public mitk::RenderWindowBase { Q_OBJECT public: static QmlMitkRenderWindowItem* GetInstanceForVTKRenderWindow( vtkRenderWindow* rw ); QmlMitkRenderWindowItem(QQuickItem* parent = 0, const QString& name = "QML render window", mitk::VtkPropRenderer* renderer = NULL, mitk::RenderingManager* renderingManager = NULL); virtual vtkRenderWindow* GetVtkRenderWindow(); virtual vtkRenderWindowInteractor* GetVtkRenderWindowInteractor(); void SetDataStorage(mitk::DataStorage::Pointer storage); void InitView( mitk::BaseRenderer::MapperSlotId mapperID, mitk::SliceNavigationController::ViewDirection viewDirection ); void SetPlaneNodeParent( mitk::DataNode::Pointer node ); void SetCrossHairPositioningOnClick(bool enabled); signals: public slots: protected slots: protected: virtual void init(); virtual void prepareForRender(); virtual void cleanupAfterRender(); mitk::Point2D GetMousePosition(QMouseEvent* me) const; mitk::Point2D GetMousePosition(QWheelEvent* we) const; mitk::InteractionEvent::MouseButtons GetEventButton(QMouseEvent* me) const; mitk::InteractionEvent::MouseButtons GetButtonState(QMouseEvent* me) const; mitk::InteractionEvent::ModifierKeys GetModifiers(QInputEvent* me) const; mitk::InteractionEvent::MouseButtons GetButtonState(QWheelEvent* we) const; void geometryChanged(const QRectF & newGeometry, const QRectF & oldGeometry); // !? virtual void mousePressEvent(QMouseEvent* e); virtual void mouseReleaseEvent(QMouseEvent* e); virtual void mouseMoveEvent(QMouseEvent* e); virtual void wheelEvent(QWheelEvent* e); private slots: private: mitk::DataStorage::Pointer m_DataStorage; mitk::DataNode::Pointer m_PlaneNodeParent; mitk::BaseRenderer::MapperSlotId m_MapperID; mitk::SliceNavigationController::ViewDirection m_ViewDirection; QTimer m_Animation; vtkSmartPointer m_connect; static QMap& GetInstances(); }; #endif diff --git a/Modules/QmlMitk/README b/Modules/QmlMitk/README new file mode 100644 index 0000000000..8de729e147 --- /dev/null +++ b/Modules/QmlMitk/README @@ -0,0 +1,4 @@ +This module is meant to provide the functionality of QmitkRenderWindow in QML at some time. + +In the current state, this module is just a proof-of-concept and should not be used outside +experimental code. It is subject to substantial change, so do not rely on the current state.