Vtk9.1 for Qml with QQuickvtkrenderItem have some issues.

Hi every developer , hope you can see this:

I found some issues when I use vtk9.1 and qml .Below is the one description :

  • When I add a cameraorientationwidget with QQuickVTKInteractiveWidget by use QQuickVTKRenderItem::addWidget(QQuickVTKInteractiveWidget* w) , and the widget not work normally , such like when the mouse hold on the actor on widget , The "X " or “Y” or “Z” do not highlight and click the actor it has no response, but it should rotate the camera .
  • When I debug the application I found that the actor cannot be selected by vtkhardwareselector , because everytime mouse event will lead to a pixel buffer set and release , but It should have render event between set and release buffer , and the reason why the render() work is the renderer is not correctly in vtkRenderer::PickProp() function , but I don’t know how and why I should do , I can not find any documents for this and there are no similar issue with this.
    Here is some code
m_QQuickvtkrenderItem = topLevel->findChild<MyQQuickVTKRenderItem*>("ConeView");
...
...
 vtkSmartPointer<vtkInteractorStyleTrackballCamera2> style = vtkSmartPointer<vtkInteractorStyleTrackballCamera2>::New();
    vtkNew<vtkRenderWindowInteractor> iRen;
    m_QQuickvtkrenderItem->renderWindow()->renderWindow()->GetInteractor()->SetInteractorStyle(style);
    style->SetDefaultRenderer(m_QQuickvtkrenderItem->renderer());
    style->setQtItem(this);
    QQuickVTKInteractiveWidget* interactorWidget = new QQuickVTKInteractiveWidget(m_QQuickvtkrenderItem->renderWindow());
    interactorWidget->setWidget(camOrientManipulator);
    interactorWidget->setEnabled(true);
    m_QQuickvtkrenderItem->addWidget(interactorWidget);
    camOrientManipulator->SetParentRenderer(m_QQuickvtkrenderItem->renderer());
    camOrientManipulator->SetInteractor(m_QQuickvtkrenderItem->renderWindow()->renderWindow()->GetInteractor());
    m_QQuickvtkrenderItem->renderWindow()->interactorAdapter()->SetEnableHover(true);
    m_QQuickvtkrenderItem->update();
    camOrientManipulator->EnabledOn();
    camOrientManipulator->On();`

And here is my project address , GitHub - dezbracaty/QtVtk9.1: A qt vtk demo with vtk 9.1

I hope someone can help me to resolve this issue and help more people to use vtk9.1 with qml .
Very thanks for everyone.

This is Application running interface :

Any one can help me to solve this problem ?
Very thanks any idea !

I think I know why this happen .
In class QQuickVTKRenderItem , it has two function

  virtual void sync();
  virtual void paint();

And all mouse event handled in sync function ,and in this function , it has a variable “ReadyForRendering” and it is always false when Sync() , and when mouse move to a actor like "x " or “Y” or “z” , it called a vtkhardwareSelector to select the path , and it is based on renderwindow’s pixelbuffer , but the pixelbuffer is always null because ReadyForRendering is false and not save pixelbuffers , so vtkhardwareSelector can not select a pixel and cannot get actor by path .
And in paint() function , it has this part of function :

this->m_renderWindow->SetReadyForRendering(true);
if (iren)
{
iren->Render();
}
else
{
this->m_renderWindow->Render();
}

if (this->m_screenshotScheduled)
{
this->m_screenshotFilter->SetInput(this->m_renderWindow);
this->m_screenshotFilter->SetReadFrontBuffer(false);
this->m_screenshotFilter->SetInputBufferTypeToRGB();
this->m_screenshotFilter->Update();
this->m_screenshotScheduled = false;
}
this->m_renderWindow->SetReadyForRendering(false);
As you can see , after paint function , the variable ReadyForRendering is set to false again , and the pixelbuffer is null too .
So , the reason why it cannot select the actor ,Mainly the problem of this sync and paint process , I don’t think this is an isolated case, I think many future users of qml vtk will encounter this problem.
Hope every one can see this and pay attention to this .

Okay, finally I solve this problem by replace propicker to cellpicker in vtkcameraorientationwidget .
Thanks every one .