Qt:使用 Qt 脚本添加 UI 元素
是否可以使用 QtScript 将新的 GUI 元素添加到 Qt 程序中? 例如,假设变量“布局”是垂直布局,这可以接受吗?
var label = new QLabel("Text");
layout.addWidget(label);
Is it possible to add new GUI elements into a Qt program using QtScript? For instance assuming the variable "layout" is a vertical layout would this be acceptable?
var label = new QLabel("Text");
layout.addWidget(label);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Qt 不附带 QtScript 绑定; 您使用哪些绑定?
如果您在 Qt Labs 上使用绑定生成器,是的,假设您已安排将“布局”变量导入到脚本引擎中,则此代码可以正常工作。
Qt doesn't ship with QtScript bindings; which bindings are you using?
If you're using the bindings generator on Qt Labs, yes, this code would work fine, assuming you arranged for the `layout' variable to be imported into your script engine.