开发者

Qt: what are the differences between QtScript and Javascript in Webkit

开发者 https://www.devze.com 2023-01-31 02:43 出处:网络
I am familiar with web development so I know exactly what Javascript can do in webkit. If I want to employ the scripting feature in my apps, I think there are two ways:

I am familiar with web development so I know exactly what Javascript can do in webkit. If I want to employ the scripting feature in my apps, I think there are two ways:

  1. Employ qtwebkit and open a hidden webpage running my own Javascript scripts.
  2. Using qtscript.

Right now I want most of my app logic are implemented with scripts but I am wondering what are differences betw开发者_开发问答een them and how to choose under different circumstances, javascript in webkit or qtscript?

Sorry if this question is not that professional. Thanks


Reading the following

Qt 4.3 and later provides support for application scripting with ECMAScript.

in Making Applications Scriptable section in Qt docs one comes to conclusion that QtScript is just a name of Java Script (ECMAScript is the name of the Java Script's official specification) implementation in Qt.

Additionaly in QtScript in 4.6 article on Qt Labs page we find the following information

(...) Qt 4.6′s QtScript implementation is based on WebKit’s JavaScript engine, JavaScriptCore (...)

This gives you a very strong guarantee that QtScript's behaviour will match the one you know from WebKit's implementation.

If you just want to add scripting to your application and you don't need anything related to WebKit then it's enough to use QScriptEngine class which provides an environment for evaluating Qt Script code.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号