PDA

View Full Version : Qt3DRender: Applying QPickingSettings to QObjectPicker



hhughe11
11th July 2017, 16:23
I am using a QObjectPicker to select a 3D mesh on a Qt3DWindow. I am getting "clicked" signals when I click near the object but not actually on it, and this is an issue. I believe that if I change the QPickingSettings::PickMethod to TrianglePicking instead of the default setting of BoundingVolumePicking, it will fix this issue. Is this a reasonable assumption? The PickMethod settings are handled in the QPickingSettings class while object selection is handled in the QObjectPicker class. How do I attach the desired settings in the QPickingSettings class to the QObjectPicker class? I am using Qt5. Any help would be greatly appreciated, I am completely stuck!


Qt3DRender::QObjectPicker *MeshGraphics::createObjectPicker()
{
Qt3DRender::QObjectPicker *picker = new Qt3DRender::QObjectPicker();

Qt3DRender::QPickingSettings *settings = new Qt3DRender::QPickingSettings(picker);

settings->setFaceOrientationPickingMode(Qt3DRender::QPicking Settings::FrontFace);
settings->setPickMethod(Qt3DRender::QPickingSettings::Triang lePicking);
settings->setPickResultMode(Qt3DRender::QPickingSettings::Ne arestPick);

QObject::connect(picker, SIGNAL(clicked(Qt3DRender::QPickEvent*)), this, SLOT(pickMesh(Qt3DRender::QPickEvent*)));

return picker;
}