Qt Graphs Integration mit Qt Quick 3D

Da Qt Graphs für 3D auf Qt Quick 3D basiert, ist es möglich, Qt Quick 3D Szenen in die Diagramme zu integrieren.

Szenenumgebung

Um eine Qt Quick 3D Szenenumgebung in einem Diagramm einzustellen, definieren Sie entweder SceneEnvironment oder ExtendedSceneEnvironment in der Eigenschaft environment des Diagramms wie folgt:

environment: ExtendedSceneEnvironment {
    aoEnabled: true
    aoDither: true
    ditheringEnabled: true
    lightProbe: Texture {
        textureData: ProceduralSkyTextureData {
            groundBottomColor: "black"
            skyTopColor: "white"
        }
    }
    backgroundMode: SceneEnvironment.SkyBox
    lensFlareEnabled: true
    lensFlareGhostCount: 10
    lensFlareApplyStarburstTexture: true
    lensFlareBloomBias: 0.4
}

Nicht unterstützte Features

Das Überschreiben des Antialiasing-Modus oder der Szenenfarbe funktioniert nicht, was bedeutet, dass die Einstellung der Werte für SceneEnvironment.antialiasingMode und SceneEnvironment.clearColor nichts bewirkt. Wenn jedoch backgroundMode nicht auf SceneEnvironment.Color eingestellt ist, wird der Hintergrund von den Einstellungen beeinflusst.

Integration von Szenen

Um eine Qt Quick 3D -Szene in ein Diagramm zu integrieren, setzen Sie die importScene -Eigenschaft des Diagramms auf ein Node mit den folgenden Einstellungen:

importScene: Node {
    Model {
        scale: Qt.vector3d(0.01, 0.01, 0.01)
        source: "#Sphere"
        x: 2.5
        z: 2
        y: 1
        castsReflections: false
        receivesReflections: true
        materials: [
            PrincipledMaterial {
                baseColor: "gold"
                metalness: 1.0
                roughness: 0.1
            }
        ]
        ReflectionProbe {
            boxSize: Qt.vector3d(6, 3, 5)
            boxOffset: Qt.vector3d(-1.5, -1, -1.5)
            parallaxCorrection: true
            quality: ReflectionProbe.High
        }
    }
    Model {
        scale: Qt.vector3d(0.01, 0.01, 0.01)
        source: "#Sphere"
        x: -2.5
        z: -2
        y: 1
        castsReflections: false
        receivesReflections: true
        materials: [
            PrincipledMaterial {
                baseColor: "white"
                metalness: 0.0
                roughness: 0.0
                transmissionFactor: 1.0
                thicknessFactor: 50
            }
        ]
    }
}

Das direkte Hinzufügen von Nodes als Kind des Diagramms funktioniert nicht, da das Standardkind eines Diagramms die entsprechende Serie ist.

© 2025 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.