示例#1
0
int UMLListViewFinder::collect(Category category, const QString &text)
{
    Q_UNUSED(category);
    QList<QTreeWidgetItem*> items = UMLApp::app()->listView()->findItems(text, Qt::MatchContains | Qt::MatchRecursive);
    m_items.clear();
    foreach(QTreeWidgetItem *item, items) {
        UMLListViewItem *ui = dynamic_cast<UMLListViewItem *>(item);
        if (!ui)
            continue;
        UMLObject *o = ui->umlObject();
        if (!includeObject(category, o))
            continue;
        m_items.append(o->id());
    }
示例#2
0
/**
 * Returns the ID of the UMLObject assigned to the given role.
 * Shorthand for getObject(role)->getID().
 * @return  ID of the UMLObject in the given role.
 */
Uml::IDType UMLAssociation::getObjectId(Uml::Role_Type role) const
{
    UMLRole *roleObj = m_pRole[role];
    UMLObject *o = roleObj->object();
    if (o == NULL) {
        QString auxID = roleObj->secondaryId();
        if (auxID.isEmpty()) {
            uError() << "role " << role << ": getObject returns NULL";
            return Uml::id_None;
        } else {
            uDebug() << "role " << role << ": using secondary ID " << auxID;
            return STR2ID(auxID);
        }
    }
    return o->id();
}