I never actually had to do it before either, but have a look at how the bindings do it:
excerpt from qtscript_QWizardPage.cpp:
QScriptValue qtscript_create_QWizardPage_class(QScriptEngine *engine)
{
...
engine->setDefaultPrototype(qMetaTypeId<QWizardPage*>(), QScriptValue());
QScriptValue proto = engine->newVariant(qVariantFromValue((QWizardPage*)0));
proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QWidget*>()));
for (int i = 0; i < 14; ++i) {
QScriptValue fun = engine->newFunction(qtscript_QWizardPage_prototype_call, function_lengths[i+1]);
fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
proto.
setProperty(QString::fromLatin1(qtscript_QWizardPage_function_names
[i
+1]),
fun, QScriptValue::SkipInEnumeration);
}
qScriptRegisterMetaType<QWizardPage*>(engine, qtscript_QWizardPage_toScriptValue,
qtscript_QWizardPage_fromScriptValue, proto);
QScriptValue qtscript_create_QWizardPage_class(QScriptEngine *engine)
{
...
engine->setDefaultPrototype(qMetaTypeId<QWizardPage*>(), QScriptValue());
QScriptValue proto = engine->newVariant(qVariantFromValue((QWizardPage*)0));
proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QWidget*>()));
for (int i = 0; i < 14; ++i) {
QScriptValue fun = engine->newFunction(qtscript_QWizardPage_prototype_call, function_lengths[i+1]);
fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
proto.setProperty(QString::fromLatin1(qtscript_QWizardPage_function_names[i+1]),
fun, QScriptValue::SkipInEnumeration);
}
qScriptRegisterMetaType<QWizardPage*>(engine, qtscript_QWizardPage_toScriptValue,
qtscript_QWizardPage_fromScriptValue, proto);
To copy to clipboard, switch view to plain text mode
You need to get the prototype of the QWizardPage, set it as prototype of your own class and add the function calls you need.
HIH
Joh
Bookmarks