/** * Returns the signature of items that are operations. * @return signature of an operation item, else an empty string */ QString UMLListViewItem::toolTip() { UMLObject *obj = umlObject(); if (obj) { switch (obj->baseType()) { case UMLObject::ot_Class: return obj->doc(); case UMLObject::ot_Operation: { UMLOperation *op = static_cast<UMLOperation*>(obj); return op->toString(Uml::SignatureType::ShowSig); } case UMLObject::ot_Attribute: { UMLAttribute *at = static_cast<UMLAttribute*>(obj); return at->toString(Uml::SignatureType::ShowSig); } default: return QString(); } } else { return QString(); } }
void CPPHeaderCodeClassFieldDeclarationBlock::updateContent() { UMLObject *umlparent = CodeClassFieldDeclarationBlock::getParentObject(); if (umlparent == NULL) { return; } CodeClassField * cf = getParentClassField(); CPPCodeClassField * hcppcf = dynamic_cast<CPPCodeClassField*>(cf); // Check for dynamic casting failure! if (hcppcf == NULL) { uError() << "hcppcf: invalid dynamic cast"; return; } // Set the comment QString notes = umlparent->doc(); getComment()->setText(notes); if (notes.isEmpty()) getComment()->setWriteOutText(false); else getComment()->setWriteOutText(true); // Set the body QString staticValue = umlparent->isStatic() ? QLatin1String("static ") : QString(); QString typeName = hcppcf->getTypeName(); QString fieldName = hcppcf->getFieldName(); // Ugh. Sloppy exception. if (!cf->parentIsAttribute() && !cf->fieldIsSingleValue()) typeName = hcppcf->getListFieldClassName(); QString body = staticValue + QLatin1Char(' ') + typeName + QLatin1Char(' ') + fieldName + QLatin1Char(';'); setText(body); }