本文整理汇总了C++中QQmlEnginePrivate::listType方法的典型用法代码示例。如果您正苦于以下问题:C++ QQmlEnginePrivate::listType方法的具体用法?C++ QQmlEnginePrivate::listType怎么用?C++ QQmlEnginePrivate::listType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQmlEnginePrivate
的用法示例。
在下文中一共展示了QQmlEnginePrivate::listType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
QQmlListReference QQmlListReferencePrivate::init(const QQmlListProperty<QObject> &prop, int propType, QQmlEngine *engine)
{
QQmlListReference rv;
if (!prop.object) return rv;
QQmlEnginePrivate *p = engine?QQmlEnginePrivate::get(engine):0;
int listType = p?p->listType(propType):QQmlMetaType::listType(propType);
if (listType == -1) return rv;
rv.d = new QQmlListReferencePrivate;
rv.d->object = prop.object;
rv.d->elementType = QQmlPropertyPrivate::rawMetaObjectForType(p, listType);
rv.d->property = prop;
rv.d->propertyType = propType;
return rv;
}
示例2: d
/*!
Constructs a QQmlListReference for \a object's \a property. If \a property is not a list
property, an invalid QQmlListReference is created. If \a object is destroyed after
the reference is constructed, it will automatically become invalid. That is, it is safe to hold
QQmlListReference instances even after \a object is deleted.
Passing \a engine is required to access some QML created list properties. If in doubt, and an engine
is available, pass it.
*/
QQmlListReference::QQmlListReference(QObject *object, const char *property, QQmlEngine *engine)
: d(0)
{
if (!object || !property) return;
QQmlPropertyData local;
QQmlPropertyData *data =
QQmlPropertyCache::property(engine, object, QLatin1String(property), 0, local);
if (!data || !data->isQList()) return;
QQmlEnginePrivate *p = engine?QQmlEnginePrivate::get(engine):0;
int listType = p?p->listType(data->propType()):QQmlMetaType::listType(data->propType());
if (listType == -1) return;
d = new QQmlListReferencePrivate;
d->object = object;
d->elementType = p ? p->rawMetaObjectForType(listType) : QQmlMetaType::qmlType(listType).baseMetaObject();
d->propertyType = data->propType();
void *args[] = { &d->property, 0 };
QMetaObject::metacall(object, QMetaObject::ReadProperty, data->coreIndex(), args);
}