I have a QWidget containing Qt3DWindow (). I would like to be able to βscaleβ in QtEntity, in Qt3DWindow, using the mouse scroll wheel above the window.
I have functionality, but only when hovering the mouse outside the Qt3DWindow framework. Here is my code to initialize a window and handle mouse wheel events.
Window initialization:
mainView = new Qt3DExtras::Qt3DWindow(); mainView->defaultFramegraph()->setClearColor(QColor(QRgb(0x4d4d4f))); QWidget *container = QWidget::createWindowContainer(mainView);
Wheel event handling:
void ModelView::wheelEvent(QWheelEvent *event){ QVector3D vec; vec = cameraEntity->position() - modifier->m_transform->translation(); vec = vec.normalized(); QPoint delta = event->angleDelta(); int zoom_distance = delta.y()*0.01; vec = cameraEntity->position() - zoom_distance*vec; cameraEntity->setPosition(vec); }
What is the trick to overriding the capture of the mouse window when you hover over the Qt3DWindow frame?
Thanks in advance for your help.
qt qt3d
dsell002
source share