本文整理汇总了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;
}
}
}
示例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;
}
}
}