Important: Please read the Qt Code of Conduct -

How do I use QMouseDevice and QMouseHandler

  • I have a simple Qt3DCore::QEntity (sphere mesh, material, and transform) that I'm showing in a Qt3DExtras::Qt3DWindow view. I'd like to handle events for mouse clicks on this entity in the view. Ideally, I want to stay in the Qt3D framework for doing this. I've tried various combinations of QMouseDevice + QMouseHandler, but I can't seem to receive notifications from the QMouseHandler slots (entered, exited, pressed, clicked).

    I have not found any examples online and the documentation is lacking. I'm on windows, using vs 2017 with qt 5.9.1.

    All I need to get me going is a simple example of how to hook up QMouseDevice/Handler to an entity.

  • I don't know why this approach didn't work for me, but I stumbled across Qt3DRender::QObjectPicker, which accomplishes what I want.

  • It didn't work for me, either. Let me try!

Log in to reply