本文整理汇总了C++中QQmlEnginePrivate::toQObject方法的典型用法代码示例。如果您正苦于以下问题:C++ QQmlEnginePrivate::toQObject方法的具体用法?C++ QQmlEnginePrivate::toQObject怎么用?C++ QQmlEnginePrivate::toQObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQmlEnginePrivate
的用法示例。
在下文中一共展示了QQmlEnginePrivate::toQObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setList
void QQmlListAccessor::setList(const QVariant &v, QQmlEngine *engine)
{
d = v;
// An incoming JS array as model is treated as a variant list, so we need to
// convert it first with toVariant().
if (d.userType() == qMetaTypeId<QJSValue>())
d = d.value<QJSValue>().toVariant();
QQmlEnginePrivate *enginePrivate = engine?QQmlEnginePrivate::get(engine):0;
if (!d.isValid()) {
m_type = Invalid;
} else if (d.userType() == QVariant::StringList) {
m_type = StringList;
} else if (d.userType() == QMetaType::QVariantList) {
m_type = VariantList;
} else if (d.canConvert(QVariant::Int)) {
m_type = Integer;
} else if ((!enginePrivate && QQmlMetaType::isQObject(d.userType())) ||
(enginePrivate && enginePrivate->isQObject(d.userType()))) {
QObject *data = enginePrivate?enginePrivate->toQObject(d):QQmlMetaType::toQObject(d);
d = QVariant::fromValue(data);
m_type = Instance;
} else if (d.userType() == qMetaTypeId<QQmlListReference>()) {
m_type = ListProperty;
} else {
m_type = Instance;
}
}