本文整理汇总了C++中qScriptRegisterMetaType函数的典型用法代码示例。如果您正苦于以下问题:C++ qScriptRegisterMetaType函数的具体用法?C++ qScriptRegisterMetaType怎么用?C++ qScriptRegisterMetaType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qScriptRegisterMetaType函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:29,代码来源:qwebsecurityoriginproto.cpp
示例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);
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:32,代码来源:qdnslookupproto.cpp
示例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);
}
开发者ID:katik,项目名称:naali,代码行数:30,代码来源:ScriptCoreTypeDefines.cpp
示例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);
}
开发者ID:Jerdak,项目名称:meshlab,代码行数:34,代码来源:scriptinterface.cpp
示例5: registerWrappers
void registerWrappers(QScriptEngine* engine )
{
qScriptRegisterMetaType(engine, scriptValueFromPosition, PositionFromScriptValue );
qScriptRegisterMetaType(engine, scriptValueFromQRect, QRectFromScriptValue );
registerProtoType(QFileInfo, QFileInfoPrototype);
registerProtoType(QDir,QDirPrototype);
}
开发者ID:qtproject,项目名称:playground-qt-creator-plugin-scripting,代码行数:8,代码来源:scriptwrappers.cpp
示例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);
}
开发者ID:Ian-Mills,项目名称:hifi,代码行数:9,代码来源:ControllerScriptingInterface.cpp
示例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));
}
开发者ID:AlFoX,项目名称:qt-client,代码行数:56,代码来源:qmessageboxsetup.cpp
示例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;
}
开发者ID:azat-archive,项目名称:kate,代码行数:54,代码来源:katescript.cpp
示例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);
}
开发者ID:Wushaowei001,项目名称:xtuple-1,代码行数:12,代码来源:qactionproto.cpp
示例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);
}
开发者ID:CyberSys,项目名称:qutim,代码行数:12,代码来源:scriptmessage.cpp
示例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);
}
开发者ID:fagu,项目名称:kileip,代码行数:12,代码来源:script.cpp
示例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);
}
开发者ID:CoderPaulK,项目名称:hifi,代码行数:11,代码来源:RegisteredMetaTypes.cpp
示例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;
}
开发者ID:katik,项目名称:naali,代码行数:28,代码来源:qscript_Transform.cpp
示例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);
}
开发者ID:jpilet,项目名称:polyora,代码行数:7,代码来源:stexture.cpp
示例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);
}
}
开发者ID:BaconGo,项目名称:alepherp,代码行数:8,代码来源:perpscriptextensionplugin.cpp
示例16: setupQIODeviceProto
void setupQIODeviceProto(QScriptEngine *engine)
{
qScriptRegisterMetaType(engine, QIODevicetoScriptValue, QIODevicefromScriptValue);
QScriptValue iodev = engine->newObject();
engine->globalObject().setProperty("QIODevice", iodev, QScriptValue::ReadOnly | QScriptValue::Undeletable);
qScriptRegisterMetaType(engine, OpenModeToScriptValue, OpenModeFromScriptValue);
qScriptRegisterMetaType(engine, OpenModeFlagToScriptValue, OpenModeFlagFromScriptValue);
iodev.setProperty("NotOpen", QScriptValue(engine, QIODevice::NotOpen), ENUMPROPFLAGS);
iodev.setProperty("ReadOnly", QScriptValue(engine, QIODevice::ReadOnly), ENUMPROPFLAGS);
iodev.setProperty("WriteOnly", QScriptValue(engine, QIODevice::WriteOnly), ENUMPROPFLAGS);
iodev.setProperty("ReadWrite", QScriptValue(engine, QIODevice::ReadWrite), ENUMPROPFLAGS);
iodev.setProperty("Append", QScriptValue(engine, QIODevice::Append), ENUMPROPFLAGS);
iodev.setProperty("Truncate", QScriptValue(engine, QIODevice::Truncate), ENUMPROPFLAGS);
iodev.setProperty("Text", QScriptValue(engine, QIODevice::Text), ENUMPROPFLAGS);
iodev.setProperty("Unbuffered", QScriptValue(engine, QIODevice::Unbuffered), ENUMPROPFLAGS);
}
开发者ID:xtuple,项目名称:qt-client,代码行数:18,代码来源:qiodeviceproto.cpp
示例17: setupGuiErrorCheck
void setupGuiErrorCheck(QScriptEngine *engine)
{
qScriptRegisterMetaType(engine, QListGuiErrorChecktoScriptValue, QListGuiErrorCheckfromScriptValue);
QScriptValue constructor = engine->newFunction(constructGuiErrorCheck);
engine->globalObject().setProperty("GuiErrorCheck", constructor, CTORPROPFLAGS);
constructor.setProperty("reportErrors", engine->newFunction(guierrorcheck_reporterrors), STATICPROPFLAGS);
}
开发者ID:szuke,项目名称:qt-client,代码行数:9,代码来源:guiErrorCheck.cpp
示例18: registerMetaTypes
void ScriptEngine::init() {
if (_isInitialized) {
return; // only initialize once
}
_isInitialized = true;
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
entityScriptingInterface->init();
// register various meta-types
registerMetaTypes(this);
registerMIDIMetaTypes(this);
registerEventTypes(this);
registerMenuItemProperties(this);
registerAnimationTypes(this);
registerAvatarTypes(this);
registerAudioMetaTypes(this);
if (_controllerScriptingInterface) {
_controllerScriptingInterface->registerControllerTypes(this);
}
qScriptRegisterMetaType(this, EntityItemPropertiesToScriptValue, EntityItemPropertiesFromScriptValueHonorReadOnly);
qScriptRegisterMetaType(this, EntityItemIDtoScriptValue, EntityItemIDfromScriptValue);
qScriptRegisterMetaType(this, RayToEntityIntersectionResultToScriptValue, RayToEntityIntersectionResultFromScriptValue);
qScriptRegisterSequenceMetaType<QVector<QUuid>>(this);
qScriptRegisterSequenceMetaType<QVector<EntityItemID>>(this);
qScriptRegisterSequenceMetaType<QVector<glm::vec2> >(this);
qScriptRegisterSequenceMetaType<QVector<glm::quat> >(this);
qScriptRegisterSequenceMetaType<QVector<QString> >(this);
QScriptValue xmlHttpRequestConstructorValue = newFunction(XMLHttpRequestClass::constructor);
globalObject().setProperty("XMLHttpRequest", xmlHttpRequestConstructorValue);
QScriptValue printConstructorValue = newFunction(debugPrint);
globalObject().setProperty("print", printConstructorValue);
QScriptValue audioEffectOptionsConstructorValue = newFunction(AudioEffectOptions::constructor);
globalObject().setProperty("AudioEffectOptions", audioEffectOptionsConstructorValue);
qScriptRegisterMetaType(this, injectorToScriptValue, injectorFromScriptValue);
qScriptRegisterMetaType(this, inputControllerToScriptValue, inputControllerFromScriptValue);
qScriptRegisterMetaType(this, avatarDataToScriptValue, avatarDataFromScriptValue);
qScriptRegisterMetaType(this, animationDetailsToScriptValue, animationDetailsFromScriptValue);
registerGlobalObject("Script", this);
registerGlobalObject("Audio", &AudioScriptingInterface::getInstance());
registerGlobalObject("Controller", _controllerScriptingInterface);
registerGlobalObject("Entities", entityScriptingInterface.data());
registerGlobalObject("Quat", &_quatLibrary);
registerGlobalObject("Vec3", &_vec3Library);
registerGlobalObject("Uuid", &_uuidLibrary);
registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>().data());
// constants
globalObject().setProperty("TREE_SCALE", newVariant(QVariant(TREE_SCALE)));
}
开发者ID:CiaranLaval,项目名称:hifi,代码行数:59,代码来源:ScriptEngine.cpp
示例19: QObject
StelScriptMgr::StelScriptMgr(QObject *parent): QObject(parent)
{
connect(&StelApp::getInstance(), SIGNAL(aboutToQuit()), this, SLOT(stopScript()), Qt::DirectConnection);
// Scripting images
ScreenImageMgr* scriptImages = new ScreenImageMgr();
scriptImages->init();
StelApp::getInstance().getModuleMgr().registerModule(scriptImages);
// Allow Vec3f managment in scripts
qScriptRegisterMetaType(&engine, vec3fToScriptValue, vec3fFromScriptValue);
// Constructor
QScriptValue ctor = engine.newFunction(createVec3f);
engine.globalObject().setProperty("Vec3f", ctor);
// Add the core object to access methods related to core
mainAPI = new StelMainScriptAPI(this);
QScriptValue objectValue = engine.newQObject(mainAPI);
engine.globalObject().setProperty("core", objectValue);
engine.evaluate("function mywait__(sleepDurationSec) {"
"if (sleepDurationSec<0) return;"
"var date = new Date();"
"var curDate = null;"
"do {curDate = new Date();}"
"while(curDate-date < sleepDurationSec*1000/scriptRateReadOnly);}");
engine.evaluate("core['wait'] = mywait__;");
engine.evaluate("function mywaitFor__(dt, spec) {"
"if (!spec) spec=\"utc\";"
"var deltaJD = core.jdFromDateString(dt, spec) - core.getJDay();"
"var timeSpeed = core.getTimeRate();"
"if (timeSpeed == 0.) {core.debug(\"waitFor called with no time passing - would be infinite. not waiting!\"); return;}"
"var date = new Date();"
"var curDate = null;"
"do {curDate = new Date();}"
"while(curDate-date < deltaJD*86400000/timeSpeed);}");
engine.evaluate("core['waitFor'] = mywaitFor__;");
// Add other classes which we want to be directly accessible from scripts
if(StelSkyLayerMgr* smgr = GETSTELMODULE(StelSkyLayerMgr))
objectValue = engine.newQObject(smgr);
// For accessing star scale, twinkle etc.
objectValue = engine.newQObject(StelApp::getInstance().getCore()->getSkyDrawer());
engine.globalObject().setProperty("StelSkyDrawer", objectValue);
setScriptRate(1.0);
engine.setProcessEventsInterval(10);
agent = new StelScriptEngineAgent(&engine);
engine.setAgent(agent);
initActions();
}
开发者ID:adenola-ahmed-wm,项目名称:stellarium,代码行数:56,代码来源:StelScriptMgr.cpp
示例20: setupQSpacerItem
void setupQSpacerItem(QScriptEngine *engine)
{
qScriptRegisterMetaType(engine, QSpacerItemtoScriptValue, QSpacerItemfromScriptValue);
QScriptValue proto = engine->newQObject(new QSpacerItemProto(engine));
engine->setDefaultPrototype(qMetaTypeId<QSpacerItem*>(), proto);
QScriptValue constructor = engine->newFunction(constructQSpacerItem, proto);
engine->globalObject().setProperty("QSpacerItem", constructor);
}
开发者ID:AlFoX,项目名称:qt-client,代码行数:10,代码来源:qspaceritemproto.cpp
注:本文中的qScriptRegisterMetaType函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论