本文整理汇总了C++中QQmlProperty::property方法的典型用法代码示例。如果您正苦于以下问题:C++ QQmlProperty::property方法的具体用法?C++ QQmlProperty::property怎么用?C++ QQmlProperty::property使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQmlProperty
的用法示例。
在下文中一共展示了QQmlProperty::property方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deleteObjectsInList
void ObjectNodeInstance::deleteObjectsInList(const QQmlProperty &property)
{
QObjectList objectList;
QQmlListReference list = qvariant_cast<QQmlListReference>(property.read());
if (!QmlPrivateGate::hasFullImplementedListInterface(list)) {
qWarning() << "Property list interface not fully implemented for Class " << property.property().typeName() << " in property " << property.name() << "!";
return;
}
for (int i = 0; i < list.count(); i++) {
objectList += list.at(i);
}
list.clear();
}
示例2: removeObjectFromList
static void removeObjectFromList(const QQmlProperty &property, QObject *objectToBeRemoved, QQmlEngine * engine)
{
QQmlListReference listReference(property.object(), property.name().toUtf8(), engine);
if (!QmlPrivateGate::hasFullImplementedListInterface(listReference)) {
qWarning() << "Property list interface not fully implemented for Class " << property.property().typeName() << " in property " << property.name() << "!";
return;
}
int count = listReference.count();
QObjectList objectList;
for (int i = 0; i < count; i ++) {
QObject *listItem = listReference.at(i);
if (listItem && listItem != objectToBeRemoved)
objectList.append(listItem);
}
listReference.clear();
foreach (QObject *object, objectList)
listReference.append(object);
}