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. ReferenceError: xxx is not defined
Forum Updated to NodeBB v4.3 + New Features

ReferenceError: xxx is not defined

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
11 Posts 3 Posters 4.4k Views 2 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi and welcome to devnet,

    What exactly is xxx ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    J 1 Reply Last reply
    0
    • SGaistS SGaist

      Hi and welcome to devnet,

      What exactly is xxx ?

      J Offline
      J Offline
      Jan Kubice
      wrote on last edited by
      #3

      @SGaist
      It's exactly ReferenceError: xmlReaderCpp is not defined

      1 Reply Last reply
      0
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #4

        With current code what you pasted, you should to have this issue. This error clearly indicates that xmlReaderCpp is not defined when you load qml file. See your flow.

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        J 1 Reply Last reply
        3
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #5

          Using a modified main.qml because I don't have Felgo at hand.

          Your code is working properly. Just beware that your property will return an invalid variant as you do not initialise m_helloText with any text.

          I'd recommend using a simple dummy qml file to get started just to check that you have everything working correctly with base types before going further.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • dheerendraD dheerendra

            With current code what you pasted, you should to have this issue. This error clearly indicates that xmlReaderCpp is not defined when you load qml file. See your flow.

            J Offline
            J Offline
            Jan Kubice
            wrote on last edited by
            #6

            @dheerendra But if I understand it right I using ctx->setContextProperty("xmlReaderCpp", &xmlReaderH) before loading any qml so I don't understand why xmlReaderCpp isn't defined.

            1 Reply Last reply
            0
            • dheerendraD Offline
              dheerendraD Offline
              dheerendra
              Qt Champions 2022
              wrote on last edited by
              #7

              It is not xmlReader is undefined. Error must be something else. Just copy paste the exact error.

              Here your m_helloText is uninitialised. In the constructor you have initialised some other variable.

              Please change the constructor statement to
              m_helloText = = "Dheerendra";

              Then everything should work fine.

              Dheerendra
              @Community Service
              Certified Qt Specialist
              http://www.pthinks.com

              J 1 Reply Last reply
              0
              • dheerendraD dheerendra

                It is not xmlReader is undefined. Error must be something else. Just copy paste the exact error.

                Here your m_helloText is uninitialised. In the constructor you have initialised some other variable.

                Please change the constructor statement to
                m_helloText = = "Dheerendra";

                Then everything should work fine.

                J Offline
                J Offline
                Jan Kubice
                wrote on last edited by
                #8

                @dheerendra I initialised m_helloText.
                But I still got file:/untitled//main.qml:14: ReferenceError: xmlReaderCpp is not defined

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #9

                  Did you try as I suggested with a simpler main.qml file ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  J 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Did you try as I suggested with a simpler main.qml file ?

                    J Offline
                    J Offline
                    Jan Kubice
                    wrote on last edited by Jan Kubice
                    #10

                    @SGaist yes I tried it but still nothing but maybe I managed it, I haven't try it yet because now I don't have time. Everything in my code is fine but there is a problem with Felgo.
                    For future viewers try this https://felgo.com/developers/forums/t/cant-integrate-c-in-qml. I will try it tomorrow and if it work I close this topic as solved.

                    But still thanks for helping.

                    1 Reply Last reply
                    0
                    • dheerendraD Offline
                      dheerendraD Offline
                      dheerendra
                      Qt Champions 2022
                      wrote on last edited by
                      #11

                      You can refer the example here.

                      I have taken the code from your sample & made it.

                      Dheerendra
                      @Community Service
                      Certified Qt Specialist
                      http://www.pthinks.com

                      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