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


C++ QScriptValue函数代码示例

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


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

示例1: qDBusReplyToScriptValue

QScriptValue qDBusReplyToScriptValue(QScriptEngine *eng, const QDBusReply<T> &reply)
{
    return QScriptValue(eng, reply.value());
}
开发者ID:pk-codebox-evo,项目名称:remixos-usb-tool,代码行数:4,代码来源:main.cpp

示例2: qtscript_QSourceLocation_prototype_call

static QScriptValue qtscript_QSourceLocation_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 + 8;
#endif
    Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
    _id &= 0x0000FFFF;
    QSourceLocation* _q_self = qscriptvalue_cast<QSourceLocation*>(context->thisObject());
    if (!_q_self) {
        return context->throwError(QScriptContext::TypeError,
            QString::fromLatin1("QSourceLocation.%0(): this object is not a QSourceLocation")
            .arg(qtscript_QSourceLocation_function_names[_id+1]));
    }

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

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

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

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

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

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

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

    case 7:
    if (context->argumentCount() == 0) {
        QUrl _q_result = _q_self->uri();
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

    case 8: {
    QString result;
    QDebug d(&result);
    d << *_q_self;
    return QScriptValue(context->engine(), result);
    }

    default:
    Q_ASSERT(false);
    }
    return qtscript_QSourceLocation_throw_ambiguity_error_helper(context,
        qtscript_QSourceLocation_function_names[_id+1],
        qtscript_QSourceLocation_function_signatures[_id+1]);
}
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:96,代码来源:qtscript_QSourceLocation.cpp

示例3: QScriptValue

      QScriptValue REcmaSnap::toScriptValueEnumStatus(QScriptEngine* engine, const RSnap::Status& value)
 
     {
         return QScriptValue(engine, (int)value);
     }
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:5,代码来源:REcmaSnap.cpp

示例4: qtscript_QWebElement_StyleResolveStrategy_toString

static QScriptValue qtscript_QWebElement_StyleResolveStrategy_toString(QScriptContext *context, QScriptEngine *engine)
{
    QWebElement::StyleResolveStrategy value = qscriptvalue_cast<QWebElement::StyleResolveStrategy>(context->thisObject());
    return QScriptValue(engine, qtscript_QWebElement_StyleResolveStrategy_toStringHelper(value));
}
开发者ID:DanielJSlick,项目名称:qcad,代码行数:5,代码来源:qtscript_QWebElement.cpp

示例5: getSelf

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

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RLinetype* self = 
                        getSelf("operator<", 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: RLinetype */
    
    ){
    // prepare arguments:
    
                    // argument isCopyable and has default constructor and isSimpleClass 
                    RLinetype*
                    ap0 =
                    qscriptvalue_cast<
                    RLinetype*
                        >(
                        context->argument(
                        0
                        )
                    );
                    if (ap0 == NULL) {
                           return REcmaHelper::throwError("RLinetype: Argument 0 is not of type RLinetype.",
                               context);                    
                    }
                    RLinetype 
                    a0 = 
                    *ap0;
                
    // end of arguments

    // call C++ function:
    // return type 'bool'
    bool cppResult =
        
               self->operator<(a0);
        // return type: bool
                // standard Type
                result = QScriptValue(cppResult);
            
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RLinetype.operator_less().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaSharedPointerLinetype::operator<", context, engine);
            return result;
        }
开发者ID:VixMobile,项目名称:qcad,代码行数:72,代码来源:REcmaSharedPointerLinetype.cpp

示例6: qtscript_QDomImplementation_InvalidDataPolicy_toString

static QScriptValue qtscript_QDomImplementation_InvalidDataPolicy_toString(QScriptContext *context, QScriptEngine *engine)
{
    QDomImplementation::InvalidDataPolicy value = qscriptvalue_cast<QDomImplementation::InvalidDataPolicy>(context->thisObject());
    return QScriptValue(engine, qtscript_QDomImplementation_InvalidDataPolicy_toStringHelper(value));
}
开发者ID:SSMN,项目名称:MuseScore,代码行数:5,代码来源:qtscript_QDomImplementation.cpp

示例7: qtscript_QAbstractXmlNodeModel_SimpleAxis_toString

static QScriptValue qtscript_QAbstractXmlNodeModel_SimpleAxis_toString(QScriptContext *context, QScriptEngine *engine)
{
    QAbstractXmlNodeModel::SimpleAxis value = qscriptvalue_cast<QAbstractXmlNodeModel::SimpleAxis>(context->thisObject());
    return QScriptValue(engine, qtscript_QAbstractXmlNodeModel_SimpleAxis_toStringHelper(value));
}
开发者ID:DanielJSlick,项目名称:qcad,代码行数:5,代码来源:qtscript_QAbstractXmlNodeModel.cpp

示例8: qtscript_QAbstractXmlNodeModel_NodeCopySetting_toString

static QScriptValue qtscript_QAbstractXmlNodeModel_NodeCopySetting_toString(QScriptContext *context, QScriptEngine *engine)
{
    QAbstractXmlNodeModel::NodeCopySetting value = qscriptvalue_cast<QAbstractXmlNodeModel::NodeCopySetting>(context->thisObject());
    return QScriptValue(engine, qtscript_QAbstractXmlNodeModel_NodeCopySetting_toStringHelper(value));
}
开发者ID:DanielJSlick,项目名称:qcad,代码行数:5,代码来源:qtscript_QAbstractXmlNodeModel.cpp

示例9: getZonesByPosition

bool EntityEditFilters::filter(glm::vec3& position, EntityItemProperties& propertiesIn, EntityItemProperties& propertiesOut,
        bool& wasChanged, EntityTree::FilterType filterType, EntityItemID& itemID, EntityItemPointer& existingEntity) {
    
    // get the ids of all the zones (plus the global entity edit filter) that the position
    // lies within
    auto zoneIDs = getZonesByPosition(position);
    for (auto id : zoneIDs) {
        if (!itemID.isInvalidID() && id == itemID) {
            continue;
        }
        
        // get the filter pair, etc...  
        _lock.lockForRead();
        FilterData filterData = _filterDataMap.value(id);
        _lock.unlock();
    
        if (filterData.valid()) {
            if (filterData.rejectAll) {
                return false;
            }

            // check to see if this filter wants to filter this message type
            if ((!filterData.wantsToFilterEdit && filterType == EntityTree::FilterType::Edit) ||
                (!filterData.wantsToFilterPhysics && filterType == EntityTree::FilterType::Physics) ||
                (!filterData.wantsToFilterDelete && filterType == EntityTree::FilterType::Delete) ||
                (!filterData.wantsToFilterAdd && filterType == EntityTree::FilterType::Add)) {

                wasChanged = false;
                return true; // accept the message
            }

            auto oldProperties = propertiesIn.getDesiredProperties();
            auto specifiedProperties = propertiesIn.getChangedProperties();
            propertiesIn.setDesiredProperties(specifiedProperties);
            QScriptValue inputValues = propertiesIn.copyToScriptValue(filterData.engine, false, true, true);
            propertiesIn.setDesiredProperties(oldProperties);

            auto in = QJsonValue::fromVariant(inputValues.toVariant()); // grab json copy now, because the inputValues might be side effected by the filter.

            QScriptValueList args;
            args << inputValues;
            args << filterType;

            // get the current properties for then entity and include them for the filter call
            if (existingEntity && filterData.wantsOriginalProperties) {
                auto currentProperties = existingEntity->getProperties(filterData.includedOriginalProperties);
                QScriptValue currentValues = currentProperties.copyToScriptValue(filterData.engine, false, true, true);
                args << currentValues;
            }


            // get the zone properties
            if (filterData.wantsZoneProperties) {
                auto zoneEntity = _tree->findEntityByEntityItemID(id);
                if (zoneEntity) {
                    auto zoneProperties = zoneEntity->getProperties(filterData.includedZoneProperties);
                    QScriptValue zoneValues = zoneProperties.copyToScriptValue(filterData.engine, false, true, true);

                    if (filterData.wantsZoneBoundingBox) {
                        bool success = true;
                        AABox aaBox = zoneEntity->getAABox(success);
                        if (success) {
                            QScriptValue boundingBox = filterData.engine->newObject();
                            QScriptValue bottomRightNear = vec3ToScriptValue(filterData.engine, aaBox.getCorner());
                            QScriptValue topFarLeft = vec3ToScriptValue(filterData.engine, aaBox.calcTopFarLeft());
                            QScriptValue center = vec3ToScriptValue(filterData.engine, aaBox.calcCenter());
                            QScriptValue boundingBoxDimensions = vec3ToScriptValue(filterData.engine, aaBox.getDimensions());
                            boundingBox.setProperty("brn", bottomRightNear);
                            boundingBox.setProperty("tfl", topFarLeft);
                            boundingBox.setProperty("center", center);
                            boundingBox.setProperty("dimensions", boundingBoxDimensions);
                            zoneValues.setProperty("boundingBox", boundingBox);
                        }
                    }

                    // If this is an add or delete, or original properties weren't requested
                    // there won't be original properties in the args, but zone properties need
                    // to be the fourth parameter, so we need to pad the args accordingly
                    int EXPECTED_ARGS = 3;
                    if (args.length() < EXPECTED_ARGS) {
                        args << QScriptValue();
                    }
                    assert(args.length() == EXPECTED_ARGS); // we MUST have 3 args by now!
                    args << zoneValues;
                }
            }

            QScriptValue result = filterData.filterFn.call(_nullObjectForFilter, args);

            if (filterData.uncaughtExceptions()) {
                return false;
            }

            if (result.isObject()) {
                // make propertiesIn reflect the changes, for next filter...
                propertiesIn.copyFromScriptValue(result, false);

                // and update propertiesOut too.  TODO: this could be more efficient...
                propertiesOut.copyFromScriptValue(result, false);
                // Javascript objects are == only if they are the same object. To compare arbitrary values, we need to use JSON.
//.........这里部分代码省略.........
开发者ID:AndrewMeadows,项目名称:hifi,代码行数:101,代码来源:EntityEditFilters.cpp

示例10: qtscript_QAbstractXmlNodeModel_SimpleAxis_valueOf

static QScriptValue qtscript_QAbstractXmlNodeModel_SimpleAxis_valueOf(QScriptContext *context, QScriptEngine *engine)
{
    QAbstractXmlNodeModel::SimpleAxis value = qscriptvalue_cast<QAbstractXmlNodeModel::SimpleAxis>(context->thisObject());
    return QScriptValue(engine, static_cast<int>(value));
}
开发者ID:DanielJSlick,项目名称:qcad,代码行数:5,代码来源:qtscript_QAbstractXmlNodeModel.cpp

示例11: qtscript_QStyleOptionProgressBar_StyleOptionVersion_valueOf

static QScriptValue qtscript_QStyleOptionProgressBar_StyleOptionVersion_valueOf(QScriptContext *context, QScriptEngine *engine)
{
    QStyleOptionProgressBar::StyleOptionVersion value = qscriptvalue_cast<QStyleOptionProgressBar::StyleOptionVersion>(context->thisObject());
    return QScriptValue(engine, static_cast<int>(value));
}
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:5,代码来源:qtscript_QStyleOptionProgressBar.cpp

示例12: qtscript_QStyleOptionProgressBar_StyleOptionType_toString

static QScriptValue qtscript_QStyleOptionProgressBar_StyleOptionType_toString(QScriptContext *context, QScriptEngine *engine)
{
    QStyleOptionProgressBar::StyleOptionType value = qscriptvalue_cast<QStyleOptionProgressBar::StyleOptionType>(context->thisObject());
    return QScriptValue(engine, qtscript_QStyleOptionProgressBar_StyleOptionType_toStringHelper(value));
}
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:5,代码来源:qtscript_QStyleOptionProgressBar.cpp

示例13: doRedo

void ScriptUndoCommand::doRedo() {
    QScriptValueList args;
    args << _redoData;
    _redoFunction.call(QScriptValue(), args);
}
开发者ID:AlphaStaxLLC,项目名称:hifi,代码行数:5,代码来源:UndoStackScriptingInterface.cpp

示例14: qtscript_QUndoCommand_prototype_call

static QScriptValue qtscript_QUndoCommand_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 + 9;
#endif
    Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
    _id &= 0x0000FFFF;
    QUndoCommand* _q_self = qscriptvalue_cast<QUndoCommand*>(context->thisObject());
    if (!_q_self) {
        return context->throwError(QScriptContext::TypeError,
            QString::fromLatin1("QUndoCommand.%0(): this object is not a QUndoCommand")
            .arg(qtscript_QUndoCommand_function_names[_id+1]));
    }

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

    case 1:
    if (context->argumentCount() == 1) {
        int _q_arg0 = context->argument(0).toInt32();
        const QUndoCommand* _q_result = const_cast<const QUndoCommand*>(_q_self->child(_q_arg0));
        return qScriptValueFromValue(context->engine(), _q_result);
    }
    break;

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

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

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

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

    case 6:
    if (context->argumentCount() == 1) {
        QString _q_arg0 = context->argument(0).toString();
        _q_self->setText(_q_arg0);
        return context->engine()->undefinedValue();
    }
    break;

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

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

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

    default:
    Q_ASSERT(false);
    }
    return qtscript_QUndoCommand_throw_ambiguity_error_helper(context,
        qtscript_QUndoCommand_function_names[_id+1],
        qtscript_QUndoCommand_function_signatures[_id+1]);
}
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:100,代码来源:qtscript_QUndoCommand.cpp

示例15: qtscript_QAbstractXmlNodeModel_prototype_call

static QScriptValue qtscript_QAbstractXmlNodeModel_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 + 12;
#endif
    Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
    _id &= 0x0000FFFF;
    QAbstractXmlNodeModel* _q_self = qscriptvalue_cast<QAbstractXmlNodeModel*>(context->thisObject());
    if (!_q_self) {
        return context->throwError(QScriptContext::TypeError,
            QString::fromLatin1("QAbstractXmlNodeModel.%0(): this object is not a QAbstractXmlNodeModel")
            .arg(qtscript_QAbstractXmlNodeModel_function_names[_id+1]));
    }

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

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

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

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

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

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

    case 6:
    if (context->argumentCount() == 1) {
        QXmlNodeModelIndex _q_arg0 = qscriptvalue_cast<QXmlNodeModelIndex>(context->argument(0));
        QVector<QXmlName > _q_result = _q_self->namespaceBindings(_q_arg0);
        return qScriptValueFromSequence(context->engine(), _q_result);
    }
    break;

    case 7:
    if (context->argumentCount() == 1) {
        QXmlName _q_arg0 = qscriptvalue_cast<QXmlName>(context->argument(0));
        QVector<QXmlNodeModelIndex > _q_result = _q_self->nodesByIdref(_q_arg0);
        return qScriptValueFromSequence(context->engine(), _q_result);
    }
    break;

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

    case 9:
    if (context->argumentCount() == 1) {
        QXmlNodeModelIndex _q_arg0 = qscriptvalue_cast<QXmlNodeModelIndex>(context->argument(0));
        QSourceLocation _q_result = _q_self->sourceLocation(_q_arg0);
        return qScriptValueFromValue(context->engine(), _q_result);
//.........这里部分代码省略.........
开发者ID:DanielJSlick,项目名称:qcad,代码行数:101,代码来源:qtscript_QAbstractXmlNodeModel.cpp


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