QVector3D myVector(1.0, 2.0, 3.0); myVector.setZ(4.0);
QVector3D myVector; myVector.setX(1.0); myVector.setY(2.0); myVector.setZ(3.0);This code creates a QVector3D object and sets its components individually using the setX, setY, and setZ methods. Package/library: Qt (QtCore module)