[Interest] How to select objects with Qt3D? (QMouseHandler question)
Edward.Moyse at cern.ch
Wed Jul 6 10:26:27 CEST 2016
I’m trying to play with Qt3d (in Qt5.7), and I'm struggling with the lack of documentation and/or tutorials (and so I apologise in advance if this is an obvious question).
What I wanted to test is how easy it is to click in the 3D view and select an object.
If I understand correctly, I should do this using a QMouseHandler and add this to the entity.
To test this, I modified the basic shapes example as follows:
in the initialisation list of SceneModifier I added:
and in the rest of the ctor it now looks like:
m_sphereEntity = new Qt3DCore::QEntity(m_rootEntity);
// QObject::connect(mouseHandler, SIGNAL(clicked(Qt3DInput::QMouseEvent*)),
// this, SLOT(clicked(Qt3DInput::QMouseEvent*)));
And I also added a new method:
void SceneModifier::clicked(Qt3DInput::QMouseEvent* event)
qDebug() << "clicked!";
However the function never gets called - I suspect I’ve missed something very obvious, but if so I’d really appreciate any tips and/or links to anything else to read.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Interest