Hi! I wrote resolution like @AlanWasHere, but a little clearer
void addLine(QEntity *parentEntity, const QVector3D &srcPos, const QVector3D &targPos)
{
auto edgeEntity = new QEntity{parentEntity};
auto cylinder = new QCylinderMesh{edgeEntity};
auto len = srcPos.distanceToPoint(targPos);
cylinder->setLength(len);
cylinder->setRadius(0.1f);
auto transPoint = targPos - srcPos;
auto xAngle = atan(sqrt(pow(transPoint.z(), 2) + pow(transPoint.x(), 2)) / transPoint.y()) / M_PI * 180;
auto yAngle = (transPoint.x() == 0 && transPoint.z() == 0) ? 0 : atan(transPoint.x() / transPoint.z()) / M_PI * 180;
auto transform = new Qt3DCore::QTransform{edgeEntity};
transform->setRotationX(xAngle);
transform->setRotationY(yAngle);
transform->setTranslation((srcPos + targPos) / 2);
auto material = new QPhongMaterial{edgeEntity};
material->setDiffuse("#ffff00");
edgeEntity->addComponent(cylinder);
edgeEntity->addComponent(transform);
edgeEntity->addComponent(material);
}