本文整理汇总了C++中qScriptRegisterMetaType函数的典型用法代码示例。如果您正苦于以下问题:C++ qScriptRegisterMetaType函数的具体用法?C++ qScriptRegisterMetaType怎么用?C++ qScriptRegisterMetaType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qScriptRegisterMetaType函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupQWebSecurityOriginProto
void setupQWebSecurityOriginProto(QScriptEngine *engine)
{
//qScriptRegisterMetaType(engine, QWebSecurityOriginToScriptValue, QWebSecurityOriginFromScriptValue);
qScriptRegisterMetaType(engine, QWebSecurityOriginPointerToScriptValue, QWebSecurityOriginPointerFromScriptValue);
QScriptValue::PropertyFlags permanent = QScriptValue::ReadOnly | QScriptValue::Undeletable;
// TODO:
//qScriptRegisterMetaType(engine, QListQWebSecurityOriginToScriptValue, QListQWebSecurityOriginFromScriptValue);
QScriptValue proto = engine->newQObject(new QWebSecurityOriginProto(engine));
engine->setDefaultPrototype(qMetaTypeId<QWebSecurityOrigin*>(), proto);
//engine->setDefaultPrototype(qMetaTypeId<QWebSecurityOrigin>(), proto);
QScriptValue constructor = engine->newFunction(constructQWebSecurityOrigin, proto);
engine->globalObject().setProperty("QWebSecurityOrigin", constructor);
qScriptRegisterMetaType(engine, SubdomainSettingToScriptValue, SubdomainSettingFromScriptValue);
constructor.setProperty("AllowSubdomains", QScriptValue(engine, QWebSecurityOrigin::AllowSubdomains), permanent);
constructor.setProperty("DisallowSubdomains", QScriptValue(engine, QWebSecurityOrigin::DisallowSubdomains), permanent);
QScriptValue addLocalScheme = engine->newFunction(addLocalSchemeForJS);
constructor.setProperty("addLocalScheme", addLocalScheme);
//QScriptValue allOrigins = engine->newFunction(allOriginsForJS);
//constructor.setProperty("allOrigins", allOrigins);
QScriptValue localSchemes = engine->newFunction(localSchemesForJS);
constructor.setProperty("localSchemes", localSchemes);
QScriptValue removeLocalScheme = engine->newFunction(removeLocalSchemeForJS);
constructor.setProperty("removeLocalScheme", removeLocalScheme);
}
示例2: setupQDnsLookupProto
void setupQDnsLookupProto(QScriptEngine *engine)
{
QScriptValue::PropertyFlags permanent = QScriptValue::ReadOnly | QScriptValue::Undeletable;
QScriptValue proto = engine->newQObject(new QDnsLookupProto(engine));
engine->setDefaultPrototype(qMetaTypeId<QDnsLookup*>(), proto);
//engine->setDefaultPrototype(qMetaTypeId<QDnsLookup>(), proto);
QScriptValue constructor = engine->newFunction(constructQDnsLookup, proto);
engine->globalObject().setProperty("QDnsLookup", constructor);
qScriptRegisterMetaType(engine, DnsLookupErrorToScriptValue, DnsLookupErrorFromScriptValue);
constructor.setProperty("NoError", QScriptValue(engine, QDnsLookup::NoError), permanent);
constructor.setProperty("ResolverError", QScriptValue(engine, QDnsLookup::ResolverError), permanent);
constructor.setProperty("OperationCancelledError", QScriptValue(engine, QDnsLookup::OperationCancelledError), permanent);
constructor.setProperty("InvalidRequestError", QScriptValue(engine, QDnsLookup::InvalidRequestError), permanent);
constructor.setProperty("InvalidReplyError", QScriptValue(engine, QDnsLookup::InvalidReplyError), permanent);
constructor.setProperty("ServerFailureError", QScriptValue(engine, QDnsLookup::ServerFailureError), permanent);
constructor.setProperty("ServerRefusedError", QScriptValue(engine, QDnsLookup::ServerRefusedError), permanent);
constructor.setProperty("NotFoundError", QScriptValue(engine, QDnsLookup::NotFoundError), permanent);
qScriptRegisterMetaType(engine, DnsLookupTypeToScriptValue, DnsLookupTypeFromScriptValue);
constructor.setProperty("A", QScriptValue(engine, QDnsLookup::A), permanent);
constructor.setProperty("AAAA", QScriptValue(engine, QDnsLookup::AAAA), permanent);
constructor.setProperty("ANY", QScriptValue(engine, QDnsLookup::ANY), permanent);
constructor.setProperty("CNAME", QScriptValue(engine, QDnsLookup::CNAME), permanent);
constructor.setProperty("MX", QScriptValue(engine, QDnsLookup::MX), permanent);
constructor.setProperty("NS", QScriptValue(engine, QDnsLookup::NS), permanent);
constructor.setProperty("PTR", QScriptValue(engine, QDnsLookup::PTR), permanent);
constructor.setProperty("SRV", QScriptValue(engine, QDnsLookup::SRV), permanent);
constructor.setProperty("TXT", QScriptValue(engine, QDnsLookup::TXT), permanent);
}
示例3: ExposeCoreTypes
void ExposeCoreTypes(QScriptEngine *engine)
{
qScriptRegisterMetaType(engine, toScriptValueColor, fromScriptValueColor);
qScriptRegisterMetaType(engine, toScriptValueAssetReference, fromScriptValueAssetReference);
qScriptRegisterMetaType(engine, toScriptValueAssetReferenceList, fromScriptValueAssetReferenceList);
qScriptRegisterMetaType(engine, toScriptValueEntityReference, fromScriptValueEntityReference);
qScriptRegisterMetaType<ComponentPtr>(engine, qScriptValueFromBoostSharedPtr, qScriptValueToBoostSharedPtr);
qScriptRegisterMetaType<IAttribute*>(engine, toScriptValueIAttribute, fromScriptValueIAttribute);
qScriptRegisterMetaType<ScenePtr>(engine, qScriptValueFromBoostSharedPtr, qScriptValueToBoostSharedPtr);
qScriptRegisterMetaType<EntityPtr>(engine, qScriptValueFromBoostSharedPtr, qScriptValueToBoostSharedPtr);
qScriptRegisterMetaType<ComponentPtr>(engine, qScriptValueFromBoostSharedPtr, qScriptValueToBoostSharedPtr);
qScriptRegisterMetaType<QList<Entity*> >(engine, toScriptValueEntityList, fromScriptValueEntityList);
qScriptRegisterMetaType<QList<QObject*> >(engine, toScriptValueQObjectList, fromScriptValueQObjectList);
qScriptRegisterMetaType<EntityList>(engine, toScriptValueEntityStdList, fromScriptValueEntityStdList);
qScriptRegisterMetaType<Scene::EntityMap>(engine, toScriptValueEntityMap, fromScriptValueEntityMap);
qScriptRegisterMetaType<Entity::ComponentMap>(engine, toScriptValueComponentMap, fromScriptValueComponentMap);
qScriptRegisterMetaType<Entity::ComponentVector>(engine, toScriptValueComponentVector, fromScriptValueComponentVector);
qScriptRegisterMetaType<std::string>(engine, toScriptValueStdString, fromScriptValueStdString);
// Register constructors
QScriptValue ctorColor = engine->newFunction(createColor);
engine->globalObject().setProperty("Color", ctorColor);
engine->globalObject().property("Color").setProperty("fromString", engine->newFunction(Color_prototype_FromString));
QScriptValue ctorAssetReference = engine->newFunction(createAssetReference);
engine->globalObject().setProperty("AssetReference", ctorAssetReference);
QScriptValue ctorAssetReferenceList = engine->newFunction(createAssetReferenceList);
engine->globalObject().setProperty("AssetReferenceList", ctorAssetReferenceList);
}
示例4: qScriptRegisterMetaType
Env::Env()
{
qScriptRegisterSequenceMetaType< QVector<float> >(this);
qScriptRegisterSequenceMetaType<Point3Vector>(this);
qScriptRegisterSequenceMetaType<QVector<VCGVertexSI*> >(this);
qScriptRegisterMetaType(this,MeshModelScriptInterfaceToScriptValue,MeshModelScriptInterfaceFromScriptValue);
qScriptRegisterMetaType(this,VCGVertexScriptInterfaceToScriptValue,VCGVertexScriptInterfaceFromScriptValue);
QScriptValue fun = newFunction(myprint, 1);
globalObject().setProperty("print", fun);
QScriptValue addfun = newFunction(VCGPoint3SI_addV3, 2);
globalObject().setProperty("addV3", addfun);
QScriptValue multfun = newFunction(VCGPoint3SI_multV3S, 2);
globalObject().setProperty("multV3S", multfun);
QScriptValue envwrap_ctor = newFunction(EnvWrap_ctor);
//eng->setDefaultPrototype(qMetaTypeId<EnvWrap>(), envwrap_ctor.property("prototype"));
globalObject().setProperty("EnvWrap",envwrap_ctor);
QScriptValue env_ctor = newFunction(Env_ctor);
QScriptValue metaObject = newQMetaObject(&Env::staticMetaObject, env_ctor);
globalObject().setProperty("Env", metaObject);
QScriptValue point_ctor = newFunction(VCGPoint3ScriptInterface_ctor);
//QScriptValue pointmetaObject = newQMetaObject(&VCGPoint3fSI::staticMetaObject, point_ctor);
setDefaultPrototype(qMetaTypeId<VCGPoint3SI>(), point_ctor.property("prototype"));
globalObject().setProperty("VCGPoint3", point_ctor);
//qScriptRegisterMetaType(this,Point3fToScriptValue,Point3fFromScriptValue);
QScriptValue shot_ctor = newFunction(ShotSI_ctor);
globalObject().setProperty(MLXMLElNames::shotType, shot_ctor);
QScriptValue shot_defctor = newFunction(ShotSI_defctor);
globalObject().setProperty(MLXMLElNames::shotType + "DefCtor", shot_defctor);
}
示例5: registerWrappers
void registerWrappers(QScriptEngine* engine )
{
qScriptRegisterMetaType(engine, scriptValueFromPosition, PositionFromScriptValue );
qScriptRegisterMetaType(engine, scriptValueFromQRect, QRectFromScriptValue );
registerProtoType(QFileInfo, QFileInfoPrototype);
registerProtoType(QDir,QDirPrototype);
}
示例6: qScriptRegisterMetaType
void ControllerScriptingInterface::registerControllerTypes(QScriptEngine* engine) {
qScriptRegisterSequenceMetaType<QVector<UserInputMapper::Action> >(engine);
qScriptRegisterSequenceMetaType<QVector<UserInputMapper::InputChannel> >(engine);
qScriptRegisterSequenceMetaType<QVector<UserInputMapper::InputPair> >(engine);
qScriptRegisterMetaType(engine, actionToScriptValue, actionFromScriptValue);
qScriptRegisterMetaType(engine, inputChannelToScriptValue, inputChannelFromScriptValue);
qScriptRegisterMetaType(engine, inputToScriptValue, inputFromScriptValue);
qScriptRegisterMetaType(engine, inputPairToScriptValue, inputPairFromScriptValue);
}
示例7: setupQMessageBox
void setupQMessageBox(QScriptEngine *engine)
{
QScriptValue widget = engine->newObject();
qScriptRegisterMetaType(engine, MessageBoxButtonRoletoScriptValue,
MessageBoxButtonRolefromScriptValue);
widget.setProperty("InvalidRole", QScriptValue(engine, QMessageBox::InvalidRole), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("AcceptRole", QScriptValue(engine, QMessageBox::AcceptRole), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("RejectRole", QScriptValue(engine, QMessageBox::RejectRole), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("DestructiveRole",QScriptValue(engine, QMessageBox::DestructiveRole),QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("ActionRole", QScriptValue(engine, QMessageBox::ActionRole), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("HelpRole", QScriptValue(engine, QMessageBox::HelpRole), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("YesRole", QScriptValue(engine, QMessageBox::YesRole), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("NoRole", QScriptValue(engine, QMessageBox::NoRole), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("ApplyRole", QScriptValue(engine, QMessageBox::ApplyRole), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("ResetRole", QScriptValue(engine, QMessageBox::ResetRole), QScriptValue::ReadOnly | QScriptValue::Undeletable);
qScriptRegisterMetaType(engine, MessageBoxIcontoScriptValue,
MessageBoxIconfromScriptValue);
widget.setProperty("NoIcon", QScriptValue(engine, QMessageBox::NoIcon), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("Question", QScriptValue(engine, QMessageBox::Question), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("Information", QScriptValue(engine, QMessageBox::Information), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("Warning", QScriptValue(engine, QMessageBox::Warning), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("Critical", QScriptValue(engine, QMessageBox::Critical), QScriptValue::ReadOnly | QScriptValue::Undeletable);
qScriptRegisterMetaType(engine, MessageBoxStandardButtontoScriptValue,
MessageBoxStandardButtonfromScriptValue);
widget.setProperty("Ok", QScriptValue(engine, QMessageBox::Ok), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("Open", QScriptValue(engine, QMessageBox::Open), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("Save", QScriptValue(engine, QMessageBox::Save), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("Cancel", QScriptValue(engine, QMessageBox::Cancel), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("Close", QScriptValue(engine, QMessageBox::Close), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("Discard", QScriptValue(engine, QMessageBox::Discard), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("Apply", QScriptValue(engine, QMessageBox::Apply), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("Reset", QScriptValue(engine, QMessageBox::Reset), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("RestoreDefaults",QScriptValue(engine, QMessageBox::RestoreDefaults),QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("Help", QScriptValue(engine, QMessageBox::Help), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("SaveAll", QScriptValue(engine, QMessageBox::SaveAll), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("Yes", QScriptValue(engine, QMessageBox::Yes), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("YesToAll", QScriptValue(engine, QMessageBox::YesToAll), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("No", QScriptValue(engine, QMessageBox::No), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("NoToAll", QScriptValue(engine, QMessageBox::NoToAll), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("Abort", QScriptValue(engine, QMessageBox::Abort), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("Retry", QScriptValue(engine, QMessageBox::Retry), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("Ignore", QScriptValue(engine, QMessageBox::Ignore), QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("NoButton", QScriptValue(engine, QMessageBox::NoButton), QScriptValue::ReadOnly | QScriptValue::Undeletable);
engine->globalObject().setProperty("QMessageBox", widget, QScriptValue::ReadOnly | QScriptValue::Undeletable);
widget.setProperty("about", engine->newFunction(scriptAbout));
widget.setProperty("aboutQt", engine->newFunction(scriptAboutQt));
widget.setProperty("critical", engine->newFunction(scriptCritical));
widget.setProperty("information",engine->newFunction(scriptInformation));
widget.setProperty("question", engine->newFunction(scriptQuestion));
widget.setProperty("warning", engine->newFunction(scriptWarning));
}
示例8: QScriptEngine
bool KateScript::load()
{
if(m_loaded)
return m_loadSuccessful;
m_loaded = true;
m_loadSuccessful = false; // here set to false, and at end of function to true
// read the script file into memory
QString source;
if (m_inputType == InputURL) {
if (!Kate::Script::readFile(m_url, source)) {
return false;
}
} else source = m_script;
// create script engine, register meta types
m_engine = new QScriptEngine();
qScriptRegisterMetaType (m_engine, cursorToScriptValue, cursorFromScriptValue);
qScriptRegisterMetaType (m_engine, rangeToScriptValue, rangeFromScriptValue);
// export read & require function and add the require guard object
m_engine->globalObject().setProperty("read", m_engine->newFunction(Kate::Script::read));
m_engine->globalObject().setProperty("require", m_engine->newFunction(Kate::Script::require));
m_engine->globalObject().setProperty("require_guard", m_engine->newObject());
// export debug function
m_engine->globalObject().setProperty("debug", m_engine->newFunction(Kate::Script::debug));
// export translation functions
m_engine->globalObject().setProperty("i18n", m_engine->newFunction(Kate::Script::i18n));
m_engine->globalObject().setProperty("i18nc", m_engine->newFunction(Kate::Script::i18nc));
m_engine->globalObject().setProperty("i18ncp", m_engine->newFunction(Kate::Script::i18ncp));
m_engine->globalObject().setProperty("i18np", m_engine->newFunction(Kate::Script::i18np));
// register scripts itself
QScriptValue result = m_engine->evaluate(source, m_url);
if (hasException(result, m_url))
return false;
// AFTER SCRIPT: set the view/document objects as necessary
m_engine->globalObject().setProperty("document", m_engine->newQObject(m_document = new KateScriptDocument()));
m_engine->globalObject().setProperty("view", m_engine->newQObject(m_view = new KateScriptView()));
// yip yip!
m_loadSuccessful = true;
// load i18n catalog if available
if (!generalHeader().catalog().isEmpty()) {
kDebug() << "loading i18n catalog" << generalHeader().catalog();
KGlobal::locale()->insertCatalog(generalHeader().catalog());
}
return true;
}
示例9: setupQActionProto
void setupQActionProto(QScriptEngine *engine)
{
qScriptRegisterMetaType(engine, QActiontoScriptValue, QActionfromScriptValue);
qScriptRegisterMetaType(engine, QActionListtoScriptValue, QActionListfromScriptValue);
QScriptValue proto = engine->newQObject(new QActionProto(engine));
engine->setDefaultPrototype(qMetaTypeId<QAction*>(), proto);
QScriptValue constructor = engine->newFunction(constructQAction,
proto);
engine->globalObject().setProperty("QAction", constructor);
}
示例10: QScriptClass
ScriptMessage::ScriptMessage(QScriptEngine *engine) : QScriptClass(engine)
{
debug() << Q_FUNC_INFO;
m_incoming = engine->toStringHandle(QLatin1String("incoming"));
ScriptEngineData::data(engine)->message = this;
qScriptRegisterMetaType(engine, messageToScriptValue, messageFromScriptValue);
qScriptRegisterMetaType(engine, messagePtrToScriptValue, messagePtrFromScriptValue);
qRegisterMetaType<qutim_sdk_0_3::Message>("qutim_sdk_0_3::Message&");
m_prototype = engine->newObject(this);
QScriptValue ctor = engine->newFunction(createMessage);
engine->globalObject().setProperty(name(), ctor);
}
示例11: m_kileInfo
ScriptEnvironment::ScriptEnvironment(KileInfo *kileInfo,
KileScriptView *scriptView, KileScriptDocument *scriptDocument,
KileScriptObject *scriptObject, const QString &pluginCode)
: m_kileInfo(kileInfo), m_scriptView(scriptView), m_scriptDocument(scriptDocument),
m_kileScriptObject(scriptObject), m_enginePluginCode(pluginCode)
{
KILE_DEBUG() << "create ScriptEnvironment";
m_engine = new QScriptEngine();
qScriptRegisterMetaType(m_engine, cursorToScriptValue, cursorFromScriptValue);
qScriptRegisterMetaType(m_engine, rangeToScriptValue, rangeFromScriptValue);
}
示例12: registerMetaTypes
void registerMetaTypes(QScriptEngine* engine) {
qScriptRegisterMetaType(engine, vec4toScriptValue, vec4FromScriptValue);
qScriptRegisterMetaType(engine, vec3toScriptValue, vec3FromScriptValue);
qScriptRegisterMetaType(engine, vec2toScriptValue, vec2FromScriptValue);
qScriptRegisterMetaType(engine, quatToScriptValue, quatFromScriptValue);
qScriptRegisterMetaType(engine, xColorToScriptValue, xColorFromScriptValue);
qScriptRegisterMetaType(engine, qColorToScriptValue, qColorFromScriptValue);
qScriptRegisterMetaType(engine, pickRayToScriptValue, pickRayFromScriptValue);
qScriptRegisterMetaType(engine, collisionToScriptValue, collisionFromScriptValue);
qScriptRegisterMetaType(engine, quuidToScriptValue, quuidFromScriptValue);
}
示例13: register_Transform_prototype
QScriptValue register_Transform_prototype(QScriptEngine *engine)
{
QScriptValue proto = engine->newObject();
proto.setProperty("SetPos", engine->newFunction(Transform_SetPos_selector, 1), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("SetPos", engine->newFunction(Transform_SetPos_selector, 3), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("SetRotation", engine->newFunction(Transform_SetRotation_float_float_float, 3), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("SetScale", engine->newFunction(Transform_SetScale_selector, 3), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("SetScale", engine->newFunction(Transform_SetScale_selector, 1), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("ToFloat3x4", engine->newFunction(Transform_ToFloat3x4_const, 0), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("ToFloat4x4", engine->newFunction(Transform_ToFloat4x4_const, 0), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("FromFloat3x4", engine->newFunction(Transform_FromFloat3x4_float3x4, 1), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("FromFloat4x4", engine->newFunction(Transform_FromFloat4x4_float4x4, 1), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("SetRotationAndScale", engine->newFunction(Transform_SetRotationAndScale_float3x3, 1), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("SetOrientation", engine->newFunction(Transform_SetOrientation_selector, 1), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("Orientation3x3", engine->newFunction(Transform_Orientation3x3_const, 0), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("Orientation", engine->newFunction(Transform_Orientation_const, 0), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("Mul", engine->newFunction(Transform_Mul_Transform_const, 1), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("toString", engine->newFunction(Transform_toString_const, 0), QScriptValue::Undeletable | QScriptValue::ReadOnly);
proto.setProperty("metaTypeId", engine->toScriptValue<qint32>((qint32)qMetaTypeId<Transform>()));
engine->setDefaultPrototype(qMetaTypeId<Transform>(), proto);
engine->setDefaultPrototype(qMetaTypeId<Transform*>(), proto);
qScriptRegisterMetaType(engine, ToScriptValue_Transform, FromScriptValue_Transform, proto);
QScriptValue ctor = engine->newFunction(Transform_ctor, proto, 3);
engine->globalObject().setProperty("Transform", ctor, QScriptValue::Undeletable | QScriptValue::ReadOnly);
return ctor;
}
示例14: qScriptRegisterMetaType
void STexture::installInEngine(QScriptEngine *engine, QGLWidget *context, unsigned long frameTexture)
{
qScriptRegisterMetaType(engine, stextureToScriptValue, stextureFromScriptValue);
STexture *frametex = new STexture(context, frameTexture, false);
QScriptValue s = engine->newQObject(frametex, QScriptEngine::ScriptOwnership);
engine->globalObject().setProperty("inputFrame", s, QScriptValue::ReadOnly);
}
示例15: qScriptRegisterMetaType
void PERPScriptExtensionPlugin::initialize ( const QString & key, QScriptEngine * engine )
{
if ( key == KEY_PERP ) {
QScriptValue impositionValue = engine->scriptValueFromQMetaObject<Imposition>();
engine->globalObject().setProperty("Imposition", impositionValue);
qScriptRegisterMetaType(engine, Imposition::toScriptValueSharedPointer, Imposition::fromScriptValueSharedPointer);
}
}