Problem with QObjectPicker and Qt 5.9
First time posting. Please forgive my mistakes.
Until last week, I was using Qt 5.8. In a function I had this code:
Qt3DRender::QObjectPicker *picker1 = new Qt3DRender::QObjectPicker(m_planetEarth); picker1->setHoverEnabled(false); picker1->setEnabled(true); connect(picker1, &Qt3DRender::QObjectPicker::pressed, this, &Q3DMapWidget::onPressed); connect(picker1, &Qt3DRender::QObjectPicker::released, this, &Q3DMapWidget::onReleased); m_planetEarth->addComponent(picker1);
It worked fine, and I was able to control my entity with the picker.
Three days ago I updated to 5.9, and the slots are not working anymore. I try to press on the picker object but there's no response.
Thanks everyone in advance for your time and help.
@gonssoruiz Do you mean the slots are not called? Did you verify connect() succeeded? Like
qDebug() << connect(picker1, &Qt3DRender::QObjectPicker::pressed, this, &Q3DMapWidget::onPressed);
Yes, it shows true.
The problem revealed itself when I changed from 5.8 to 5.9.
It was solved using:
Qt3DRender::QRenderSettings *settings = (Qt3DRender::QRenderSettings*) activeFrameGraph()->parent(); if (settings) settings->pickingSettings()->setPickMethod(Qt3DRender::QPickingSettings::TrianglePicking);