Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. WORKING WITH JAVASCRIPT DOCUMENTS
Qt 6.11 is out! See what's new in the release blog

WORKING WITH JAVASCRIPT DOCUMENTS

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 4 Posters 1.3k 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
    gblessed
    wrote on last edited by
    #1

    Good day, please I need your help on qt c++. Am working on a quiz program, I have designed the interface, but the question bank is a JavaScript document. I don't know if there's a way for me to query it from c++ and get the questions.
    Thanks in anticipation

    jsulmJ RatzzR 2 Replies Last reply
    0
    • G gblessed

      Good day, please I need your help on qt c++. Am working on a quiz program, I have designed the interface, but the question bank is a JavaScript document. I don't know if there's a way for me to query it from c++ and get the questions.
      Thanks in anticipation

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @gblessed Do you mean JSON? If so take a look at https://doc.qt.io/qt-5/json.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      4
      • G gblessed

        Good day, please I need your help on qt c++. Am working on a quiz program, I have designed the interface, but the question bank is a JavaScript document. I don't know if there's a way for me to query it from c++ and get the questions.
        Thanks in anticipation

        RatzzR Offline
        RatzzR Offline
        Ratzz
        wrote on last edited by
        #3

        @gblessed
        Or an XML ?
        Examples : https://doc.qt.io/qt-5/examples-xml.html

        --Alles ist gut.

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

          Thanks alot,both replies were helpful

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi
            So was it json or XML doc ?

            1 Reply Last reply
            0
            • G Offline
              G Offline
              gblessed
              wrote on last edited by
              #6

              @mrjj hi, am still confused on what it actually is, here is the file
              h ttps://www.datafilehost.com/d/ddbe4531

              I don't know how to work with it

              jsulmJ 1 Reply Last reply
              0
              • G gblessed

                @mrjj hi, am still confused on what it actually is, here is the file
                h ttps://www.datafilehost.com/d/ddbe4531

                I don't know how to work with it

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @gblessed It's JavaScript script, so neither JSON nor XML.
                What exactly do you want to do with it?

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                G 1 Reply Last reply
                1
                • jsulmJ jsulm

                  @gblessed It's JavaScript script, so neither JSON nor XML.
                  What exactly do you want to do with it?

                  G Offline
                  G Offline
                  gblessed
                  wrote on last edited by
                  #8

                  @jsulm hi, if you open it with notepad you will notice that there are some multiple choice questions , so I want to query the questions and answers randomly to form a quiz program

                  jsulmJ 1 Reply Last reply
                  0
                  • G gblessed

                    @jsulm hi, if you open it with notepad you will notice that there are some multiple choice questions , so I want to query the questions and answers randomly to form a quiz program

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by jsulm
                    #9

                    @gblessed Then you will need to parse that manually using Regular Expressions (https://doc.qt.io/qt-5/qregularexpression.html)

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    G 1 Reply Last reply
                    3
                    • jsulmJ jsulm

                      @gblessed Then you will need to parse that manually using Regular Expressions (https://doc.qt.io/qt-5/qregularexpression.html)

                      G Offline
                      G Offline
                      gblessed
                      wrote on last edited by
                      #10

                      @jsulm
                      @mrjj
                      do you suggest I use QFile to open the document and then pass it to a QTextStream before executing pearl commands on the text?

                      jsulmJ 1 Reply Last reply
                      0
                      • G gblessed

                        @jsulm
                        @mrjj
                        do you suggest I use QFile to open the document and then pass it to a QTextStream before executing pearl commands on the text?

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        @gblessed Yes, you read the content of the file into a QString variable and then use regular expressions to extract the information you need.

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        G 1 Reply Last reply
                        2
                        • jsulmJ jsulm

                          @gblessed Yes, you read the content of the file into a QString variable and then use regular expressions to extract the information you need.

                          G Offline
                          G Offline
                          gblessed
                          wrote on last edited by
                          #12

                          @jsulm alright thanks a lot for your assistance

                          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