split viewport for Qt and VtkViewer

This commit is contained in:
AndreaRigoni
2026-03-17 15:29:07 +00:00
parent 4569407d18
commit e6e0bccffb
7 changed files with 345 additions and 233 deletions

View File

@@ -12,6 +12,8 @@
#include "uLibVtkInterface.h"
#include "vtkViewport.h"
class vtkProp;
class vtk3DWidget;
class vtkRenderWindowInteractor;
@@ -25,42 +27,24 @@ namespace Vtk {
* directly into the Qt application (no separate VTK window).
* Puppets and actors are added to the embedded renderer.
*/
class QViewport : public QWidget {
class QViewport : public QWidget, public Viewport {
Q_OBJECT
public:
explicit QViewport(QWidget* parent = nullptr);
virtual ~QViewport();
// Render scene
void Render();
void Reset();
void ZoomAuto();
// Puppet / prop management
void AddPuppet(Puppet &prop);
void RemovePuppet(Puppet &prop);
void addProp(vtkProp *prop);
void RemoveProp(vtkProp *prop);
// Widget integration
void AddWidget(vtk3DWidget *widget);
virtual void Render() override;
// Direct access to VTK internals
vtkRenderer* GetRenderer() { return m_Renderer; }
vtkRenderWindow* GetRenderWindow();
vtkRenderWindowInteractor* GetInteractor();
vtkCornerAnnotation* GetAnnotation() { return m_Annotation; }
vtkCameraOrientationWidget* GetCameraWidget(){ return m_CameraWidget; }
virtual vtkRenderWindow* GetRenderWindow() override;
virtual vtkRenderWindowInteractor* GetInteractor() override;
QVTKOpenGLNativeWidget* GetWidget() { return m_VtkWidget; }
private:
void SetupPipeline();
QVTKOpenGLNativeWidget* m_VtkWidget;
vtkRenderer* m_Renderer;
vtkCornerAnnotation* m_Annotation;
vtkOrientationMarkerWidget* m_Marker;
vtkCameraOrientationWidget* m_CameraWidget;
};
} // namespace Vtk