Debian Codegraph @

tests/manual/keyboardinput-qml/main.qml

raw
1 // Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 import Qt3D.Core 2.0
5 import Qt3D.Render 2.0
6 import Qt3D.Input 2.0
7 import Qt3D.Extras 2.0
8
9 Entity {
10 id: root
11
12 Camera {
13 id: camera
14 projectionType: CameraLens.PerspectiveProjection
15 fieldOfView: 45
16 aspectRatio: 16/9
17 nearPlane : 0.1
18 farPlane : 1000.0
19 position: Qt.vector3d( 0.0, 0.0, 12.0 )
20 upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
21 viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
22 }
23
24 FirstPersonCameraController { camera: camera }
25
26 components: [
27 RenderSettings {
28 activeFrameGraph: ForwardRenderer {
29 camera: camera
30 }
31 },
32 // Event Source will be set by the Qt3DQuickWindow
33 InputSettings { }
34 ]
35
36 KeyboardDevice {
37 id: keyboardDevice
38 }
39
40 SphereEntity {
41 id: sphere1
42 position: Qt.vector3d(-5, 0, 0)
43 color: "red"
44 input.onTabPressed: sphere2.input.focus = true
45 input.focus: true
46 input.sourceDevice: keyboardDevice
47 }
48
49 SphereEntity {
50 id: sphere2
51 color: "green"
52 input.onTabPressed: sphere3.input.focus = true
53 input.sourceDevice: keyboardDevice
54 }
55
56 SphereEntity {
57 id: sphere3
58 position: Qt.vector3d(5, 0, 0)
59 color: "blue"
60 input.onTabPressed: sphere1.input.focus = true
61 input.sourceDevice: keyboardDevice
62 }
63 }