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


C++ qScriptValueFromValue函数代码示例

本文整理汇总了C++中qScriptValueFromValue函数的典型用法代码示例。如果您正苦于以下问题:C++ qScriptValueFromValue函数的具体用法?C++ qScriptValueFromValue怎么用?C++ qScriptValueFromValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: qtscript_QLayout_prototype_call

static QScriptValue qtscript_QLayout_prototype_call(QScriptContext *context, QScriptEngine *)
{
#if QT_VERSION > 0x040400
    Q_ASSERT(context->callee().isFunction());
    uint _id = context->callee().data().toUInt32();
#else
    uint _id;
    if (context->callee().isFunction())
        _id = context->callee().data().toUInt32();
    else
        _id = 0xBABE0000 + 24;
#endif
    Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
    _id &= 0x0000FFFF;
    QLayout* _q_self = qscriptvalue_cast<QLayout*>(context->thisObject());
    if (!_q_self) {
        return context->throwError(QScriptContext::TypeError,
            QString::fromLatin1("QLayout.%0(): this object is not a QLayout")
            .arg(qtscript_QLayout_function_names[_id+2]));
    }

    switch (_id) {
    case 0:
    if (context->argumentCount() == 0) {
        bool _q_result = _q_self->activate();
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 1:
    if (context->argumentCount() == 1) {
        QLayoutItem* _q_arg0 = qscriptvalue_cast<QLayoutItem*>(context->argument(0));
        _q_self->addItem(_q_arg0);
        return context->engine()->undefinedValue();
    }
    break;

    case 2:
    if (context->argumentCount() == 1) {
        QWidget* _q_arg0 = qscriptvalue_cast<QWidget*>(context->argument(0));
        _q_self->addWidget(_q_arg0);
        return context->engine()->undefinedValue();
    }
    break;

    case 3:
    if (context->argumentCount() == 0) {
        QMargins _q_result = _q_self->contentsMargins();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 4:
    if (context->argumentCount() == 0) {
        QRect _q_result = _q_self->contentsRect();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 5:
    if (context->argumentCount() == 0) {
        int _q_result = _q_self->count();
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 6:
    if (context->argumentCount() == 4) {
        int* _q_arg0 = qscriptvalue_cast<int*>(context->argument(0));
        int* _q_arg1 = qscriptvalue_cast<int*>(context->argument(1));
        int* _q_arg2 = qscriptvalue_cast<int*>(context->argument(2));
        int* _q_arg3 = qscriptvalue_cast<int*>(context->argument(3));
        _q_self->getContentsMargins(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
        return context->engine()->undefinedValue();
    }
    break;

    case 7:
    if (context->argumentCount() == 1) {
        QWidget* _q_arg0 = qscriptvalue_cast<QWidget*>(context->argument(0));
        int _q_result = _q_self->indexOf(_q_arg0);
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 8:
    if (context->argumentCount() == 0) {
        bool _q_result = _q_self->isEnabled();
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 9:
    if (context->argumentCount() == 1) {
        int _q_arg0 = context->argument(0).toInt32();
        QLayoutItem* _q_result = _q_self->itemAt(_q_arg0);
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

//.........这里部分代码省略.........
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:101,代码来源:qtscript_QLayout.cpp

示例2: getSelf

         QScriptValue
        REcmaPointEntity::getProperty
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaPointEntity::getProperty", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaPointEntity::getProperty";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RPointEntity* self = 
                        getSelf("getProperty", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    1 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: RPropertyTypeId */
    
    ){
    // prepare arguments:
    
                    // argument isCopyable and has default constructor and isSimpleClass 
                    RPropertyTypeId*
                    ap0 =
                    qscriptvalue_cast<
                    RPropertyTypeId*
                        >(
                        context->argument(
                        0
                        )
                    );
                    if (ap0 == NULL) {
                           return REcmaHelper::throwError("RPointEntity: Argument 0 is not of type RPropertyTypeId.",
                               context);                    
                    }
                    RPropertyTypeId 
                    a0 = 
                    *ap0;
                
    // end of arguments

    // call C++ function:
    // return type 'QPair < QVariant , RPropertyAttributes >'
    QPair < QVariant , RPropertyAttributes > cppResult =
        
               self->getProperty(a0);
        // return type: QPair < QVariant , RPropertyAttributes >
                // Pair of ...:
                //result = REcmaHelper::pairToScriptValue(engine, cppResult);
                QVariantList vl;
                QVariant v;
                
                    // first type of pair is variant:
                    if (QString(cppResult.first.typeName())=="RLineweight::Lineweight") {
                        v.setValue((int)cppResult.first.value<RLineweight::Lineweight>());
                    }
                    else {
                        v.setValue(cppResult.first);
                    }
                  

                vl.append(v);
                v.setValue(cppResult.second);
                vl.append(v);
                result = qScriptValueFromValue(engine, vl);
            
    } else


        
    
    if( context->argumentCount() ==
    2 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: RPropertyTypeId */
     && (
            context->argument(1).isBool()
        ) /* type: bool */
    
    ){
    // prepare arguments:
    
                    // argument isCopyable and has default constructor and isSimpleClass 
                    RPropertyTypeId*
                    ap0 =
                    qscriptvalue_cast<
                    RPropertyTypeId*
//.........这里部分代码省略.........
开发者ID:konysulphrea,项目名称:qcad,代码行数:101,代码来源:REcmaPointEntity.cpp

示例3: qScriptValueFromValue

 // returns class name:
  QScriptValue REcmaLinetypePattern::getClassName(QScriptContext *context, QScriptEngine *engine) 
     
 {
     return qScriptValueFromValue(engine, QString("RLinetypePattern"));
 }
开发者ID:VixMobile,项目名称:qcad,代码行数:6,代码来源:REcmaLinetypePattern.cpp

示例4: qtscript_QFontDialog_prototype_call

static QScriptValue qtscript_QFontDialog_prototype_call(QScriptContext *context, QScriptEngine *)
{
#if QT_VERSION > 0x040400
    Q_ASSERT(context->callee().isFunction());
    uint _id = context->callee().data().toUInt32();
#else
    uint _id;
    if (context->callee().isFunction())
        _id = context->callee().data().toUInt32();
    else
        _id = 0xBABE0000 + 4;
#endif
    Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
    _id &= 0x0000FFFF;
    QFontDialog* _q_self = qscriptvalue_cast<QFontDialog*>(context->thisObject());
    if (!_q_self) {
        return context->throwError(QScriptContext::TypeError,
            QString::fromLatin1("QFontDialog.%0(): this object is not a QFontDialog")
            .arg(qtscript_QFontDialog_function_names[_id+2]));
    }

    switch (_id) {
    case 0:
    if (context->argumentCount() == 2) {
        QObject* _q_arg0 = context->argument(0).toQObject();
        char* _q_arg1 = qscriptvalue_cast<char*>(context->argument(1));
        _q_self->open(_q_arg0, _q_arg1);
        return context->engine()->undefinedValue();
    }
    break;

    case 1:
    if (context->argumentCount() == 0) {
        QFont _q_result = _q_self->selectedFont();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 2:
    if (context->argumentCount() == 1) {
        QFontDialog::FontDialogOption _q_arg0 = qscriptvalue_cast<QFontDialog::FontDialogOption>(context->argument(0));
        _q_self->setOption(_q_arg0);
        return context->engine()->undefinedValue();
    }
    if (context->argumentCount() == 2) {
        QFontDialog::FontDialogOption _q_arg0 = qscriptvalue_cast<QFontDialog::FontDialogOption>(context->argument(0));
        bool _q_arg1 = context->argument(1).toBoolean();
        _q_self->setOption(_q_arg0, _q_arg1);
        return context->engine()->undefinedValue();
    }
    break;

    case 3:
    if (context->argumentCount() == 1) {
        QFontDialog::FontDialogOption _q_arg0 = qscriptvalue_cast<QFontDialog::FontDialogOption>(context->argument(0));
        bool _q_result = _q_self->testOption(_q_arg0);
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 4: {
    QString result = QString::fromLatin1("QFontDialog");
    return QScriptValue(context->engine(), result);
    }

    default:
    Q_ASSERT(false);
    }
    return qtscript_QFontDialog_throw_ambiguity_error_helper(context,
        qtscript_QFontDialog_function_names[_id+2],
        qtscript_QFontDialog_function_signatures[_id+2]);
}
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:72,代码来源:qtscript_QFontDialog.cpp

示例5: QScriptValue

                 void REcmaPointEntity::init(QScriptEngine& engine, QScriptValue* proto 
    
    ) 
    
    {

    bool protoCreated = false;
    if(proto == NULL){
        proto = new QScriptValue(engine.newVariant(qVariantFromValue(
                (RPointEntity*) 0)));
        protoCreated = true;
    }

    
        // primary base class REntity:
        
            QScriptValue dpt = engine.defaultPrototype(
                qMetaTypeId<REntity*>());

            if (dpt.isValid()) {
                proto->setPrototype(dpt);
            }
          
        /*
        
        */
    

    QScriptValue fun;

    // toString:
    REcmaHelper::registerFunction(&engine, proto, toString, "toString");
    

    // destroy:
    REcmaHelper::registerFunction(&engine, proto, destroy, "destroy");
    
        // conversion for base class REntity
        REcmaHelper::registerFunction(&engine, proto, getREntity, "getREntity");
        
        // conversion for base class RObject
        REcmaHelper::registerFunction(&engine, proto, getRObject, "getRObject");
        

    // get class name
    REcmaHelper::registerFunction(&engine, proto, getClassName, "getClassName");
    

    // conversion to all base classes (multiple inheritance):
    REcmaHelper::registerFunction(&engine, proto, getBaseClasses, "getBaseClasses");
    

    // properties:
    

    // methods:
    
            REcmaHelper::registerFunction(&engine, proto, clone, "clone");
            
            REcmaHelper::registerFunction(&engine, proto, getType, "getType");
            
            REcmaHelper::registerFunction(&engine, proto, setProperty, "setProperty");
            
            REcmaHelper::registerFunction(&engine, proto, getProperty, "getProperty");
            
            REcmaHelper::registerFunction(&engine, proto, exportEntity, "exportEntity");
            
            REcmaHelper::registerFunction(&engine, proto, getData, "getData");
            
            REcmaHelper::registerFunction(&engine, proto, getPosition, "getPosition");
            
        engine.setDefaultPrototype(
            qMetaTypeId<RPointEntity*>(), *proto);

        
    

    QScriptValue ctor = engine.newFunction(create, *proto, 2);
    
    // static methods:
    
            REcmaHelper::registerFunction(&engine, &ctor, init, "init");
            

    // static properties:
    
            ctor.setProperty("PropertyCustom",
                qScriptValueFromValue(&engine, RPointEntity::PropertyCustom),
                QScriptValue::SkipInEnumeration | QScriptValue::ReadOnly);
            
            ctor.setProperty("PropertyHandle",
                qScriptValueFromValue(&engine, RPointEntity::PropertyHandle),
                QScriptValue::SkipInEnumeration | QScriptValue::ReadOnly);
            
            ctor.setProperty("PropertyType",
                qScriptValueFromValue(&engine, RPointEntity::PropertyType),
                QScriptValue::SkipInEnumeration | QScriptValue::ReadOnly);
            
            ctor.setProperty("PropertyBlock",
                qScriptValueFromValue(&engine, RPointEntity::PropertyBlock),
//.........这里部分代码省略.........
开发者ID:konysulphrea,项目名称:qcad,代码行数:101,代码来源:REcmaPointEntity.cpp

示例6: qScriptValueFromValue

 // returns class name:
  QScriptValue REcmaModifiedListener::getClassName(QScriptContext *context, QScriptEngine *engine) 
     
 {
     return qScriptValueFromValue(engine, QString("RModifiedListener"));
 }
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:6,代码来源:REcmaModifiedListener.cpp

示例7: qtscript_QUrlInfo_prototype_call

static QScriptValue qtscript_QUrlInfo_prototype_call(QScriptContext *context, QScriptEngine *)
{
#if QT_VERSION > 0x040400
    Q_ASSERT(context->callee().isFunction());
    uint _id = context->callee().data().toUInt32();
#else
    uint _id;
    if (context->callee().isFunction())
        _id = context->callee().data().toUInt32();
    else
        _id = 0xBABE0000 + 27;
#endif
    Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
    _id &= 0x0000FFFF;
    QUrlInfo* _q_self = qscriptvalue_cast<QUrlInfo*>(context->thisObject());
    if (!_q_self) {
        return context->throwError(QScriptContext::TypeError,
            QString::fromLatin1("QUrlInfo.%0(): this object is not a QUrlInfo")
            .arg(qtscript_QUrlInfo_function_names[_id+4]));
    }

    switch (_id) {
    case 0:
    if (context->argumentCount() == 0) {
        QString _q_result = _q_self->group();
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 1:
    if (context->argumentCount() == 0) {
        bool _q_result = _q_self->isDir();
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 2:
    if (context->argumentCount() == 0) {
        bool _q_result = _q_self->isExecutable();
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 3:
    if (context->argumentCount() == 0) {
        bool _q_result = _q_self->isFile();
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 4:
    if (context->argumentCount() == 0) {
        bool _q_result = _q_self->isReadable();
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 5:
    if (context->argumentCount() == 0) {
        bool _q_result = _q_self->isSymLink();
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 6:
    if (context->argumentCount() == 0) {
        bool _q_result = _q_self->isValid();
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 7:
    if (context->argumentCount() == 0) {
        bool _q_result = _q_self->isWritable();
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 8:
    if (context->argumentCount() == 0) {
        QDateTime _q_result = _q_self->lastModified();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 9:
    if (context->argumentCount() == 0) {
        QDateTime _q_result = _q_self->lastRead();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 10:
    if (context->argumentCount() == 0) {
        QString _q_result = _q_self->name();
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 11:
//.........这里部分代码省略.........
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:101,代码来源:qtscript_QUrlInfo.cpp

示例8: qtscript_QQuaternion_prototype_call

static QScriptValue qtscript_QQuaternion_prototype_call(QScriptContext *context, QScriptEngine *)
{
#if QT_VERSION > 0x040400
    Q_ASSERT(context->callee().isFunction());
    uint _id = context->callee().data().toUInt32();
#else
    uint _id;
    if (context->callee().isFunction())
        _id = context->callee().data().toUInt32();
    else
        _id = 0xBABE0000 + 24;
#endif
    Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
    _id &= 0x0000FFFF;
    QQuaternion* _q_self = qscriptvalue_cast<QQuaternion*>(context->thisObject());
    if (!_q_self) {
        return context->throwError(QScriptContext::TypeError,
            QString::fromLatin1("QQuaternion.%0(): this object is not a QQuaternion")
            .arg(qtscript_QQuaternion_function_names[_id+4]));
    }

    switch (_id) {
    case 0:
    if (context->argumentCount() == 0) {
        QQuaternion _q_result = _q_self->conjugate();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 1:
    if (context->argumentCount() == 0) {
        bool _q_result = _q_self->isIdentity();
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 2:
    if (context->argumentCount() == 0) {
        bool _q_result = _q_self->isNull();
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 3:
    if (context->argumentCount() == 0) {
        float _q_result = _q_self->length();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 4:
    if (context->argumentCount() == 0) {
        float _q_result = _q_self->lengthSquared();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 5:
    if (context->argumentCount() == 0) {
        _q_self->normalize();
        return context->engine()->undefinedValue();
    }
    break;

    case 6:
    if (context->argumentCount() == 0) {
        QQuaternion _q_result = _q_self->normalized();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 7:
    if (context->argumentCount() == 1) {
        QQuaternion _q_arg0 = qscriptvalue_cast<QQuaternion>(context->argument(0));
        QQuaternion& _q_result = _q_self->operator+=(_q_arg0);
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 8:
    if (context->argumentCount() == 1) {
        float _q_arg0 = qscriptvalue_cast<float>(context->argument(0));
        QQuaternion& _q_result = _q_self->operator/=(_q_arg0);
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 9:
    if (context->argumentCount() == 1) {
        QQuaternion _q_arg0 = qscriptvalue_cast<QQuaternion>(context->argument(0));
        bool _q_result = operator==(*_q_self, _q_arg0);
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 10:
    if (context->argumentCount() == 1) {
        if ((qMetaTypeId<QQuaternion>() == context->argument(0).toVariant().userType())) {
            QQuaternion _q_arg0 = qscriptvalue_cast<QQuaternion>(context->argument(0));
            QQuaternion& _q_result = _q_self->operator*=(_q_arg0);
//.........这里部分代码省略.........
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:101,代码来源:qtscript_QQuaternion.cpp

示例9: qtscript_QQuaternion_static_call

static QScriptValue qtscript_QQuaternion_static_call(QScriptContext *context, QScriptEngine *)
{
    uint _id = context->callee().data().toUInt32();
    Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
    _id &= 0x0000FFFF;
    switch (_id) {
    case 0:
    if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
        return context->throwError(QString::fromLatin1("QQuaternion(): Did you forget to construct with 'new'?"));
    }
    if (context->argumentCount() == 0) {
        QQuaternion _q_cpp_result;
        QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
        return _q_result;
    } else if (context->argumentCount() == 1) {
        QVector4D _q_arg0 = qscriptvalue_cast<QVector4D>(context->argument(0));
        QQuaternion _q_cpp_result(_q_arg0);
        QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
        return _q_result;
    } else if (context->argumentCount() == 2) {
        float _q_arg0 = qscriptvalue_cast<float>(context->argument(0));
        QVector3D _q_arg1 = qscriptvalue_cast<QVector3D>(context->argument(1));
        QQuaternion _q_cpp_result(_q_arg0, _q_arg1);
        QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
        return _q_result;
    } else if (context->argumentCount() == 4) {
        float _q_arg0 = qscriptvalue_cast<float>(context->argument(0));
        float _q_arg1 = qscriptvalue_cast<float>(context->argument(1));
        float _q_arg2 = qscriptvalue_cast<float>(context->argument(2));
        float _q_arg3 = qscriptvalue_cast<float>(context->argument(3));
        QQuaternion _q_cpp_result(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
        QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
        return _q_result;
    }
    break;

    case 1:
    if (context->argumentCount() == 2) {
        QVector3D _q_arg0 = qscriptvalue_cast<QVector3D>(context->argument(0));
        float _q_arg1 = qscriptvalue_cast<float>(context->argument(1));
        QQuaternion _q_result = QQuaternion::fromAxisAndAngle(_q_arg0, _q_arg1);
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    if (context->argumentCount() == 4) {
        float _q_arg0 = qscriptvalue_cast<float>(context->argument(0));
        float _q_arg1 = qscriptvalue_cast<float>(context->argument(1));
        float _q_arg2 = qscriptvalue_cast<float>(context->argument(2));
        float _q_arg3 = qscriptvalue_cast<float>(context->argument(3));
        QQuaternion _q_result = QQuaternion::fromAxisAndAngle(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 2:
    if (context->argumentCount() == 3) {
        QQuaternion _q_arg0 = qscriptvalue_cast<QQuaternion>(context->argument(0));
        QQuaternion _q_arg1 = qscriptvalue_cast<QQuaternion>(context->argument(1));
        float _q_arg2 = qscriptvalue_cast<float>(context->argument(2));
        QQuaternion _q_result = QQuaternion::nlerp(_q_arg0, _q_arg1, _q_arg2);
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 3:
    if (context->argumentCount() == 3) {
        QQuaternion _q_arg0 = qscriptvalue_cast<QQuaternion>(context->argument(0));
        QQuaternion _q_arg1 = qscriptvalue_cast<QQuaternion>(context->argument(1));
        float _q_arg2 = qscriptvalue_cast<float>(context->argument(2));
        QQuaternion _q_result = QQuaternion::slerp(_q_arg0, _q_arg1, _q_arg2);
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    default:
    Q_ASSERT(false);
    }
    return qtscript_QQuaternion_throw_ambiguity_error_helper(context,
        qtscript_QQuaternion_function_names[_id],
        qtscript_QQuaternion_function_signatures[_id]);
}
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:80,代码来源:qtscript_QQuaternion.cpp

示例10: toString

         QScriptValue
        REcmaFileExporterRegistry::getFileExporter
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaFileExporterRegistry::getFileExporter", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaFileExporterRegistry::getFileExporter";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
    
    if( context->argumentCount() ==
    3 && (
            context->argument(0).isString()
        ) /* type: QString */
     && (
            context->argument(1).isString()
        ) /* type: QString */
     && (
            context->argument(2).isVariant() || 
            context->argument(2).isQObject() || 
            context->argument(2).isNull()
        ) /* type: RDocument */
    
    ){
    // prepare arguments:
    
                    // argument isStandardType
                    QString
                    a0 =
                    (QString)
                    
                    context->argument( 0 ).
                    toString();
                
                    // argument isStandardType
                    QString
                    a1 =
                    (QString)
                    
                    context->argument( 1 ).
                    toString();
                
                    // argument is reference
                    RDocument*
                    ap2 =
                    qscriptvalue_cast<
                    RDocument*
                        >(
                        context->argument(
                        2
                        )
                    );
                    if( ap2 == NULL ){
                           return REcmaHelper::throwError("RFileExporterRegistry: Argument 2 is not of type RDocument*.",
                               context);                    
                    }
                    RDocument& a2 = *ap2;
                
    // end of arguments

    // call C++ function:
    // return type 'RFileExporter *'
    RFileExporter * cppResult =
        RFileExporterRegistry::
       getFileExporter(a0
        ,
    a1
        ,
    a2);
        // return type: RFileExporter *
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


        
    
    if( context->argumentCount() ==
    4 && (
            context->argument(0).isString()
        ) /* type: QString */
     && (
            context->argument(1).isString()
        ) /* type: QString */
     && (
            context->argument(2).isVariant() || 
            context->argument(2).isQObject() || 
            context->argument(2).isNull()
        ) /* type: RDocument */
     && (
            context->argument(3).isVariant() || 
            context->argument(3).isQObject() || 
            context->argument(3).isNull()
        ) /* type: RMessageHandler * */
    
    ){
    // prepare arguments:
//.........这里部分代码省略.........
开发者ID:Jackieee,项目名称:qcad,代码行数:101,代码来源:REcmaFileExporterRegistry.cpp

示例11: qtscript_QPainterPathStroker_prototype_call

static QScriptValue qtscript_QPainterPathStroker_prototype_call(QScriptContext *context, QScriptEngine *)
{
#if QT_VERSION > 0x040400
    Q_ASSERT(context->callee().isFunction());
    uint _id = context->callee().data().toUInt32();
#else
    uint _id;
    if (context->callee().isFunction())
        _id = context->callee().data().toUInt32();
    else
        _id = 0xBABE0000 + 15;
#endif
    Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
    _id &= 0x0000FFFF;
    QPainterPathStroker* _q_self = qscriptvalue_cast<QPainterPathStroker*>(context->thisObject());
    if (!_q_self) {
        return context->throwError(QScriptContext::TypeError,
            QString::fromLatin1("QPainterPathStroker.%0(): this object is not a QPainterPathStroker")
            .arg(qtscript_QPainterPathStroker_function_names[_id+1]));
    }

    switch (_id) {
    case 0:
    if (context->argumentCount() == 0) {
        Qt::PenCapStyle _q_result = _q_self->capStyle();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 1:
    if (context->argumentCount() == 1) {
        QPainterPath _q_arg0 = qscriptvalue_cast<QPainterPath>(context->argument(0));
        QPainterPath _q_result = _q_self->createStroke(_q_arg0);
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 2:
    if (context->argumentCount() == 0) {
        qreal _q_result = _q_self->curveThreshold();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 3:
    if (context->argumentCount() == 0) {
        qreal _q_result = _q_self->dashOffset();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 4:
    if (context->argumentCount() == 0) {
        QVector<qreal> _q_result = _q_self->dashPattern();
        return qScriptValueFromSequence(context->engine(), _q_result);
    }
    break;

    case 5:
    if (context->argumentCount() == 0) {
        Qt::PenJoinStyle _q_result = _q_self->joinStyle();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 6:
    if (context->argumentCount() == 0) {
        qreal _q_result = _q_self->miterLimit();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 7:
    if (context->argumentCount() == 1) {
        Qt::PenCapStyle _q_arg0 = qscriptvalue_cast<Qt::PenCapStyle>(context->argument(0));
        _q_self->setCapStyle(_q_arg0);
        return context->engine()->undefinedValue();
    }
    break;

    case 8:
    if (context->argumentCount() == 1) {
        qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
        _q_self->setCurveThreshold(_q_arg0);
        return context->engine()->undefinedValue();
    }
    break;

    case 9:
    if (context->argumentCount() == 1) {
        qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
        _q_self->setDashOffset(_q_arg0);
        return context->engine()->undefinedValue();
    }
    break;

    case 10:
    if (context->argumentCount() == 1) {
        if ((qMetaTypeId<Qt::PenStyle>() == context->argument(0).toVariant().userType())) {
            Qt::PenStyle _q_arg0 = qscriptvalue_cast<Qt::PenStyle>(context->argument(0));
//.........这里部分代码省略.........
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:101,代码来源:qtscript_QPainterPathStroker.cpp

示例12: qScriptValueFromValue

 // returns class name:
  QScriptValue REcmaFileExporterRegistry::getClassName(QScriptContext *context, QScriptEngine *engine) 
     
 {
     return qScriptValueFromValue(engine, QString("RFileExporterRegistry"));
 }
开发者ID:Jackieee,项目名称:qcad,代码行数:6,代码来源:REcmaFileExporterRegistry.cpp

示例13: qtscript_QAbstractProxyModel_prototype_call

static QScriptValue qtscript_QAbstractProxyModel_prototype_call(QScriptContext *context, QScriptEngine *)
{
#if QT_VERSION > 0x040400
    Q_ASSERT(context->callee().isFunction());
    uint _id = context->callee().data().toUInt32();
#else
    uint _id;
    if (context->callee().isFunction())
        _id = context->callee().data().toUInt32();
    else
        _id = 0xBABE0000 + 6;
#endif
    Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
    _id &= 0x0000FFFF;
    QAbstractProxyModel* _q_self = qscriptvalue_cast<QAbstractProxyModel*>(context->thisObject());
    if (!_q_self) {
        return context->throwError(QScriptContext::TypeError,
                                   QString::fromLatin1("QAbstractProxyModel.%0(): this object is not a QAbstractProxyModel")
                                   .arg(qtscript_QAbstractProxyModel_function_names[_id+1]));
    }

    switch (_id) {
    case 0:
        if (context->argumentCount() == 1) {
            QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
            QModelIndex _q_result = _q_self->mapFromSource(_q_arg0);
            return qScriptValueFromValue(context->engine(), _q_result);
        }
        break;

    case 1:
        if (context->argumentCount() == 1) {
            QItemSelection _q_arg0 = qscriptvalue_cast<QItemSelection>(context->argument(0));
            QItemSelection _q_result = _q_self->mapSelectionFromSource(_q_arg0);
            return qScriptValueFromValue(context->engine(), _q_result);
        }
        break;

    case 2:
        if (context->argumentCount() == 1) {
            QItemSelection _q_arg0 = qscriptvalue_cast<QItemSelection>(context->argument(0));
            QItemSelection _q_result = _q_self->mapSelectionToSource(_q_arg0);
            return qScriptValueFromValue(context->engine(), _q_result);
        }
        break;

    case 3:
        if (context->argumentCount() == 1) {
            QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
            QModelIndex _q_result = _q_self->mapToSource(_q_arg0);
            return qScriptValueFromValue(context->engine(), _q_result);
        }
        break;

    case 4:
        if (context->argumentCount() == 1) {
            QAbstractItemModel* _q_arg0 = qscriptvalue_cast<QAbstractItemModel*>(context->argument(0));
            _q_self->setSourceModel(_q_arg0);
            return context->engine()->undefinedValue();
        }
        break;

    case 5:
        if (context->argumentCount() == 0) {
            QAbstractItemModel* _q_result = _q_self->sourceModel();
            return qScriptValueFromValue(context->engine(), _q_result);
        }
        break;

    case 6: {
        QString result = QString::fromLatin1("QAbstractProxyModel");
        return QScriptValue(context->engine(), result);
    }

    default:
        Q_ASSERT(false);
    }
    return qtscript_QAbstractProxyModel_throw_ambiguity_error_helper(context,
            qtscript_QAbstractProxyModel_function_names[_id+1],
            qtscript_QAbstractProxyModel_function_signatures[_id+1]);
}
开发者ID:Jackieee,项目名称:qcad,代码行数:81,代码来源:qtscript_QAbstractProxyModel.cpp

示例14: qtscript_QHeaderView_prototype_call


//.........这里部分代码省略.........
        } else if (context->argument(0).isNumber()) {
            int _q_arg0 = context->argument(0).toInt32();
            int _q_result = _q_self->logicalIndexAt(_q_arg0);
            return QScriptValue(context->engine(), _q_result);
        }
    }
    if (context->argumentCount() == 2) {
        int _q_arg0 = context->argument(0).toInt32();
        int _q_arg1 = context->argument(1).toInt32();
        int _q_result = _q_self->logicalIndexAt(_q_arg0, _q_arg1);
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 9:
    if (context->argumentCount() == 2) {
        int _q_arg0 = context->argument(0).toInt32();
        int _q_arg1 = context->argument(1).toInt32();
        _q_self->moveSection(_q_arg0, _q_arg1);
        return context->engine()->undefinedValue();
    }
    break;

    case 10:
    if (context->argumentCount() == 0) {
        int _q_result = _q_self->offset();
        return QScriptValue(context->engine(), _q_result);
    }
    break;

    case 11:
    if (context->argumentCount() == 0) {
        Qt::Orientation _q_result = _q_self->orientation();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 12:
    if (context->argumentCount() == 1) {
        int _q_arg0 = context->argument(0).toInt32();
        QHeaderView::ResizeMode _q_result = _q_self->resizeMode(_q_arg0);
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 13:
    if (context->argumentCount() == 2) {
        int _q_arg0 = context->argument(0).toInt32();
        int _q_arg1 = context->argument(1).toInt32();
        _q_self->resizeSection(_q_arg0, _q_arg1);
        return context->engine()->undefinedValue();
    }
    break;

    case 14:
    if (context->argumentCount() == 1) {
        QHeaderView::ResizeMode _q_arg0 = qscriptvalue_cast<QHeaderView::ResizeMode>(context->argument(0));
        _q_self->resizeSections(_q_arg0);
        return context->engine()->undefinedValue();
    }
    break;

    case 15:
    if (context->argumentCount() == 1) {
        QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
        bool _q_result = _q_self->restoreState(_q_arg0);
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:67,代码来源:qtscript_QHeaderView.cpp

示例15: qtscript_QToolButton_prototype_call

static QScriptValue qtscript_QToolButton_prototype_call(QScriptContext *context, QScriptEngine *)
{
#if QT_VERSION > 0x040400
    Q_ASSERT(context->callee().isFunction());
    uint _id = context->callee().data().toUInt32();
#else
    uint _id;
    if (context->callee().isFunction())
        _id = context->callee().data().toUInt32();
    else
        _id = 0xBABE0000 + 5;
#endif
    Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
    _id &= 0x0000FFFF;
    QToolButton* _q_self = qscriptvalue_cast<QToolButton*>(context->thisObject());
    if (!_q_self) {
        return context->throwError(QScriptContext::TypeError,
            QString::fromLatin1("QToolButton.%0(): this object is not a QToolButton")
            .arg(qtscript_QToolButton_function_names[_id+1]));
    }

    switch (_id) {
    case 0:
    if (context->argumentCount() == 0) {
        QAction* _q_result = _q_self->defaultAction();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 1:
    if (context->argumentCount() == 0) {
        QMenu* _q_result = _q_self->menu();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 2:
    if (context->argumentCount() == 0) {
        QSize _q_result = _q_self->minimumSizeHint();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 3:
    if (context->argumentCount() == 1) {
        QMenu* _q_arg0 = qscriptvalue_cast<QMenu*>(context->argument(0));
        _q_self->setMenu(_q_arg0);
        return context->engine()->undefinedValue();
    }
    break;

    case 4:
    if (context->argumentCount() == 0) {
        QSize _q_result = _q_self->sizeHint();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 5: {
    QString result = QString::fromLatin1("QToolButton");
    return QScriptValue(context->engine(), result);
    }

    default:
    Q_ASSERT(false);
    }
    return qtscript_QToolButton_throw_ambiguity_error_helper(context,
        qtscript_QToolButton_function_names[_id+1],
        qtscript_QToolButton_function_signatures[_id+1]);
}
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:70,代码来源:qtscript_QToolButton.cpp


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