XrItem QML Type

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

Import Statement: import QtQuick3D.Xr
Since: Qt 6.8
Inherits:

Node

Status: Technical Preview

Properties

Signals

Detailed Description

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"
    }
}

Property Documentation

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.

See also pixelsPerUnit.


height : real

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

See also width.


manualPixelsPerUnit : bool [default: false]

If this property is 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.

See also 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.

See also manualPixelsPerUnit.


width : real

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

See also height.


Signal Documentation

colorChanged()

Emitted when the color property changes.

Note: The corresponding handler is onColorChanged.


contentItemChanged()

Emitted when the content item changes.

Note: The corresponding handler is onContentItemChanged.


flagsChanged()

Emitted when the flags property changes.

Note: The corresponding handler is onFlagsChanged.


heightChanged()

Emitted when the height property changes.

Note: The corresponding handler is onHeightChanged.


manualPixelsPerUnitChanged()

Emitted when the manual pixels per unit value changes.

Note: The corresponding handler is onManualPixelsPerUnitChanged.


pixelsPerUnitChanged()

Emitted when the pixels per unit value changes.

Note: The corresponding handler is onPixelsPerUnitChanged.


uiScaleChanged()

Emitted when the UI scale changes.

Note: The corresponding handler is onUiScaleChanged.


widthChanged()

Emitted when the width property changes.

Note: The corresponding handler is onWidthChanged.


© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.