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. An error with QtQuick3D
Qt 6.11 is out! See what's new in the release blog

An error with QtQuick3D

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
10 Posts 2 Posters 1.9k 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.
  • G Offline
    G Offline
    GGG03
    wrote on last edited by
    #1

    I don't understand why it shows me a syntax error in DirectionalLight

    import QtQuick3D
    import QtQuick3D.Effects
    import QtQuick3D.AssetUtils
    import QtQuick3D.Helpers
    import QtQuick3D.Particles3D
    
    PerspectiveCamera
    {
        position: Qt.vector3d(0, 200, 300)
        eulerRotation.x: -30
    }
    
    DirectionalLight
    {
        eulerRotation.x: -30
        eulerRotation.y: -70
    }
    1 Reply Last reply
    0
    • G Offline
      G Offline
      GGG03
      wrote on last edited by
      #2

      By the way, I'm running Qt Creator 9.0.0 and Qt 6.4.1

      1 Reply Last reply
      0
      • JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #3

        @GGG03 said in An error with QtQuick3D:

        DirectionalLight

        https://doc.qt.io/qt-6/qml-qt3d-render-directionallight.html
        It seems in order to use DirectionalLight you need:
        import Qt3D.Render 2.4

        1 Reply Last reply
        0
        • G Offline
          G Offline
          GGG03
          wrote on last edited by
          #4

          @JoeCFD said in An error with QtQuick3D:

          I'm just getting the same error.

          JoeCFDJ 1 Reply Last reply
          0
          • G GGG03

            @JoeCFD said in An error with QtQuick3D:

            I'm just getting the same error.

            JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by
            #5

            @GGG03 show your error messages here.

            1 Reply Last reply
            0
            • G Offline
              G Offline
              GGG03
              wrote on last edited by
              #6
              import QtQuick
              import QtQuick3D
              import Qt3D.Core
              import Qt3D.Render 2.4
              import QtQuick3D.Effects
              import QtQuick3D.AssetUtils
              import QtQuick3D.Helpers
              import QtQuick3D.Particles3D
              
              PerspectiveCamera
              {
                  position: Qt.vector3d(0, 200, 300)
                  eulerRotation.x: -30
              }
              
              DirectionalLight
              {
                  eulerRotation.x: -30s
                  eulerRotation.y: -70
              }
              

              The error is just syntax error in DirectionalLight

              1 Reply Last reply
              0
              • JoeCFDJ Offline
                JoeCFDJ Offline
                JoeCFD
                wrote on last edited by JoeCFD
                #7

                @GGG03 said in An error with QtQuick3D:

                import QtQuick
                import QtQuick3D
                import Qt3D.Core
                import Qt3D.Render 2.4
                import QtQuick3D.Effects
                import QtQuick3D.AssetUtils
                import QtQuick3D.Helpers
                import QtQuick3D.Particles3D

                PerspectiveCamera
                {
                position: Qt.vector3d(0, 200, 300)
                eulerRotation.x: -30
                }

                DirectionalLight
                {
                eulerRotation.x: -30s
                eulerRotation.y: -70
                }

                I guess you need to put DirectionalLight and PerspectiveCamera into two separate qml files. In one qml file, only one qml class is defined.

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  GGG03
                  wrote on last edited by
                  #8

                  it tells me that is an unknown component.

                  JoeCFDJ 1 Reply Last reply
                  0
                  • G GGG03

                    it tells me that is an unknown component.

                    JoeCFDJ Offline
                    JoeCFDJ Offline
                    JoeCFD
                    wrote on last edited by
                    #9

                    @GGG03 there are two:

                    1. DirectionalLight: Qt3D <===you need: import Qt3D.Render 2.15
                    2. DirectionalLight: QtQuick3D <===you need: import QtQuick3D 1.15
                      simply import the right module and you will be good.
                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      GGG03
                      wrote on last edited by
                      #10

                      It's working. Thanks!

                      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