XrItem QML Type

A virtual surface in 3D space that can hold 2D user interface content. 更多...

import 语句: import QtQuick3D.Xr
Since: Qt 6.8
继承:

Node

状态: 技术预览

特性

详细描述

The XrItem type is a Qt Quick 3D Node that represents a rectangle with width and height . It holds one Qt Quick Item , specified by contentItem , and scales it to fit. This gives a convenient way to take traditional 2D user interfaces and display them on a virtual surface that has a real world size.

Any other children of the XrItem will be treated as normal children of a Node, and will not be scaled.

For example the following code will create a virtual surface that's 1 meter by 1 meter and with a content item that's 600 pixels by 600 pixels. Note that the effect here is achieved by scaling the content item and not by rendering the content item at a higher resolution.

XrItem {
    width: 100
    height: 100
    contentItem: Rectangle {
        width: 600
        height: 600
        color: "red"
    }
}
					

特性文档编制

automaticHeight : bool [default: "false"]

When set to true XrItem will ignore height set through height property and use height calculated from contentItem height.

另请参阅 automaticWidth .

automaticWidth : bool [default: "false"]

When set to true XrItem will ignore width set through width property and use width calculated from contentItem width.

另请参阅 automaticHeight .

color : color [default: "white"]

This property defines the background color of the XrItem .

contentItem : Item

This property holds the content item that will be displayed on the virtual surface. The content item's size will be used to calculate the pixels per unit value and scale based on this item's size.

另请参阅 pixelsPerUnit .

height : real

This property defines the height of the XrItem in the 3D coordinate system.

另请参阅 width .

manualPixelsPerUnit : bool [default: false]

若此特性为 true , the ratio between the contentItems's 2D coordinate system and this XrItem 's 3D coordinate system is defined by the value of pixelsPerUnit . If this property is false , the ratio is calculated based on the content item's size and the size of the XrItem .

另请参阅 pixelsPerUnit .

pixelsPerUnit : real

This property determines how many pixels in the contentItems's 2D coordinate system will fit in one unit of the XrItem 's 3D coordinate system. By default, this is calculated based on the content item's size and the size of the XrItem .

Set manualPixelsPerUnit to disable the default behavior and set the pixels per unit value manually.

另请参阅 manualPixelsPerUnit .

width : real

This property defines the width of the XrItem in the 3D coordinate system.

另请参阅 height .