示例#1
0
bool detectVerticalCycle(const ModelNode &node, QList<ModelNode> knownNodeList)
{
    if (!node.isValid())
        return false;

    if (knownNodeList.contains(node))
        return true;

    knownNodeList.append(node);

    static PropertyNameList validAnchorLines(PropertyNameList() << "top" << "bottom" << "verticalCenter" << "baseline");
    static PropertyNameList anchorNames(PropertyNameList() << "anchors.top" << "anchors.bottom" << "anchors.verticalCenter" << "anchors.baseline");

    foreach (const PropertyName &anchorName, anchorNames) {
        if (node.hasBindingProperty(anchorName)) {
            AbstractProperty targetProperty = node.bindingProperty(anchorName).resolveToProperty();
            if (targetProperty.isValid()) {
                if (!validAnchorLines.contains(targetProperty.name()))
                    return true;

                if (detectVerticalCycle(targetProperty.parentModelNode(), knownNodeList))
                    return true;
            }
        }

    }

    static PropertyNameList anchorShortcutNames(PropertyNameList() << "anchors.fill" << "anchors.centerIn");
    foreach (const PropertyName &anchorName, anchorShortcutNames) {
        if (node.hasBindingProperty(anchorName)) {
            ModelNode targetNode = node.bindingProperty(anchorName).resolveToModelNode();

            if (targetNode.isValid() && detectVerticalCycle(targetNode, knownNodeList))
                return true;
        }
    }

    return false;
}
PropertyNameList ObjectNodeInstance::propertyNames() const
{
    if (isValid())
        return QmlPrivateGate::allPropertyNames(object());
    return PropertyNameList();
}
PropertyNameList ObjectNodeInstance::ignoredProperties() const
{
    return PropertyNameList();
}
PropertyNameList BehaviorNodeInstance::ignoredProperties() const
{
    return PropertyNameList() << "enabled";
}
PropertyNameList PositionerNodeInstance::ignoredProperties() const
{
    return PropertyNameList() << "move" << "add" << "populate";
}
PropertyNameList QmlTransitionNodeInstance::ignoredProperties() const
{
    return PropertyNameList() << "from" << "to";
}