For instance, let's create a QDialog from qs.
- Declares the given QMetaObject:
Q_SCRIPT_DECLARE_QMETAOBJECT(QDialog, QWidget*)
- Creates a QScriptValue that represents the Qt class
QScriptValue dialogClass = engine.scriptValueFromQMetaObject<QDialog>();
engine.globalObject().setProperty("QDialog", dialogClass); - code.qs is:
var d = new QDialog();
d.windowTitle = "qs dialod"
d.show() - run scriplet from qt/c++:
QFile file("code.qs");
file.open(QIODevice::ReadOnly);
engine.evaluate(file.readAll());
file.close();
reference articles:
Комментариев нет:
Отправить комментарий