To create a Qt Quick 3D UI project, we recommend using a Qt Quick 3D Application Template wizard template that imports the Qt Quick 3D QML types to the QML 类型 tab in Library and contains a 3D view. A 3D view type includes a scene environment as well as a scene light , camera ,和 model . A default material is attached to the model. You can attach textures to materials. For more information about creating projects, see 创建工程 .
To add a 3D view to some other kind of project and to display the Qt Quick 3D QML types in Library , select Library > QML 导入 > Add Import > QtQuick3D .
After importing the Qt Quick 3D QML types, drag and drop a View3D type to Navigator or to Form Editor .
By default, a directional light and a perspective camera are used in a 3D scene created by using the wizard template mentioned above. To use other light and camera types, select the component in 3D Editor or Navigator and change the type of the component in the Type field in 特性 . For example, to use a point light, enter PointLight .
Similarly to other components, you can select a 3D view in Navigator or 3D Editor and modify its property values in the 特性 view. Use the properties in the View3D tab to set some properties specific to a 3D view component.
The Camera property defines which camera is used to render the scene to Form Editor . If this property is not defined, the first enabled camera in the scene will be used.
The Environment property specifies the Scene Environment used to render the scene. By default, the first Scene Environment in the scene is set as the property value.
The Import Scene property defines the ID of the component to render to Form Editor . The component does not have to be a child of a 3D view type. This referenced component becomes a sibling to child items of a 3D view, if there are any. You can use this property, for example, to create a split screen view showing your scene from multiple cameras. For more information on how to to use a 3D view to show a scene from multiple cameras, see Qt Quick 3D - View3D 范例 .
注意: The Import Scene property can only be set once. Subsequent changes will have no effect.