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. how to rotate an object with any angle without using mouse?
Qt 6.11 is out! See what's new in the release blog

how to rotate an object with any angle without using mouse?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 256 Views
  • 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.
  • S Offline
    S Offline
    Saini_123
    wrote on last edited by
    #1

    I want to rotate an object at an angle (90 or 180 degree) without using mouse . For this I want add a push button on the object display window screen.When I click this button ,object should be rotate at an angle .So please anybody help me what and where I should add the code for this task or issue? I share the code

    import QtQuick.Controls 2.2
    import QtQuick.Dialogs 1.2
    
    import QtQuick.Scene3D 2.0
    
    import Qt3D.Core 2.0
    import Qt3D.Render 2.0
    import Qt3D.Input 2.0
    import Qt3D.Extras 2.0
    
    ApplicationWindow
    {
        visible: true
        width: 640
    
        height: 480
        title: qsTr("3D Viewer")
    
        header: ToolBar
        {
            ToolButton
            {
                text: "Open 3D Model"
                onPressed:
                {
                    fileDialog.open()
                }
            }
        }
    
        FileDialog
        {
            id: fileDialog
            onAccepted:
            {
                sceneLoader.source = fileDialog.fileUrl
    
            }
        }
    
    
    
        Scene3D
        {
            anchors.fill: parent
    
            aspects: ["input", "logic"]
            cameraAspectRatioMode: Scene3D.AutomaticAspectRatio
    
    
            Entity
            {
                id: sceneRoot
    
                Camera
                {
                    id: camera
                    projectionType: CameraLens.PerspectiveProjection
                    fieldOfView: 30
                    aspectRatio: 16/9
                    nearPlane : 0.1
                    farPlane : 1000.0
                    position: Qt.vector3d( 0.0, 0.0, 5.0 )
                    upVector: Qt.vector3d( 0.0, 0.0, 0.0 )
                    viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
    
                }
    
                OrbitCameraController
                {
                    camera: camera
                }
    
                components: [
                    RenderSettings
                    {
                        activeFrameGraph: ForwardRenderer
                        {
                            clearColor: Qt.rgba(0, 0.5, 1, 1)
                            camera: camera
    
    
                        }
                    },
                    InputSettings
                    {
                    }
                ]
    
                Entity
                {
                    id: monkeyEntity
                    components: [
                        SceneLoader
                        {
                           id: sceneLoader
    
    
                        }
                    ]
                }
    
    
            }
           
       }
    }
    
    
    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