QScene2D 類

( Qt3DRender::Quick::QScene2D )

這個類使能夠將 QML 渲染成紋理,然後可以用作 3D 場景的一部分。 更多...

頭: #include <Qt3DQuickScene2D/QScene2D>
qmake: QT += 3dquickscene2d
Since: Qt 5.9
實例化: Scene2D
繼承: Qt3DCore::QNode

公共類型

enum RenderPolicy { Continuous, SingleShot }

特性

公共函數

QScene2D (Qt3DCore::QNode * parent = nullptr)
void addEntity (Qt3DCore::QEntity * entity )
QVector<Qt3DCore::QEntity *> entities ()
bool isMouseEnabled () const
QQuickItem * item () const
Qt3DRender::QRenderTargetOutput * output () const
void removeEntity (Qt3DCore::QEntity * entity )
QScene2D::RenderPolicy renderPolicy () const

公共槽

void setItem (QQuickItem * item )
void setMouseEnabled (bool enabled )
void setOutput (Qt3DRender::QRenderTargetOutput * output )
void setRenderPolicy (QScene2D::RenderPolicy policy )

信號

void itemChanged (QQuickItem * item )
void mouseEnabledChanged (bool enabled )
void outputChanged (Qt3DRender::QRenderTargetOutput * output )
void renderPolicyChanged (QScene2D::RenderPolicy policy )

額外繼承成員

詳細描述

這個類使能夠將 QML 渲染成紋理,然後可以用作 3D 場景的一部分。

This class uses QQuickRenderControl to render the given QQuickItem into an offscreen surface, which is attached to a texture provided by the user. This allows the component to directly render into the texture without intermediate copy and the user to freely specify how the texture is used in the 3D scene.

The entities using the QScene2D can be associated with the class to enable interaction with the item; if an entity has a QObjectPicker component, the pick events from that picker are sent to the QScene2D and converted to mouse events and finally sent to the item.

成員類型文檔編製

enum QScene2D:: RenderPolicy

This enum type describes types of render policies available.

常量 描述
Qt3DRender::Quick::QScene2D::Continuous 0 The Scene2D is rendering continuously. This is the default render policy.
Qt3DRender::Quick::QScene2D::SingleShot 1 The Scene2D renders to the texture only once after which the resources allocated for rendering are released.

特性文檔編製

item : QQuickItem *

保持 QQuickItem , which is rendered by QScene2D 到紋理。

訪問函數:

QQuickItem * item () const
void setItem (QQuickItem * item )

通知程序信號:

void itemChanged (QQuickItem * item )

mouseEnabled : bool

Holds whether mouse events are enabled for the rendered item. The mouse events are generated from object picking events of the entities added to the QScene2D . Mouse is enabled by default.

注意: Events are delayed by one frame due to object picking happening in the backend.

訪問函數:

bool isMouseEnabled () const
void setMouseEnabled (bool enabled )

通知程序信號:

void mouseEnabledChanged (bool enabled )

output : Qt3DRender::QRenderTargetOutput *

保持 QRenderTargetOutput , which specifies where the QScene2D is rendering to.

訪問函數:

Qt3DRender::QRenderTargetOutput * output () const
void setOutput (Qt3DRender::QRenderTargetOutput * output )

通知程序信號:

void outputChanged (Qt3DRender::QRenderTargetOutput * output )

renderPolicy : QScene2D::RenderPolicy

Holds the render policy of this Scene2D .

訪問函數:

QScene2D::RenderPolicy renderPolicy () const
void setRenderPolicy (QScene2D::RenderPolicy policy )

通知程序信號:

void renderPolicyChanged (QScene2D::RenderPolicy policy )

成員函數文檔編製

QScene2D:: QScene2D ( Qt3DCore::QNode * parent = nullptr)

The constructor creates a new QScene2D instance with the specified parent .

void QScene2D:: addEntity ( Qt3DCore::QEntity * entity )

添加 entity to the the QScene2D object. If the entities have QObjectPicker , the pick events from that entity are sent to QScene2D and converted to mouse events.

QVector < Qt3DCore::QEntity *> QScene2D:: entities ()

Retrieve entities associated with the QScene2D .

void QScene2D:: removeEntity ( Qt3DCore::QEntity * entity )

Removes an entity from the the QScene2D 對象。