当前位置: 首页>>代码示例>>C++>>正文


C++ AbstractProperty::isGroup方法代码示例

本文整理汇总了C++中AbstractProperty::isGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ AbstractProperty::isGroup方法的具体用法?C++ AbstractProperty::isGroup怎么用?C++ AbstractProperty::isGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AbstractProperty的用法示例。


在下文中一共展示了AbstractProperty::isGroup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

const AbstractProperty * PropertyGroup::findProperty(const std::vector<std::string> & path) const
{
    // [TODO] Use iterative approach rather than recursion

    // Check if path is valid
    if (path.size() == 0) {
        return nullptr;
    }

    // Check if first element of the path exists in this group
    if (!propertyExists(path.front())) {
        return nullptr;
    }

    // Get the respective property
    AbstractProperty * property = m_propertiesMap.at(path.front());

    // If there are no more sub-paths, return the found property
    if (path.size() == 1) {
        return property;
    }

    // Otherwise, it is an element in the middle of the path, so ensure it is a group
    if (!property->isGroup()) {
        return nullptr;
    }

    // Call recursively on subgroup
    return property->asGroup()->findProperty({ path.begin() + 1, path.end() });
}
开发者ID:kateyy,项目名称:libzeug,代码行数:30,代码来源:PropertyGroup.cpp

示例2: expandAllGroups

void PropertyBrowser::expandAllGroups()
{
    QAbstractItemModel * model = this->model();

    QModelIndexList indexes = model->match(model->index(0,0), Qt::DisplayRole, "*", -1, Qt::MatchWildcard|Qt::MatchRecursive);
    for (QModelIndex index : indexes)
    {
        if (!index.isValid())
            continue;

        AbstractProperty * property = retrieveProperty(index);

        if (property->isGroup() && model->hasChildren(index))
            expand(index);
    }
}
开发者ID:Tobias1595,项目名称:libzeug,代码行数:16,代码来源:PropertyBrowser.cpp

示例3: onRowsInserted

void PropertyBrowser::onRowsInserted(const QModelIndex & parentIndex, int first, int last)
{
    QAbstractItemModel * model = this->model();

    for (int i = first; i <= last; ++i)
    {
        QModelIndex index = model->index(i, 0, parentIndex);

        if (!index.isValid())
            continue;

        AbstractProperty * property = retrieveProperty(index);

        if (property->isGroup() && model->hasChildren(index))
            expand(index);
    }
}
开发者ID:Tobias1595,项目名称:libzeug,代码行数:17,代码来源:PropertyBrowser.cpp

示例4: addGroup

PropertyGroup * PropertyGroup::ensureGroup(const std::vector<std::string> & path)
{
    // [TODO] Use iterative approach rather than recursion

    // Check if path is valid
    if (path.size() == 0) {
        return nullptr;
    }

    // Check if group exists
    PropertyGroup * group = nullptr;
    if (propertyExists(path.front()))
    {
        // Get property
        AbstractProperty * property = m_propertiesMap.at(path.front());

        // Abort if this is not a group
        if (!property->isGroup()) {
            return nullptr;
        }

        // Get as group
        group = property->asGroup();
    }
    else
    {
        // Add new group
        group = addGroup(path.front());
    }

    // If there are no more sub-paths, return the group
    if (path.size() == 1) {
        return group;
    }

    // Otherwise, call recursively on subgroup
    return group->ensureGroup(std::vector<std::string>(path.begin() + 1, path.end()));
}
开发者ID:kateyy,项目名称:libzeug,代码行数:38,代码来源:PropertyGroup.cpp


注:本文中的AbstractProperty::isGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。