当前位置: 首页>>代码示例>>C++>>正文


C++ QScriptValue::setPrototype方法代码示例

本文整理汇总了C++中QScriptValue::setPrototype方法的典型用法代码示例。如果您正苦于以下问题:C++ QScriptValue::setPrototype方法的具体用法?C++ QScriptValue::setPrototype怎么用?C++ QScriptValue::setPrototype使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QScriptValue的用法示例。


在下文中一共展示了QScriptValue::setPrototype方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: qtscript_create_QTextImageFormat_class

QScriptValue qtscript_create_QTextImageFormat_class(QScriptEngine *engine)
{
    engine->setDefaultPrototype(qMetaTypeId<QTextImageFormat*>(), QScriptValue());
    QScriptValue proto = engine->newVariant(qVariantFromValue((QTextImageFormat*)0));
    proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QTextCharFormat*>()));
    for (int i = 0; i < 7; ++i) {
        QScriptValue fun = engine->newFunction(qtscript_QTextImageFormat_prototype_call, qtscript_QTextImageFormat_function_lengths[i+1]);
        fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
        proto.setProperty(QString::fromLatin1(qtscript_QTextImageFormat_function_names[i+1]),
            fun, QScriptValue::SkipInEnumeration);
    }

    engine->setDefaultPrototype(qMetaTypeId<QTextImageFormat>(), proto);
    engine->setDefaultPrototype(qMetaTypeId<QTextImageFormat*>(), proto);

    QScriptValue ctor = engine->newFunction(qtscript_QTextImageFormat_static_call, proto, qtscript_QTextImageFormat_function_lengths[0]);
    ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));

    return ctor;
}
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:20,代码来源:qtscript_QTextImageFormat.cpp

示例2: qtscript_create_QCommonStyle_class

QScriptValue qtscript_create_QCommonStyle_class(QScriptEngine *engine)
{
    static const int function_lengths[] = {
        0
        // static
        // prototype
        , 0
    };
    engine->setDefaultPrototype(qMetaTypeId<QCommonStyle*>(), QScriptValue());
    QScriptValue proto = engine->newVariant(qVariantFromValue((QCommonStyle*)0));
    proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QStyle*>()));

    qScriptRegisterMetaType<QCommonStyle*>(engine, qtscript_QCommonStyle_toScriptValue, 
        qtscript_QCommonStyle_fromScriptValue, proto);

    QScriptValue ctor = engine->newFunction(qtscript_QCommonStyle_static_call, proto, function_lengths[0]);
    ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));

    return ctor;
}
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:20,代码来源:qtscript_QCommonStyle.cpp

示例3: for

template<> inline QScriptValue qscriptQMetaObjectConstructor<UniversalInputDialogScript>(QScriptContext *ctx, QScriptEngine *eng, UniversalInputDialogScript *) 
{ 
	UniversalInputDialogScript * t = new UniversalInputDialogScript(eng, 0); 
	
	if (ctx->argumentCount()) {
		if (!ctx->argument(0).isArray() || !(ctx->argument(1).isArray() || ctx->argument(1).isUndefined())) 
			t->add(ctx->argument(0),ctx->argument(1),ctx->argument(2));
		else for (int i=0;i<ctx->argumentCount();i++){
			const QScriptValue& sv = ctx->argument(i);
			if (!sv.isArray()) { ctx->throwError("Expected array instead of " + sv.toString()); continue; }
			t->add(sv.property(0), sv.property(1), sv.property(2));
		}
	}
	
	if (ctx->isCalledAsConstructor()) 
		return eng->newQObject(ctx->thisObject(), t, QScriptEngine::AutoOwnership); 
	QScriptValue o = eng->newQObject(t, QScriptEngine::AutoOwnership); 
	o.setPrototype(ctx->callee().property(QString::fromLatin1("prototype"))); 
	return o; 
}
开发者ID:svn2github,项目名称:texstudio-trunk,代码行数:20,代码来源:scriptengine.cpp

示例4: qtscript_create_QAbstractProxyModel_class

QScriptValue qtscript_create_QAbstractProxyModel_class(QScriptEngine *engine)
{
    engine->setDefaultPrototype(qMetaTypeId<QAbstractProxyModel*>(), QScriptValue());
    QScriptValue proto = engine->newVariant(qVariantFromValue((QAbstractProxyModel*)0));
    proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QAbstractItemModel*>()));
    for (int i = 0; i < 7; ++i) {
        QScriptValue fun = engine->newFunction(qtscript_QAbstractProxyModel_prototype_call, qtscript_QAbstractProxyModel_function_lengths[i+1]);
        fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
        proto.setProperty(QString::fromLatin1(qtscript_QAbstractProxyModel_function_names[i+1]),
                          fun, QScriptValue::SkipInEnumeration);
    }

    qScriptRegisterMetaType<QAbstractProxyModel*>(engine, qtscript_QAbstractProxyModel_toScriptValue,
            qtscript_QAbstractProxyModel_fromScriptValue, proto);

    QScriptValue ctor = engine->newFunction(qtscript_QAbstractProxyModel_static_call, proto, qtscript_QAbstractProxyModel_function_lengths[0]);
    ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));

    return ctor;
}
开发者ID:Jackieee,项目名称:qcad,代码行数:20,代码来源:qtscript_QAbstractProxyModel.cpp

示例5: qtscript_create_QNetworkReply_class

QScriptValue qtscript_create_QNetworkReply_class(QScriptEngine *engine)
{
    static const int function_lengths[] = {
        0
        // static
        // prototype
        , 0
        , 1
        , 0
        , 1
        , 1
        , 0
        , 0
        , 1
        , 0
        , 0
        , 0
        , 1
        , 0
        , 0
    };
    engine->setDefaultPrototype(qMetaTypeId<QNetworkReply*>(), QScriptValue());
    QScriptValue proto = engine->newVariant(qVariantFromValue((QNetworkReply*)0));
    proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QIODevice*>()));
    for (int i = 0; i < 14; ++i) {
        QScriptValue fun = engine->newFunction(qtscript_QNetworkReply_prototype_call, function_lengths[i+1]);
        fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
        proto.setProperty(QString::fromLatin1(qtscript_QNetworkReply_function_names[i+1]),
            fun, QScriptValue::SkipInEnumeration);
    }

    qScriptRegisterMetaType<QNetworkReply*>(engine, qtscript_QNetworkReply_toScriptValue, 
        qtscript_QNetworkReply_fromScriptValue, proto);

    QScriptValue ctor = engine->newFunction(qtscript_QNetworkReply_static_call, proto, function_lengths[0]);
    ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));

    ctor.setProperty(QString::fromLatin1("NetworkError"),
        qtscript_create_QNetworkReply_NetworkError_class(engine, ctor));
    return ctor;
}
开发者ID:SSMN,项目名称:MuseScore,代码行数:41,代码来源:qtscript_QNetworkReply.cpp

示例6: qtscript_create_QWebPluginFactory_class

QScriptValue qtscript_create_QWebPluginFactory_class(QScriptEngine *engine)
{
    engine->setDefaultPrototype(qMetaTypeId<QWebPluginFactory*>(), QScriptValue());
    QScriptValue proto = engine->newVariant(qVariantFromValue((QWebPluginFactory*)0));
    proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
    for (int i = 0; i < 6; ++i) {
        QScriptValue fun = engine->newFunction(qtscript_QWebPluginFactory_prototype_call, qtscript_QWebPluginFactory_function_lengths[i+1]);
        fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
        proto.setProperty(QString::fromLatin1(qtscript_QWebPluginFactory_function_names[i+1]),
            fun, QScriptValue::SkipInEnumeration);
    }

    qScriptRegisterMetaType<QWebPluginFactory*>(engine, qtscript_QWebPluginFactory_toScriptValue, 
        qtscript_QWebPluginFactory_fromScriptValue, proto);

    QScriptValue ctor = engine->newFunction(qtscript_QWebPluginFactory_static_call, proto, qtscript_QWebPluginFactory_function_lengths[0]);
    ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));

    ctor.setProperty(QString::fromLatin1("Extension"),
        qtscript_create_QWebPluginFactory_Extension_class(engine, ctor));
    return ctor;
}
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:22,代码来源:qtscript_QWebPluginFactory.cpp

示例7: qtscript_create_QGraphicsSceneWheelEvent_class

QScriptValue qtscript_create_QGraphicsSceneWheelEvent_class(QScriptEngine *engine)
{
    static const int function_lengths[] = {
        1
        // static
        // prototype
        , 0
        , 0
        , 0
        , 0
        , 0
        , 0
        , 0
        , 1
        , 1
        , 1
        , 1
        , 1
        , 1
        , 1
        , 0
    };
    engine->setDefaultPrototype(qMetaTypeId<QGraphicsSceneWheelEvent*>(), QScriptValue());
    QScriptValue proto = engine->newVariant(qVariantFromValue((QGraphicsSceneWheelEvent*)0));
    proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QGraphicsSceneEvent*>()));
    for (int i = 0; i < 15; ++i) {
        QScriptValue fun = engine->newFunction(qtscript_QGraphicsSceneWheelEvent_prototype_call, function_lengths[i+1]);
        fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
        proto.setProperty(QString::fromLatin1(qtscript_QGraphicsSceneWheelEvent_function_names[i+1]),
                          fun, QScriptValue::SkipInEnumeration);
    }

    engine->setDefaultPrototype(qMetaTypeId<QGraphicsSceneWheelEvent*>(), proto);

    QScriptValue ctor = engine->newFunction(qtscript_QGraphicsSceneWheelEvent_static_call, proto, function_lengths[0]);
    ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));

    return ctor;
}
开发者ID:musescore,项目名称:musescore-old,代码行数:39,代码来源:qtscript_QGraphicsSceneWheelEvent.cpp

示例8: qtscript_create_QStyleOptionMenuItem_class

QScriptValue qtscript_create_QStyleOptionMenuItem_class(QScriptEngine *engine)
{
    engine->setDefaultPrototype(qMetaTypeId<QStyleOptionMenuItem*>(), QScriptValue());
    QScriptValue proto = engine->newVariant(qVariantFromValue((QStyleOptionMenuItem*)0));
    proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QStyleOption*>()));

    engine->setDefaultPrototype(qMetaTypeId<QStyleOptionMenuItem>(), proto);
    engine->setDefaultPrototype(qMetaTypeId<QStyleOptionMenuItem*>(), proto);

    QScriptValue ctor = engine->newFunction(qtscript_QStyleOptionMenuItem_static_call, proto, qtscript_QStyleOptionMenuItem_function_lengths[0]);
    ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));

    ctor.setProperty(QString::fromLatin1("StyleOptionVersion"),
        qtscript_create_QStyleOptionMenuItem_StyleOptionVersion_class(engine, ctor));
    ctor.setProperty(QString::fromLatin1("StyleOptionType"),
        qtscript_create_QStyleOptionMenuItem_StyleOptionType_class(engine, ctor));
    ctor.setProperty(QString::fromLatin1("CheckType"),
        qtscript_create_QStyleOptionMenuItem_CheckType_class(engine, ctor));
    ctor.setProperty(QString::fromLatin1("MenuItemType"),
        qtscript_create_QStyleOptionMenuItem_MenuItemType_class(engine, ctor));
    return ctor;
}
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:22,代码来源:qtscript_QStyleOptionMenuItem.cpp

示例9: scriptFunctionSimulationConstructor

QScriptValue ScriptLoader::scriptFunctionSimulationConstructor(QScriptContext * context, QScriptEngine * engine)
{
    using namespace Strings::Script;

    QScriptValue thisObject;

    if(context->isCalledAsConstructor()) {
        thisObject = context->thisObject();
    } else {
        thisObject = engine->newObject();
        thisObject.setPrototype(context->callee().prototype());
    }

    // Bind C++ function to Simulation.run
    thisObject.setProperty(Simulation::Run, engine->newFunction(ScriptLoader::scriptFunctionSimulationRun));

    // TODO: move this to setup.js
    //Default values
    thisObject.setProperty(Simulation::Frequency, QScriptValue(engine, "0"));
    thisObject.setProperty(Simulation::Exchange, QScriptValue(engine, "0"));
    thisObject.setProperty(Simulation::Damping, QScriptValue(engine, "0"));

    QScriptValue atomLoss = engine->newObject();
    atomLoss.setProperty(AtomLoss::FromF1, QScriptValue(engine, "0"));
    atomLoss.setProperty(AtomLoss::FromF2, QScriptValue(engine, "0"));
    thisObject.setProperty(Simulation::AtomLoss, atomLoss);

    QScriptValue intialSpin = engine->newArray();
    intialSpin.setProperty(0, QScriptValue(engine, "1"));
    intialSpin.setProperty(1, QScriptValue(engine, "0"));
    intialSpin.setProperty(2, QScriptValue(engine, "0"));
    thisObject.setProperty(Simulation::InitialSpin, intialSpin);

    thisObject.setProperty(Simulation::Operations, engine->newArray());
    thisObject.setProperty(Simulation::Name, engine->undefinedValue());

    return thisObject;
}
开发者ID:Frederic-Combes,项目名称:ISRE,代码行数:38,代码来源:script.cpp

示例10: qtscript_create_QApplication_class

QScriptValue qtscript_create_QApplication_class(QScriptEngine *engine)
{
    engine->setDefaultPrototype(qMetaTypeId<QApplication*>(), QScriptValue());
    QScriptValue proto = engine->newVariant(qVariantFromValue((QApplication*)0));
    proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QGuiApplication*>()));

    qScriptRegisterMetaType<QApplication*>(engine, qtscript_QApplication_toScriptValue, 
        qtscript_QApplication_fromScriptValue, proto);

    QScriptValue ctor = engine->newFunction(qtscript_QApplication_static_call, proto, qtscript_QApplication_function_lengths[0]);
    ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
    for (int i = 0; i < 22; ++i) {
        QScriptValue fun = engine->newFunction(qtscript_QApplication_static_call,
            qtscript_QApplication_function_lengths[i+1]);
        fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
        ctor.setProperty(QString::fromLatin1(qtscript_QApplication_function_names[i+1]),
            fun, QScriptValue::SkipInEnumeration);
    }

    ctor.setProperty(QString::fromLatin1("ColorSpec"),
        qtscript_create_QApplication_ColorSpec_class(engine, ctor));
    return ctor;
}
开发者ID:eric3361229,项目名称:qcad,代码行数:23,代码来源:qtscript_QApplication.cpp

示例11: qtscript_create_QStyleHintReturnVariant_class

QScriptValue qtscript_create_QStyleHintReturnVariant_class(QScriptEngine *engine)
{
    static const int function_lengths[] = {
        0
        // static
        // prototype
        , 0
    };
    engine->setDefaultPrototype(qMetaTypeId<QStyleHintReturnVariant*>(), QScriptValue());
    QScriptValue proto = engine->newVariant(qVariantFromValue((QStyleHintReturnVariant*)0));
    proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QStyleHintReturn*>()));

    engine->setDefaultPrototype(qMetaTypeId<QStyleHintReturnVariant*>(), proto);

    QScriptValue ctor = engine->newFunction(qtscript_QStyleHintReturnVariant_static_call, proto, function_lengths[0]);
    ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));

    ctor.setProperty(QString::fromLatin1("StyleOptionVersion"),
        qtscript_create_QStyleHintReturnVariant_StyleOptionVersion_class(engine, ctor));
    ctor.setProperty(QString::fromLatin1("StyleOptionType"),
        qtscript_create_QStyleHintReturnVariant_StyleOptionType_class(engine, ctor));
    return ctor;
}
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:23,代码来源:qtscript_QStyleHintReturnVariant.cpp

示例12: qtscript_create_MediaObject_class

QScriptValue qtscript_create_MediaObject_class(QScriptEngine *engine)
{
    engine->setDefaultPrototype(qMetaTypeId<Phonon::MediaObject*>(), QScriptValue());
    QScriptValue proto = engine->newVariant(qVariantFromValue((Phonon::MediaObject*)0));
    proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
    proto.setProperty(QString::fromLatin1("__MediaNode__"),
        engine->defaultPrototype(qMetaTypeId<Phonon::MediaNode*>()),
        QScriptValue::SkipInEnumeration);
    for (int i = 0; i < 18; ++i) {
        QScriptValue fun = engine->newFunction(qtscript_MediaObject_prototype_call, qtscript_MediaObject_function_lengths[i+1]);
        fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
        proto.setProperty(QString::fromLatin1(qtscript_MediaObject_function_names[i+1]),
            fun, QScriptValue::SkipInEnumeration);
    }

    qScriptRegisterMetaType<Phonon::MediaObject*>(engine, qtscript_MediaObject_toScriptValue, 
        qtscript_MediaObject_fromScriptValue, proto);

    QScriptValue ctor = engine->newFunction(qtscript_MediaObject_static_call, proto, qtscript_MediaObject_function_lengths[0]);
    ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));

    return ctor;
}
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:23,代码来源:qtscript_MediaObject.cpp

示例13: QScriptValue

QScriptValue
BRectGenerator::engineFunction(QScriptContext* aContext,
                               QScriptEngine* aEngine)
{
  BScriptEngine* engine = static_cast<BScriptEngine*>(aEngine);

  if (aContext->argumentCount() < 1) {
    return aContext->throwError(QScriptContext::SyntaxError,
                                "Rect(frequency [, duty=0.5]) used wrongly.");
  }

  BGeneratorRef frequency = BGenerator::numberToGenerator(aContext->argument(0));
  BGeneratorRef duty;
  if (aContext->argumentCount() > 1) {
    duty = BGenerator::numberToGenerator(aContext->argument(1));
  } else {
    duty = new BNumberGenerator(0.5);
  }

  if (!frequency || !duty) {
    return aContext->throwError(QScriptContext::SyntaxError,
                                "Rect(frequency [, duty=0.5]) used wrongly.");
  }

  BRectGenerator* generator = new BRectGenerator(frequency, duty);
  engine->app()->registerGenerator(generator);

  QScriptValue object = generator->objGenerator(engine);

  if (aContext->isCalledAsConstructor()) {
    aContext->setThisObject(object);
    return QScriptValue();
  }

  object.setPrototype(aContext->callee().property("prototype"));
  return object;
}
开发者ID:bakulf,项目名称:ba,代码行数:37,代码来源:brectgenerator.cpp

示例14: qtscript_create_QLCDNumber_class

QScriptValue qtscript_create_QLCDNumber_class(QScriptEngine *engine)
{
    engine->setDefaultPrototype(qMetaTypeId<QLCDNumber*>(), QScriptValue());
    QScriptValue proto = engine->newVariant(qVariantFromValue((QLCDNumber*)0));
    proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QFrame*>()));
    for (int i = 0; i < 2; ++i) {
        QScriptValue fun = engine->newFunction(qtscript_QLCDNumber_prototype_call, qtscript_QLCDNumber_function_lengths[i+1]);
        fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
        proto.setProperty(QString::fromLatin1(qtscript_QLCDNumber_function_names[i+1]),
            fun, QScriptValue::SkipInEnumeration);
    }

    qScriptRegisterMetaType<QLCDNumber*>(engine, qtscript_QLCDNumber_toScriptValue, 
        qtscript_QLCDNumber_fromScriptValue, proto);

    QScriptValue ctor = engine->newFunction(qtscript_QLCDNumber_static_call, proto, qtscript_QLCDNumber_function_lengths[0]);
    ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));

    ctor.setProperty(QString::fromLatin1("SegmentStyle"),
        qtscript_create_QLCDNumber_SegmentStyle_class(engine, ctor));
    ctor.setProperty(QString::fromLatin1("Mode"),
        qtscript_create_QLCDNumber_Mode_class(engine, ctor));
    return ctor;
}
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:24,代码来源:qtscript_QLCDNumber.cpp

示例15: qtscript_create_QStyleOptionToolBar_class

QScriptValue qtscript_create_QStyleOptionToolBar_class(QScriptEngine *engine)
{
    engine->setDefaultPrototype(qMetaTypeId<QStyleOptionToolBar*>(), QScriptValue());
    QScriptValue proto = engine->newVariant(qVariantFromValue((QStyleOptionToolBar*)0));
    proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QStyleOption*>()));

    engine->setDefaultPrototype(qMetaTypeId<QStyleOptionToolBar>(), proto);
    engine->setDefaultPrototype(qMetaTypeId<QStyleOptionToolBar*>(), proto);

    QScriptValue ctor = engine->newFunction(qtscript_QStyleOptionToolBar_static_call, proto, qtscript_QStyleOptionToolBar_function_lengths[0]);
    ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));

    ctor.setProperty(QString::fromLatin1("StyleOptionVersion"),
        qtscript_create_QStyleOptionToolBar_StyleOptionVersion_class(engine, ctor));
    ctor.setProperty(QString::fromLatin1("ToolBarFeature"),
        qtscript_create_QStyleOptionToolBar_ToolBarFeature_class(engine, ctor));
    ctor.setProperty(QString::fromLatin1("ToolBarFeatures"),
        qtscript_create_QStyleOptionToolBar_ToolBarFeatures_class(engine));
    ctor.setProperty(QString::fromLatin1("StyleOptionType"),
        qtscript_create_QStyleOptionToolBar_StyleOptionType_class(engine, ctor));
    ctor.setProperty(QString::fromLatin1("ToolBarPosition"),
        qtscript_create_QStyleOptionToolBar_ToolBarPosition_class(engine, ctor));
    return ctor;
}
开发者ID:DanielJSlick,项目名称:qcad,代码行数:24,代码来源:qtscript_QStyleOptionToolBar.cpp


注:本文中的QScriptValue::setPrototype方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。