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


C++ QQmlEngine::handle方法代码示例

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


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

示例1: allocateVarPropertiesArray

void QQmlVMEMetaObject::allocateVarPropertiesArray()
{
    QQmlEngine *qml = qmlEngine(object);
    assert(qml);
    QV4::ExecutionEngine *v4 = QV8Engine::getV4(qml->handle());
    QV4::Scope scope(v4);
    varProperties = QV4::ScopedValue(scope, v4->newArrayObject(metaData->varPropertyCount));
    varPropertiesInitialized = true;
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:9,代码来源:qqmlvmemetaobject.cpp

示例2: callerLine

    int callerLine(int frameIndex = 0) const
    {
        QQmlEngine *engine = qmlEngine(this);
        QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine->handle());

        QVector<QV4::StackFrame> stack = v4->stackTrace(frameIndex + 2);
        if (stack.size() > frameIndex + 1)
            return stack.at(frameIndex + 1).line;
        return -1;
    }
开发者ID:xjohncz,项目名称:qt5,代码行数:10,代码来源:main.cpp

示例3: callerFile

    QQmlV4Handle callerFile(int frameIndex = 0) const
    {
        QQmlEngine *engine = qmlEngine(this);
        QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine->handle());
        QV4::Scope scope(v4);

        QVector<QV4::StackFrame> stack = v4->stackTrace(frameIndex + 2);
        if (stack.size() > frameIndex + 1) {
            QV4::ScopedValue s(scope, v4->newString(stack.at(frameIndex + 1).source));
            return QQmlV4Handle(s);
        }
        return QQmlV4Handle();
    }
开发者ID:xjohncz,项目名称:qt5,代码行数:13,代码来源:main.cpp

示例4: affectSystem

void QQuickCustomAffector::affectSystem(qreal dt)
{
    //Acts a bit differently, just emits affected for everyone it might affect, when the only thing is connecting to affected(x,y)
    bool justAffected = (m_acceleration == &m_nullVector
        && m_velocity == &m_nullVector
        && m_position == &m_nullVector
        && isAffectedConnected());
    if (!isAffectConnected() && !justAffected) {
        QQuickParticleAffector::affectSystem(dt);
        return;
    }
    if (!m_enabled)
        return;
    updateOffsets();

    QList<QQuickParticleData*> toAffect;
    foreach (QQuickParticleGroupData* gd, m_system->groupData)
        if (activeGroup(m_system->groupData.key(gd)))
            foreach (QQuickParticleData* d, gd->data)
                if (shouldAffect(d))
                    toAffect << d;

    if (toAffect.isEmpty())
        return;

    if (justAffected) {
        foreach (QQuickParticleData* d, toAffect) {//Not postAffect to avoid saying the particle changed
            if (m_onceOff)
                m_onceOffed << qMakePair(d->group, d->index);
            emit affected(d->curX(), d->curY());
        }
        return;
    }

    if (m_onceOff)
        dt = 1.0;

    QQmlEngine *qmlEngine = ::qmlEngine(this);
    QV4::ExecutionEngine *v4 = QV8Engine::getV4(qmlEngine->handle());

    QV4::Scope scope(v4);
    QV4::Scoped<QV4::ArrayObject> array(scope, v4->newArrayObject(toAffect.size()));
    QV4::ScopedValue v(scope);
    for (int i=0; i<toAffect.size(); i++)
        array->putIndexed(i, (v = toAffect[i]->v4Value()));

    if (dt >= simulationCutoff || dt <= simulationDelta) {
        affectProperties(toAffect, dt);
        emit affectParticles(QQmlV4Handle(array), dt);
    } else {
        int realTime = m_system->timeInt;
        m_system->timeInt -= dt * 1000.0;
        while (dt > simulationDelta) {
            m_system->timeInt += simulationDelta * 1000.0;
            dt -= simulationDelta;
            affectProperties(toAffect, simulationDelta);
            emit affectParticles(QQmlV4Handle(array), simulationDelta);
        }
        m_system->timeInt = realTime;
        if (dt > 0.0) {
            affectProperties(toAffect, dt);
            emit affectParticles(QQmlV4Handle(array), dt);
        }
    }

    foreach (QQuickParticleData* d, toAffect)
        if (d->update == 1.0)
            postAffect(d);
}
开发者ID:tizenorg,项目名称:platform.upstream.qtdeclarative,代码行数:69,代码来源:qquickcustomaffector.cpp


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