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. QScriptEngine evaluate

QScriptEngine evaluate

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 335 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.
  • N Offline
    N Offline
    NotYourFan
    wrote on last edited by
    #1

    Hi,

    i try to compare with QScriptEngine:

    QString Ergebnis = engine.evaluate(" 2 < 3 ? "OK" : "BAD").toString();
    
    

    I get an Error

    The variable OK" not exist 
    

    What should i do?

    jsulmJ 1 Reply Last reply
    0
    • N NotYourFan

      Hi,

      i try to compare with QScriptEngine:

      QString Ergebnis = engine.evaluate(" 2 < 3 ? "OK" : "BAD").toString();
      
      

      I get an Error

      The variable OK" not exist 
      

      What should i do?

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

      @NotYourFan You are aware that you have to escape " inside strings?

      QString Ergebnis = engine.evaluate(" 2 < 3 ? \"OK\" : \"BAD\"").toString();
      

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

      1 Reply Last reply
      3
      • N Offline
        N Offline
        NotYourFan
        wrote on last edited by
        #3

        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