I want to get mouse events (like mouse position) on a Qt3D Window, every time I click inside the window.
I\'ve seen this question (also the same question on this for
Normally the "mouseMoveEvent" is bind with a Qwidget.
This is the source code of Qt3DInput::QmouseEvent
:
class QT3DINPUTSHARED_EXPORT QMouseEvent : public QObject {
Q_OBJECT
private:
QT_PREPEND_NAMESPACE(QMouseEvent) m_event;
};
m_event has already contained the information of your mouse and it should be automatically processed.
Mouse events occur when a mouse button is pressed or released inside a widget, or when the mouse cursor is moved.
So, I don't think you need to create a new Qt3DInput::QMouseDevice
. And you shouldn't do Qt3DInput::QMouseEvent *e
; since the widget will get it automatically.
I don't know how to use mouseEvent without overriding it inside of a Qwidget, and Qt3DExtras::Qt3DWindow view should contain a default mouseMoveEvent()
.
If you just want to print out an "ok", I suggest you don't write anything about mouseMoveEvent()
. If you hope something happens when your mouse is moving, you should override view's mouseMoveEvent()
.