Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt5.5 QJSEngine 很简单的一段js加法计算问题

    Chinese
    qjsengine
    1
    1
    1286
    Loading More Posts
    • 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
      edgeofx last edited by edgeofx

      QJSEngine jsEngine;
      QJSValue value = jsEngine.evaluate(QLatin1String("1 + 2"));
      qDebug() << value.toString(); // 输出 3
      

      同样的代码改为8进制就报语法错误:

      QJSEngine jsEngine;
      QJSValue value = jsEngine.evaluate(QLatin1String("01 + 02"));
      qDebug() << value.toString(); // 输出 SyntaxError: Syntax error
      

      不知为何,有朋友知道吗,感谢!

      1 Reply Last reply Reply Quote 0
      • First post
        Last post