We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 9 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
听起来你想做的是使用 QScriptEngine::evaluate() 在定义函数的文件上(作为脚本文本传递),然后使用 QScriptEngine 调用它::call()。无需信号或槽。
沿着这些思路(未经测试):
请注意,您必须进行大量来回转换。如果您只需要 Qt 中的正则表达式,它们已经存在:
QRegExp
。示例中包含一个演示:http://doc.trolltech.com/4.2/工具-regexp.html
It sounds like what you want to do is to use QScriptEngine::evaluate() on that file defining the function (passed in as script text) and then invoke it with QScriptEngine::call(). No signals or slots necessary.
Something along these lines (untested):
Note that there's a lot of converting back and forth you'll have to do. If you just want regular expressions in Qt, they already exist:
QRegExp
. There's a demo included in the samples:http://doc.trolltech.com/4.2/tools-regexp.html
令人惊讶的是,脚本编写这样一个中等复杂的问题被专家们搞得一团糟,以至于没有人理解他们想要做什么。所有成功的教学规则都被违反了,根据用户提出的问题来判断,结果是一场灾难。
脚本是一种表示法,表示特定的通信,在本例中是要执行的操作。该过程需要设计一个翻译词典,请注意,这永远不会完成,只有魔法才会发生,将脚本翻译成预定义的结果。然而,脚本引擎始终需要在获得任何信息之前评估脚本。这显示了白痴的教导。
在展示评估任何脚本的脚本引擎之前,必须向学生展示如何教导引擎执行评估。在我审查过的 15 个脚本示例中,从来没有这样做过。因此,Qt Script 必须按照您的定义发挥作用。除了心灵感应之外,没有其他可能。你已经把自己置于一个令人讨厌的盒子里,所以我希望你知道现在将会发生什么。
It's amazing how such a medium complex issue as scripting has been muddled up by the experts so that no one else understands what they are trying to do. All the successful rules of teaching are violated and the results are a disaster to judge by the questions from users that lead here.
A script is a form of notation that implies a specific communication, in this case, an action to be performed. The process requires that a translation dictionary be designed, note this is never done only magic is supposed to happen, to translate the script into predefined results. Yet, the script engine is always tasked to evaluate the script before it has any information to do so. This displays teaching by morons.
Before you ever show a script engine evaluating any script the student must be shown how to teach the engine to perform the evaluation. This is never done in any of the fifteen examples of scripting that I have reviewed. So, Qt Script must perform magic by your definition. There is no other possibility aside from mental telepathy. You have set yourself inside a nasty box so I hope you know what is coming toward you now.