Dear all,
I would like to use QtScript in order to test a data model for an application, try all the methods, and the behaviour of the GUI during the modification of the data model.
To do this, I would like to create a script console in which the developer could create and use some QObject child (classes that represents the data model) using script.
I read the documentation and I understand well that I can use any instance of data model classes with this method:
void ScriptConsole
::addQObjectInstance(QObject *object,
const QString &name
) {
QScriptValue objectValue = m_engine.newQObject(object);
m_engine.globalObject().setProperty(name, objectValue);
}
void ScriptConsole::addQObjectInstance(QObject *object, const QString &name)
{
QScriptValue objectValue = m_engine.newQObject(object);
m_engine.globalObject().setProperty(name, objectValue);
}
To copy to clipboard, switch view to plain text mode
How can I use some classes of the data model inside the script ?
I need to define, in some way, the possibility to create new objects of particular classes (that inherit QObject) in the script.
Thanks in advance,
Angelo
Bookmarks