Can not use mouse to change viewport in scene3D.
Unsolved
QML and Qt Quick
-
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!