Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt: Add UI Elements using Qt Script

Tags:

c++

qt

qtscript

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);
like image 509
codeincarnate Avatar asked Apr 28 '26 05:04

codeincarnate


1 Answers

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.

like image 146
rohanpm Avatar answered Apr 29 '26 18:04

rohanpm