完全使用 QtScript 创建 GUI 应用程序,您有何看法?
自从宣布 QT 许可证变更以来,我开始研究 QT 框架。 它看起来不错,但我不喜欢必须使用 C++。 我知道不同的语言有不同的绑定,但 QtScript 对我来说似乎最有趣。
是否可以使用 QtScript 来编写完整的 GUI 应用程序代码(当然需要 UI 设计人员的帮助),或者它仅用于编写现有应用程序部分的脚本。
Since QT license change is announced I started to take a look at the QT framework. It looks nice, but I don't like having to use C++. I know there are different bindings for various languages, but QtScript seems most interesting to me.
Is it possible to use QtScript to code complete GUI application (with help from UI designer, of course), or it is only meant for scripting parts of existing applications.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,完全有可能这样做。 但是,由于 Qt(直到 4.5)默认情况下不提供 Qt 脚本绑定,因此您需要生成它并可能将其包含在您的应用程序中。 但这只是一次性步骤,请参阅 http://labs.trolltech.com/ page/Projects/QtScript/Generator 获取绑定。
这是一个示例: http://labs .trolltech.com/blogs/2009/01/06/simple-qtscript-based-bar-chart/。 应用程序逻辑完全在 QtScript 中。 您只需要使用解释器启动(请参阅上面的绑定生成器)。
Yes, it is perfectly possible to do so. However, since Qt (until 4.5) does not ship the Qt Script bindings by default, you need to generate it and probably include it with your application. But this is one-time step only, refer to http://labs.trolltech.com/page/Projects/QtScript/Generator to get the binding.
Here is an example: http://labs.trolltech.com/blogs/2009/01/06/simple-qtscript-based-bar-chart/. The application logic is completely in QtScript. You just need to launch with the interpreter (see the binding generator above).
QtScript 旨在让您将应用程序的部分内容导出到脚本引擎,从而获得更大的灵活性。 您始终还必须编写一些 C++ 代码来支持 QtScript 部分。 我会根据您的喜好坚持使用您已经检查过的替代方案,例如 PyQt 或 QtRuby。
QtScript is designed to let you export parts of your application to the scripting engine to allow you for more flexibility. You will always have to also write some C++ code to support the QtScript part. I would stick with the alternatives you have already checked out like PyQt or QtRuby depending on your preference.