本文整理汇总了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;
}
示例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;
}
示例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();
}
示例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);
}