我想做类似的事情
if(x == 0){
quit() ;
}
有没有办法在 Qt 脚本中做到这一点?
最佳答案
将您的代码包含在这样的函数中:
function main(){
// the code before
if(x == 0){
return;
}
// the code if condition not met
}
因此您可以使用 return 语句退出 javascript 代码。确保 main 函数是您的操作中唯一调用的函数(因此它真的从 JS 退出)。
关于c++ - 如果满足条件,如何退出 Qt 脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17974443/