Unsolved Get x y z of a Cursor?
-
Hi everyone,
I am writing a simple application that can move objects in STL format in three-dimensional space. In this regard, I looked in the Qt documentation and there is the QCursor class which allows me to obtain the x and y coordinates. I wish I could also detect the z coordinate. Is there a class that I can use? I'm using C++, anywayI'm really new to Qt, using it only just a month.
-
Hi,
You might want to add what you are currently using to show your STL model.
In any case, QCursor is not meant for 3D modeling, it's really a "desktop" cursor.
-
Hi
Did you have a look at this ?
https://doc.qt.io/qt-5/qt3drender-qobjectpicker.html#details -
@mrjj yes
at the moment, I used void QObjectPicker::moved(Qt3DRender::QPickEvent *pick) where pick contains details of the event. In this, I use setTranslation of Qt3DCore::QTransform like this (using also QCursor):globalComponentLightTransform->setTranslation(QVector3D(globalComponentLightTransform->translation().x() + (QCursor::pos().x()-m_storedMousePosition.x()), globalComponentLightTransform->translation().y() + (m_storedMousePosition.y()-QCursor::pos().y()), globalComponentLightTransform->translation().z()));
QCursor::pos().z() doesn't exist as you know
-
@giusirux
QCursor is for 2d so that expected. -
Yes, unfortunately for me
I need a class that could also read the z coordinate when I pass the cursor over the STL image so I can also move it according to this size.
Any suggestions?EDIT: I was wrong to answer, sorry
for @SGaist I used something like that https://forum.qt.io/topic/85670/how-to-load-an-stl-file-using-qmesh .I added a piece of code where I used setTranslation of Qt3DCore::QTransform