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


C++ Property::getGroup方法代码示例

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


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

示例1: buildUp

void PropertyModel::buildUp(const std::map<std::string, std::vector<App::Property*> >& props)
{
    // fill up the listview with the properties
    rootItem->reset();

    // sort the properties into their groups
    std::map<std::string, std::vector<std::vector<App::Property*> > > propGroup;
    std::map<std::string, std::vector<App::Property*> >
        ::const_iterator jt;
    for (jt = props.begin(); jt != props.end(); ++jt) {
        App::Property* prop = jt->second.front();
        const char* group = prop->getGroup();
        std::string grp = group ? group : "Base";
        propGroup[grp].push_back(jt->second);
    }

    std::map<std::string, std::vector<std::vector<App::Property*> > >
        ::const_iterator kt;
    for (kt = propGroup.begin(); kt != propGroup.end(); ++kt) {
        // set group item
        PropertyItem* group = static_cast<PropertyItem*>(PropertySeparatorItem::create());
        group->setParent(rootItem);
        rootItem->appendChild(group);
        group->setPropertyName(QString::fromAscii(kt->first.c_str()));

        // setup the items for the properties
        std::vector<std::vector<App::Property*> >::const_iterator it;
        for (it = kt->second.begin(); it != kt->second.end(); ++it) {
            App::Property* prop = it->front();
            QString editor = QString::fromAscii(prop->getEditorName());
            if (!editor.isEmpty()) {
                Base::BaseClass* item = 0;
                try {
                    item = static_cast<Base::BaseClass*>(Base::Type::
                        createInstanceByName(prop->getEditorName(),true));
                }
                catch (...) {
                }
                if (!item) {
                    qWarning("No property item for type %s found\n", prop->getEditorName());
                    continue;
                }
                if (item->getTypeId().isDerivedFrom(PropertyItem::getClassTypeId())) {
                    PropertyItem* child = (PropertyItem*)item;
                    child->setParent(rootItem);
                    rootItem->appendChild(child);
                    child->setPropertyName(QString::fromAscii(prop->getName()));
                    child->setPropertyData(*it);
                }
            }
        }
    }

    reset();
}
开发者ID:lainegates,项目名称:FreeCAD,代码行数:55,代码来源:PropertyModel.cpp

示例2: addDynamicProperties

void DynamicProperty::addDynamicProperties(const PropertyContainer* cont)
{
    std::vector<std::string> names = cont->getDynamicPropertyNames();
    for (std::vector<std::string>::iterator it = names.begin(); it != names.end(); ++it) {
        App::Property* prop = cont->getDynamicPropertyByName(it->c_str());
        if (prop) {
            addDynamicProperty(
                prop->getTypeId().getName(),
                prop->getName(),
                prop->getGroup(),
                prop->getDocumentation(),
                prop->getType(),
                cont->isReadOnly(prop),
                cont->isHidden(prop));
        }
    }
}
开发者ID:lainegates,项目名称:FreeCAD,代码行数:17,代码来源:DynamicProperty.cpp


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