In questa pagina

Qt Graphs Integrazione con Qt Quick 3D

Poiché l'Qt Graphs e per il 3D si basa su Qt Quick 3D, è possibile integrare le scene di Qt Quick 3D nei grafici.

Grafico a barre 3D con sfere riflettenti su una piattaforma rossa

Ambiente della scena

Per configurare l'ambiente di una scena di " Qt Quick 3D " in un grafico, definire SceneEnvironment o ExtendedSceneEnvironment nella proprietà environment del grafico come segue:

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
}

Funzionalità non supportate

La sovrascrittura della modalità di antialiasing o del colore di cancellazione della scena non funziona, il che significa che l’impostazione di valori per SceneEnvironment.antialiasingMode e SceneEnvironment.clearColor non ha alcun effetto. Tuttavia, se backgroundMode non è impostato su SceneEnvironment.Color, lo sfondo risulterà influenzato da tali impostazioni.

Integrazione della scena

Per integrare una scena Qt Quick 3D in un grafico, impostare la proprietà importScene del grafico su un Node con le seguenti impostazioni:

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

L’aggiunta diretta di Nodes come elementi figli del grafico non funzionerà, poiché l’elemento figlio predefinito di un grafico è la serie corrispondente.

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