this is my code
class QVTKWindow : public QVTKOpenGLNativeWidget
impl->renderer = vtkSmartPointer::New();/
impl->renderWindow = vtkSmartPointer::New();
impl->renderWindow->AddRenderer(impl->renderer);
impl->viewer.reset(new pcl::visualization::PCLVisualizer(impl->renderer, impl->renderWindow, “viewer”, false));
this->setRenderWindow(impl->viewer->getRenderWindow());
impl->viewer->setupInteractor(this->interactor(), this->renderWindow());
below is boxwidget2 show code
vtkNew<vtkNamedColors> colors;
vtkNew<vtkConeSource> coneSource;
coneSource->SetHeight(1.5);
vtkNew<vtkPolyDataMapper> mapper;
mapper->SetInputConnection(coneSource->GetOutputPort());
vtkNew<vtkActor> actor;
actor->SetMapper(mapper);
actor->GetProperty()->SetColor(colors->GetColor3d("BurlyWood").GetData());
vtkSmartPointer<vtkBoxWidget2> boxWidget= vtkSmartPointer<vtkBoxWidget2>::New();
boxWidget->SetInteractor(this->interactor());
boxWidget->GetRepresentation()->SetPlaceFactor(2); // Default is 0.5
boxWidget->GetRepresentation()->PlaceWidget(actor->GetBounds());
// Set up a callback for the interactor to call so we can manipulate the actor
vtkSmartPointer<vtkBoxCallback> boxCallback= vtkSmartPointer<vtkBoxCallback>::New();
boxCallback->SetActor(actor);
boxWidget->AddObserver(vtkCommand::InteractionEvent, boxCallback);
boxWidget->On();
impl->renderer->AddActor(actor);
impl->renderWindow->Render();
How can I modify the code to solve this problem?