Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to get access widgets placed on MainWindow's from QtScript
Zholaman last edited by
I have created standard project from the template "Aplication->Qt Widgets Application" by Qt Creator.
Now I need to get access to widgest placed on mainwindow.ui , so how I can did that ? My main goal change properties of object like QLable that is placed on mainwindow.ui through QtScript
For example, code below shows how we can change properties directly while I need to change the properties of the elements are placed on the main form - mainwindow.ui
QApplication a(argc, argv); QLabel lbl; QScriptEngine scriptEngine; QScriptValue scriptLbl = scriptEngine.newQObject(&lbl); scriptEngine.globalObject().setProperty("lbl",scriptLbl); scriptEngine.evaluate("lbl.text = 'Help me!'"); scriptEngine.evaluate("lbl.show()");