Qt Quick 3D - Robot Arm Example
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Material
import QtQuick3D
import RobotArm
Item {
id: root
property real size: 100
property bool isFocused: true
property View3D view3D: parent
property vector3d scenePosition
property vector3d screenPosition
property alias label: label.text
x: screenPosition.x
y: screenPosition.y
visible: x > 0 && y > 0
Label {
id: label
enabled: root.isFocused
anchors.bottom: rect.top
anchors.horizontalCenter: rect.horizontalCenter
}
Rectangle {
id: rect
width: root.size
height: root.size
color: "Transparent"
radius: width / 2
border.width: 2
border.color: root.isFocused ? Material.accentColor : Material.secondaryTextColor
anchors.horizontalCenter: parent.left
anchors.verticalCenter: parent.top
}
Component.onCompleted: {
screenPosition = Qt.binding(function() {
let w = view3D.width
let h = view3D.height
return view3D.mapFrom3DScene(scenePosition)
} )
}
}