Qt3d Input in c++



  • Is it possible to do handle mouse input in qt3d in c++? I am able to do so using qml using a sample in the qt3d repo
    https://github.com/qtproject/qt3d/tree/5.6/examples/qt3d/mouseinput-qml
    There isnt a c++ equivalent for this however.

    I am not able to do capture mouse events in c++ at all despite numerous attempts (even trying to capture input using event filters attached to various widgets) . Is the c++ mouse input api for qt3d complete for this version of qt (5.6) or should i wait for version 5.7?


  • Qt Champions 2016

    @njbrown
    I experimented with that a few months ago, but the API has (probably) changed from then. I'm not completely sure at what state it is currently, but here's my exchange with Sean I hope it's of help. This might also be helpful.



  • @njbrown
    For capturing mouse event on any Entity in just add one component Qt3DRender::QObjectPicker() and connect this component with your slot where you want to handle mouse event .

    QObject::connect(m_objectPicker,SIGNAL(clicked(Qt3DRender::QPickEvent*)),this,SLOT(onClicked(Qt3DRender::QPickEvent*)));
    

    I hope this is what you want.



  • The new qt3d update fixed the input api for c++.

    Thanks for the help guys.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.