Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Can not use mouse to change viewport in scene3D.
Qt 6.11 is out! See what's new in the release blog

Can not use mouse to change viewport in scene3D.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 394 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • small_birdS Offline
    small_birdS Offline
    small_bird
    wrote on last edited by
    #1

    Hello everyone, I have the following code:

    import QtQuick 2.5
    import QtQuick.Window 2.2
    import QtQuick.Controls 1.4
    import QtQuick.Controls.Styles 1.4
    import Qt3D.Core 2.0
    import Qt3D.Render 2.0
    import Qt3D.Input 2.0
    import Qt3D.Extras 2.0
    import QtQuick.Scene3D 2.0
    
    ApplicationWindow{
        width: Screen.desktopAvailableWidth;
        height: Screen.desktopAvailableHeight;
        Scene3D{
            id:scene3d;
            anchors.fill: parent;
    
            Entity {
                id: sceneRoot;
    
                Camera {
                    id: camera;
                    projectionType: CameraLens.PerspectiveProjection;
                    fieldOfView: 45;
                    aspectRatio: Screen.desktopAvailableWidth / Screen.desktopAvailableHeight;
                    nearPlane: 0.1;
                    farPlane: 1000.0;
                    position: Qt.vector3d(0.0, 10.0, 20.0);
                    viewCenter: Qt.vector3d(0.0, 0.0, 0.0);
                    upVector: Qt.vector3d(0.0, 1.0, 0.0);
                }
    
                FirstPersonCameraController {
                    camera: camera;
                }
    
                ShadowMapLight {
                    id: light;
                }
                components: [
                    ShadowMapFrameGraph {
                        id: framegraph;
                        viewCamera: camera;
                        lightCamera: light.lightCamera;
                    },
                    // Event Source will be set by the Qt3DQuickWindow
                    InputSettings { }
                ]
    
                AdsEffect {
                    id: shadowMapEffect;
                    shadowTexture: framegraph.shadowTexture;
                    light: light;
                }
    
                // Trefoil knot entity
                Trefoil {
                    material: AdsMaterial {
                        effect: shadowMapEffect;
                        specularColor: Qt.rgba(0.5, 0.5, 0.5, 1.0);
                    }
                }
    
                // Toyplane entity
                Toyplane {
                    material: AdsMaterial {
                        effect: shadowMapEffect;
                        diffuseColor: Qt.rgba(0.9, 0.5, 0.3, 1.0);
                        shininess: 75;
                    }
                }
    
                // Plane entity
                GroundPlane {
                    material: AdsMaterial {
                        effect: shadowMapEffect;
                        diffuseColor: Qt.rgba(0.2, 0.5, 0.3, 1.0);
                        specularColor: Qt.rgba(0, 0, 0, 1.0);
                    }
                }
            }
        }
    }
    
    

    However, I can not use the mouse to change viewport in scene3D, could anyone tell me the reason? Thanks in advance!

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved