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


C++ UMLAttribute::parent方法代码示例

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


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

示例1: attributeAdded

/**
 * Slot for adding an attribute to the tree.
 * @param listItem   the new attribute to add
 */
void RefactoringAssistant::attributeAdded(UMLClassifierListItem *listItem)
{
    UMLAttribute *att = static_cast<UMLAttribute*>(listItem);
    DEBUG(DBG_SRC) << "attribute = " << att->name();  //:TODO:
    UMLClassifier *parent = dynamic_cast<UMLClassifier*>(att->parent());
    if (!parent) {
        uWarning() << att->name() << " - Parent of attribute is not a classifier!";
        return;
    }
    QTreeWidgetItem *item = findListViewItem(parent);
    if (!item) {
        uWarning() << "Parent is not in tree!";
        return;
    }
    for (int i = 0; i < item->childCount(); ++i) {
        QTreeWidgetItem *folder = item->child(i);
        if (folder->text(1) == QLatin1String("attributes")) {
            item = new QTreeWidgetItem(folder, QStringList(att->name()));
            m_umlObjectMap[item] = att;
            connect(att, SIGNAL(modified()), this, SLOT(objectModified()));
            setVisibilityIcon(item, att);
            DEBUG(DBG_SRC) << "attribute = " << att->name() << " added!";  //:TODO:
            break;
        }
    }
}
开发者ID:Salmista-94,项目名称:umbrello,代码行数:30,代码来源:refactoringassistant.cpp

示例2: attributeAdded

void RefactoringAssistant::attributeAdded( UMLClassifierListItem *a )
{
    UMLAttribute *att = static_cast<UMLAttribute*>(a);
    UMLClassifier *c = dynamic_cast<UMLClassifier*>(att->parent());
    if(!c)
    {
        kWarning() << "RefactoringAssistant::attributeAdded(" << att->getName()
            << ") - Parent is not a class!" << endl;
        return;
    }
    QListViewItem *item = findListViewItem( c );
    if( !item )
    {
        return;
    }
    for( QListViewItem *folder = item->firstChild(); folder; folder = folder->nextSibling() )
    {
        if( folder->text(1) == "attributes" )
        {
            item = new KListViewItem( folder, att->getName() );
            m_umlObjectMap[item] = att;
            connect( att, SIGNAL( modified() ), this, SLOT( umlObjectModified() ) );
            setVisibilityIcon( item, att );
            break;
        }
    }
}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:27,代码来源:refactoringassistant.cpp


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