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. Correcting data by equation parameters
Forum Updated to NodeBB v4.3 + New Features

Correcting data by equation parameters

Scheduled Pinned Locked Moved Unsolved General and Desktop
22 Posts 4 Posters 5.5k 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.
  • E Offline
    E Offline
    erytcg
    wrote on last edited by
    #12

    And one more question this algorithm is fast? I have a looot of data and I have to calculate it in real time:D

    mrjjM 1 Reply Last reply
    0
    • E erytcg

      And one more question this algorithm is fast? I have a looot of data and I have to calculate it in real time:D

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #13

      @erytcg
      well, it's minimal and makes handling the expressions easier (for the programmer) but since it is sort of a text parser, not that fast but for small expressions its not wildly time consuming.

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

        Depending on what you need to handle, maybe using something like
        https://github.com/ArashPartow/exprtk ?

        1 Reply Last reply
        0
        • E Offline
          E Offline
          erytcg
          wrote on last edited by erytcg
          #15

          Can I use QScriptEngine?

          But I have problem

          #include <QtScript/qscriptengine.h>
          #include <QtScript/qscriptvalue.h>
          
          QString x = ui->correctDataLine->displayText();
          QScriptEngine myEngine;
          QScriptValue x2 = myEngine.evaluate(x);
          qDebug() << x2.toNumber();
          
          undefined reference to `_imp___ZN13QScriptEngineC1Ev'
          
          mrjjM 1 Reply Last reply
          0
          • E erytcg

            Can I use QScriptEngine?

            But I have problem

            #include <QtScript/qscriptengine.h>
            #include <QtScript/qscriptvalue.h>
            
            QString x = ui->correctDataLine->displayText();
            QScriptEngine myEngine;
            QScriptValue x2 = myEngine.evaluate(x);
            qDebug() << x2.toNumber();
            
            undefined reference to `_imp___ZN13QScriptEngineC1Ev'
            
            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by mrjj
            #16

            @erytcg
            do you have
            QT += script
            in the pro file?

            1 Reply Last reply
            3
            • E Offline
              E Offline
              erytcg
              wrote on last edited by
              #17

              Ok thanks my bad:(
              Do you think can I use this with variables names?

              mrjjM 1 Reply Last reply
              1
              • E erytcg

                Ok thanks my bad:(
                Do you think can I use this with variables names?

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #18

                @erytcg
                What do you mean with "variables names" ?
                To put inside QScriptEngine or what you wanna do with variables?

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

                  Ah I see where you are aiming :)
                  Yes you can use it for your use case. Depending on the complexity you need.
                  http://www.informit.com/articles/article.aspx?p=1405559&seqNum=2
                  Using script with js to play calculator.

                  1 Reply Last reply
                  0
                  • E Offline
                    E Offline
                    erytcg
                    wrote on last edited by
                    #20

                    I have this
                    0_1509308181416_1a4c9133-55ab-43be-9958-7c649b4c8d49-obraz.png

                    And I have variable name: x. I put to QLineEdit 1+x * 3
                    And script automatically calculate new value of x.
                    x = 1+x*3

                    mrjjM 1 Reply Last reply
                    0
                    • E erytcg

                      I have this
                      0_1509308181416_1a4c9133-55ab-43be-9958-7c649b4c8d49-obraz.png

                      And I have variable name: x. I put to QLineEdit 1+x * 3
                      And script automatically calculate new value of x.
                      x = 1+x*3

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #21

                      @erytcg
                      Only if you program in js to solve it. it can evaluate values for you but
                      it cant tell you what x is as far as i know.

                      1 Reply Last reply
                      0
                      • VRoninV Offline
                        VRoninV Offline
                        VRonin
                        wrote on last edited by VRonin
                        #22

                        Why are you using JS libraries with a deprecated Qt module when @mrjj linked a good C++ library that can do what you want? there are even examples that do basically what you want to do.

                        If you want something that would solve generic expressions (i.e. no numeric values involved). The issue becomes a lot more complicated and, you are probably better off using a service like Wolfram Alpha's API

                        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                        ~Napoleon Bonaparte

                        On a crusade to banish setIndexWidget() from the holy land of Qt

                        1 Reply Last reply
                        2

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved