summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eliasson <andreas.eliasson@qt.io>2023-02-16 14:32:39 +0100
committerAndreas Eliasson <andreas.eliasson@qt.io>2023-03-06 12:12:02 +0100
commit5859a840c3f21b36d4c7849c173c38e16ef52fd2 (patch)
treed4fcc629158c183fc2bdd18dfa211936c0fec23e
parent6c1155f6ac4e8baa554a55b915eca0add4030d07 (diff)
Doc: Replace \quotefromfile with \snippet to make code left-aligned
The \quotefromfile command is smart enough to keep the left indentation from the source file when it renders the code in a code snippet in a qdoc file. This is all good when you're listing multiple code snippets and you can clearly see the left-most-aligned code, or 'starting point'. However, when you use \quotefromfile for a single code snippet that is indented in the source file, the rendered code in the qdoc file is not left-aligned - and this looks a bit odd. Pick-to: 6.5 6.4 6.2 Change-Id: Ie6d2445b37faa4a75749d6013001892de012a1ef Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
-rw-r--r--examples/qt3d/multiviewport/QuadViewportFrameGraph.qml3
-rw-r--r--examples/qt3d/multiviewport/doc/src/multiviewport.qdoc4
-rw-r--r--examples/qt3d/simple-qml/doc/src/simple-qml.qdoc13
-rw-r--r--examples/qt3d/simple-qml/main.qml11
-rw-r--r--tests/manual/scene3d/AnimatedEntity.qml3
-rw-r--r--tests/manual/scene3d/doc/src/scene3d.qdoc9
-rw-r--r--tests/manual/scene3d/main.qml3
7 files changed, 21 insertions, 25 deletions
diff --git a/examples/qt3d/multiviewport/QuadViewportFrameGraph.qml b/examples/qt3d/multiviewport/QuadViewportFrameGraph.qml
index 7141415d9..5359faa38 100644
--- a/examples/qt3d/multiviewport/QuadViewportFrameGraph.qml
+++ b/examples/qt3d/multiviewport/QuadViewportFrameGraph.qml
@@ -15,7 +15,7 @@ RenderSettings {
activeFrameGraph: RenderSurfaceSelector {
id: surfaceSelector
-
+ //! [0]
Viewport {
id: mainViewport
normalizedRect: Qt.rect(0, 0, 1, 1)
@@ -49,5 +49,6 @@ RenderSettings {
CameraSelector { id: cameraSelectorBottomRightViewport }
}
}
+ //! [0]
}
}
diff --git a/examples/qt3d/multiviewport/doc/src/multiviewport.qdoc b/examples/qt3d/multiviewport/doc/src/multiviewport.qdoc
index baa1e7e96..1e1a77403 100644
--- a/examples/qt3d/multiviewport/doc/src/multiviewport.qdoc
+++ b/examples/qt3d/multiviewport/doc/src/multiviewport.qdoc
@@ -25,9 +25,7 @@
Using the rules defined in \l {Framegraph Rules}, we construct five
RenderView objects from the FrameGraph:
- \quotefromfile multiviewport/QuadViewportFrameGraph.qml
- \skipto Viewport {
- \printuntil /^\}/
+ \snippet multiviewport/QuadViewportFrameGraph.qml 0
The \e {order is important}. If the ClearBuffers node were to be the last
instead of the first, this would result in a black screen for the simple
diff --git a/examples/qt3d/simple-qml/doc/src/simple-qml.qdoc b/examples/qt3d/simple-qml/doc/src/simple-qml.qdoc
index 670697ee8..44486b8d8 100644
--- a/examples/qt3d/simple-qml/doc/src/simple-qml.qdoc
+++ b/examples/qt3d/simple-qml/doc/src/simple-qml.qdoc
@@ -20,25 +20,20 @@
To be able to use the types in the Q3D and Q3D Render modules, we must
import the modules:
- \quotefromfile simple-qml/main.qml
- \skipto import Qt3D.Core
- \printuntil Render 2.0
+ \snippet simple-qml/main.qml 0
The first entities we create are a \l Camera, which represents the camera
used for the final rendering, and a camera controller, which allows us to
control this camera using the keyboard or the mouse:
- \skipto Camera {
- \printuntil }
- \printuntil }
+ \snippet simple-qml/main.qml 1
A \l RenderSettings entity specifies a ForwardRenderer as the active
framegraph:
- \printuntil },
+ \snippet simple-qml/main.qml 2
The event source is set by the Qt3DQuickWindow:
- \skipto InputSettings
- \printuntil }
+ \snippet simple-qml/main.qml 3
*/
diff --git a/examples/qt3d/simple-qml/main.qml b/examples/qt3d/simple-qml/main.qml
index 3fe4a7ae3..c86be8d2d 100644
--- a/examples/qt3d/simple-qml/main.qml
+++ b/examples/qt3d/simple-qml/main.qml
@@ -2,14 +2,16 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick 2.2 as QQ2
+//! [0]
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+//! [0]
import Qt3D.Input 2.0
import Qt3D.Extras 2.15
Entity {
id: sceneRoot
-
+ //! [1]
Camera {
id: camera
projectionType: CameraLens.PerspectiveProjection
@@ -21,11 +23,11 @@ Entity {
upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
}
-
+ //! [1]
OrbitCameraController {
camera: camera
}
-
+ //! [2]
components: [
RenderSettings {
activeFrameGraph: ForwardRenderer {
@@ -35,8 +37,11 @@ Entity {
}
},
// Event Source will be set by the Qt3DQuickWindow
+ //! [3]
InputSettings { }
+ //! [3]
]
+ //! [2]
PhongMaterial {
id: material
diff --git a/tests/manual/scene3d/AnimatedEntity.qml b/tests/manual/scene3d/AnimatedEntity.qml
index 65ebd27b1..a23060e4d 100644
--- a/tests/manual/scene3d/AnimatedEntity.qml
+++ b/tests/manual/scene3d/AnimatedEntity.qml
@@ -16,7 +16,7 @@ Entity {
property bool validBounds: sphereMesh.implicitPointsValid
property vector3d sphereMinPt: sphereMesh.implicitMinPoint
property vector3d sphereMaxPt: sphereMesh.implicitMaxPoint
-
+ //! [0]
Camera {
id: camera
projectionType: CameraLens.PerspectiveProjection
@@ -27,6 +27,7 @@ Entity {
upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
}
+ //! [0]
FirstPersonCameraController { camera: camera }
diff --git a/tests/manual/scene3d/doc/src/scene3d.qdoc b/tests/manual/scene3d/doc/src/scene3d.qdoc
index 27293551d..bf33b28cb 100644
--- a/tests/manual/scene3d/doc/src/scene3d.qdoc
+++ b/tests/manual/scene3d/doc/src/scene3d.qdoc
@@ -19,14 +19,9 @@
We set up the 3D scene and specify the entity to animate in \e main.qml:
- \quotefromfile scene3d/main.qml
- \skipto Scene3D {
- \printuntil }
- \printuntil }
+ \snippet scene3d/main.qml 0
We specify the active camera in \e scene3d/AnimatedEntity.qml:
- \quotefromfile scene3d/AnimatedEntity.qml
- \skipto Camera
- \printuntil }
+ \snippet scene3d/AnimatedEntity.qml 0
*/
diff --git a/tests/manual/scene3d/main.qml b/tests/manual/scene3d/main.qml
index 998c7a275..9e8531000 100644
--- a/tests/manual/scene3d/main.qml
+++ b/tests/manual/scene3d/main.qml
@@ -44,7 +44,7 @@ Item {
origin.x: scene.width / 2
origin.y: scene.height / 2
}
-
+ //! [0]
Scene3D {
id: scene3d
anchors.fill: parent
@@ -57,6 +57,7 @@ Item {
id: rootEntity
}
}
+ //! [0]
}
Rectangle {