68 lines
1.6 KiB
C++
68 lines
1.6 KiB
C++
#ifndef ULIB_VTK_QVIEWPORT_H
|
|
#define ULIB_VTK_QVIEWPORT_H
|
|
|
|
#include <QWidget>
|
|
#include <QVTKOpenGLNativeWidget.h>
|
|
#include <QPushButton>
|
|
|
|
#include <vtkCornerAnnotation.h>
|
|
#include <vtkOrientationMarkerWidget.h>
|
|
#include <vtkRenderer.h>
|
|
#include <vtkRenderWindow.h>
|
|
#include <vtkSmartPointer.h>
|
|
|
|
#include "uLibVtkInterface.h"
|
|
|
|
#include "vtkViewport.h"
|
|
|
|
class vtkProp;
|
|
class vtk3DWidget;
|
|
class vtkRenderWindowInteractor;
|
|
class vtkCameraOrientationWidget;
|
|
|
|
namespace uLib {
|
|
namespace Vtk {
|
|
|
|
/**
|
|
* QViewport is a self-contained Qt widget that embeds a VTK renderer
|
|
* directly into the Qt application (no separate VTK window).
|
|
* Puppets and actors are added to the embedded renderer.
|
|
*/
|
|
class QViewport : public QWidget, public Viewport {
|
|
Q_OBJECT
|
|
signals:
|
|
void puppetSelected(uLib::Vtk::Puppet* p);
|
|
public:
|
|
explicit QViewport(QWidget* parent = nullptr);
|
|
virtual ~QViewport();
|
|
|
|
// Render scene
|
|
virtual void Render() override;
|
|
|
|
// Direct access to VTK internals
|
|
virtual vtkRenderWindow* GetRenderWindow() override;
|
|
virtual vtkRenderWindowInteractor* GetInteractor() override;
|
|
QVTKOpenGLNativeWidget* GetWidget() { return m_VtkWidget; }
|
|
|
|
virtual void OnSelectionChanged(Puppet* p) override;
|
|
|
|
protected:
|
|
virtual void resizeEvent(QResizeEvent* event) override;
|
|
|
|
private slots:
|
|
void onGridButtonClicked();
|
|
void onProjButtonClicked();
|
|
|
|
private:
|
|
void SetupPipeline();
|
|
|
|
QVTKOpenGLNativeWidget* m_VtkWidget;
|
|
QPushButton* m_GridButton;
|
|
QPushButton* m_ProjButton;
|
|
};
|
|
|
|
} // namespace Vtk
|
|
} // namespace uLib
|
|
|
|
#endif // ULIB_VTK_QVIEWPORT_H
|