summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2016-09-05 14:43:32 (GMT)
committerRalf Habacker <ralf.habacker@freenet.de>2016-09-06 14:59:49 (GMT)
commitfa3f51e764c4296c81454f25b340d00241f172d3 (patch)
tree874b1719f36993ff30606716e00b474490cfee2f
parenta5f92b67494666e4e6779b1f2443b1a1df2b031d (diff)
Fix QPointer related dynamic_casts to use asUML... wrapper().
CCBUG:368282 Reviewed-by: aaron.nottbeck at sag.eu
-rw-r--r--umbrello/umlmodel/classifier.cpp10
-rw-r--r--umbrello/umlmodel/classifierlistitem.cpp2
-rw-r--r--umbrello/umlwidgets/artifactwidget.cpp4
-rw-r--r--umbrello/umlwidgets/associationwidget.cpp16
-rw-r--r--umbrello/umlwidgets/categorywidget.cpp2
-rw-r--r--umbrello/umlwidgets/classifierwidget.cpp2
-rw-r--r--umbrello/umlwidgets/componentwidget.cpp6
-rw-r--r--umbrello/umlwidgets/entitywidget.cpp16
-rw-r--r--umbrello/umlwidgets/enumwidget.cpp8
-rw-r--r--umbrello/umlwidgets/messagewidget.cpp2
10 files changed, 34 insertions, 34 deletions
diff --git a/umbrello/umlmodel/classifier.cpp b/umbrello/umlmodel/classifier.cpp
index 1400f4d..ee010ca 100644
--- a/umbrello/umlmodel/classifier.cpp
+++ b/umbrello/umlmodel/classifier.cpp
@@ -1211,7 +1211,7 @@ int UMLClassifier::takeItem(UMLClassifierListItem *item)
break;
}
case UMLObject::ot_Attribute: {
- UMLAttribute *retval = dynamic_cast<UMLAttribute*>(m_List.takeAt(index).data());
+ UMLAttribute *retval = m_List.takeAt(index)->asUMLAttribute();
if (retval) {
emit attributeRemoved(retval);
UMLObject::emitModified();
@@ -1221,7 +1221,7 @@ int UMLClassifier::takeItem(UMLClassifierListItem *item)
break;
}
case UMLObject::ot_Template: {
- UMLTemplate *templt = dynamic_cast<UMLTemplate*>(m_List.takeAt(index).data());
+ UMLTemplate *templt = m_List.takeAt(index)->asUMLTemplate();
if (templt) {
emit templateRemoved(templt);
UMLObject::emitModified();
@@ -1231,7 +1231,7 @@ int UMLClassifier::takeItem(UMLClassifierListItem *item)
break;
}
case UMLObject::ot_EnumLiteral: {
- UMLEnumLiteral *el = dynamic_cast<UMLEnumLiteral*>(m_List.takeAt(index).data());
+ UMLEnumLiteral *el = m_List.takeAt(index)->asUMLEnumLiteral();
if (el) {
UMLEnum *e = this->asUMLEnum();
e->signalEnumLiteralRemoved(el);
@@ -1242,7 +1242,7 @@ int UMLClassifier::takeItem(UMLClassifierListItem *item)
break;
}
case UMLObject::ot_EntityAttribute: {
- UMLEntityAttribute* el = dynamic_cast<UMLEntityAttribute*>(m_List.takeAt(index).data());
+ UMLEntityAttribute* el = m_List.takeAt(index)->asUMLEntityAttribute();
if (el) {
UMLEntity *e = this->asUMLEntity();
e->signalEntityAttributeRemoved(el);
@@ -1274,7 +1274,7 @@ void UMLClassifier::setOriginType(UMLClassifier *origType)
*/
UMLClassifier * UMLClassifier::originType() const
{
- return dynamic_cast<UMLClassifier*>(m_pSecondary.data());
+ return m_pSecondary->asUMLClassifier();
}
/**
diff --git a/umbrello/umlmodel/classifierlistitem.cpp b/umbrello/umlmodel/classifierlistitem.cpp
index 89cd61e..b03bdb8 100644
--- a/umbrello/umlmodel/classifierlistitem.cpp
+++ b/umbrello/umlmodel/classifierlistitem.cpp
@@ -99,7 +99,7 @@ QString UMLClassifierListItem::toString(Uml::SignatureType::Enum sig)
*/
UMLClassifier * UMLClassifierListItem::getType() const
{
- return dynamic_cast<UMLClassifier*>(m_pSecondary.data());
+ return m_pSecondary->asUMLClassifier();
}
/**
diff --git a/umbrello/umlwidgets/artifactwidget.cpp b/umbrello/umlwidgets/artifactwidget.cpp
index 41a2a8e..c6091a6 100644
--- a/umbrello/umlwidgets/artifactwidget.cpp
+++ b/umbrello/umlwidgets/artifactwidget.cpp
@@ -53,7 +53,7 @@ void ArtifactWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
}
if (umlObject()) {
- UMLArtifact *umlart = dynamic_cast<UMLArtifact*>(m_umlObject.data());
+ UMLArtifact *umlart = m_umlObject->asUMLArtifact();
UMLArtifact::Draw_Type drawType = umlart->getDrawAsType();
switch (drawType) {
case UMLArtifact::defaultDraw:
@@ -97,7 +97,7 @@ QSizeF ArtifactWidget::minimumSize() const
if (!m_umlObject) {
return UMLWidget::minimumSize();
}
- UMLArtifact *umlart = dynamic_cast<UMLArtifact*>(m_umlObject.data());
+ UMLArtifact *umlart = m_umlObject->asUMLArtifact();
if (umlart->getDrawAsType() == UMLArtifact::defaultDraw) {
return calculateNormalSize();
} else {
diff --git a/umbrello/umlwidgets/associationwidget.cpp b/umbrello/umlwidgets/associationwidget.cpp
index 40ee1f2..ba5e4ee 100644
--- a/umbrello/umlwidgets/associationwidget.cpp
+++ b/umbrello/umlwidgets/associationwidget.cpp
@@ -324,7 +324,7 @@ UMLClassifier *AssociationWidget::operationOwner()
*/
UMLOperation *AssociationWidget::operation()
{
- return dynamic_cast<UMLOperation*>(m_umlObject.data());
+ return m_umlObject->asUMLOperation();
}
/**
@@ -567,7 +567,7 @@ UMLAssociation* AssociationWidget::association() const
{
if (m_umlObject == NULL || m_umlObject->baseType() != UMLObject::ot_Association)
return NULL;
- return dynamic_cast<UMLAssociation*>(m_umlObject.data());
+ return m_umlObject->asUMLAssociation();
}
/**
@@ -583,7 +583,7 @@ UMLAttribute* AssociationWidget::attribute() const
UMLObject::ObjectType ot = m_umlObject->baseType();
if (ot != UMLObject::ot_Attribute && ot != UMLObject::ot_EntityAttribute)
return NULL;
- return dynamic_cast<UMLAttribute*>(m_umlObject.data());
+ return m_umlObject->asUMLAttribute();
}
#if 0 //:TODO:
@@ -1039,7 +1039,7 @@ QString AssociationWidget::roleDocumentation(Uml::RoleType::Enum role) const
{
if (m_umlObject == NULL || m_umlObject->baseType() != UMLObject::ot_Association)
return QString();
- UMLAssociation *umla = dynamic_cast<UMLAssociation*>(m_umlObject.data());
+ UMLAssociation *umla = m_umlObject->asUMLAssociation();
return umla->getRoleDoc(role);
}
@@ -1157,7 +1157,7 @@ Uml::Changeability::Enum AssociationWidget::changeability(Uml::RoleType::Enum ro
{
if (m_umlObject == NULL || m_umlObject->baseType() != UMLObject::ot_Association)
return m_role[role].changeability;
- UMLAssociation *umla = dynamic_cast<UMLAssociation*>(m_umlObject.data());
+ UMLAssociation *umla = m_umlObject->asUMLAssociation();
return umla->changeability(role);
}
@@ -1462,7 +1462,7 @@ Uml::AssociationType::Enum AssociationWidget::associationType() const
{
if (m_umlObject == NULL || m_umlObject->baseType() != UMLObject::ot_Association)
return m_associationType;
- UMLAssociation *umla = dynamic_cast<UMLAssociation*>(m_umlObject.data());
+ UMLAssociation *umla = m_umlObject->asUMLAssociation();
return umla->getAssocType();
}
@@ -1511,7 +1511,7 @@ Uml::ID::Type AssociationWidget::widgetIDForRole(Uml::RoleType::Enum role) const
{
if (m_role[role].umlWidget == NULL) {
if (m_umlObject && m_umlObject->baseType() == UMLObject::ot_Association) {
- UMLAssociation *umla = dynamic_cast<UMLAssociation*>(m_umlObject.data());
+ UMLAssociation *umla = m_umlObject->asUMLAssociation();
return umla->getObjectId(role);
}
uError() << "umlWidget is NULL";
@@ -1530,7 +1530,7 @@ Uml::ID::Type AssociationWidget::widgetLocalIDForRole(Uml::RoleType::Enum role)
{
if (m_role[role].umlWidget == NULL) {
if (m_umlObject && m_umlObject->baseType() == UMLObject::ot_Association) {
- UMLAssociation *umla = dynamic_cast<UMLAssociation*>(m_umlObject.data());
+ UMLAssociation *umla = m_umlObject->asUMLAssociation();
return umla->getObjectId(role);
}
uError() << "umlWidget is NULL";
diff --git a/umbrello/umlwidgets/categorywidget.cpp b/umbrello/umlwidgets/categorywidget.cpp
index 2033b13..13e5273 100644
--- a/umbrello/umlwidgets/categorywidget.cpp
+++ b/umbrello/umlwidgets/categorywidget.cpp
@@ -70,7 +70,7 @@ void CategoryWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
painter->setPen(textColor());
QString letterType(QLatin1Char('D'));
- switch(dynamic_cast<UMLCategory*>(m_umlObject.data())->getType()) {
+ switch(m_umlObject->asUMLCategory()->getType()) {
case UMLCategory::ct_Disjoint_Specialisation:
letterType = QLatin1Char('D');
break;
diff --git a/umbrello/umlwidgets/classifierwidget.cpp b/umbrello/umlwidgets/classifierwidget.cpp
index 57af1e1..8c44b09 100644
--- a/umbrello/umlwidgets/classifierwidget.cpp
+++ b/umbrello/umlwidgets/classifierwidget.cpp
@@ -137,7 +137,7 @@ ClassifierWidget::~ClassifierWidget()
*/
UMLClassifier *ClassifierWidget::classifier() const
{
- return dynamic_cast<UMLClassifier*>(m_umlObject.data());
+ return m_umlObject->asUMLClassifier();
}
/**
diff --git a/umbrello/umlwidgets/componentwidget.cpp b/umbrello/umlwidgets/componentwidget.cpp
index cbbc459..c8bab14 100644
--- a/umbrello/umlwidgets/componentwidget.cpp
+++ b/umbrello/umlwidgets/componentwidget.cpp
@@ -55,7 +55,7 @@ void ComponentWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
Q_UNUSED(option);
Q_UNUSED(widget);
- UMLComponent *umlcomp = dynamic_cast<UMLComponent*>(m_umlObject.data());
+ UMLComponent *umlcomp = m_umlObject->asUMLComponent();
if (umlcomp == NULL)
return;
setPenFromSettings(painter);
@@ -146,7 +146,7 @@ void ComponentWidget::adjustAssocs(qreal dx, qreal dy)
return;
}
UMLWidget::adjustAssocs(dx, dy);
- UMLPackage *comp = dynamic_cast<UMLPackage*>(m_umlObject.data());
+ UMLPackage *comp = m_umlObject->asUMLPackage();
foreach (UMLObject *o, comp->containedObjects()) {
uIgnoreZeroPointer(o);
if (o->baseType() != UMLObject::ot_Port)
@@ -196,7 +196,7 @@ QSizeF ComponentWidget::minimumSize() const
int height = (2*fontHeight) + (COMPONENT_MARGIN * 3);
- UMLComponent *umlcomp = dynamic_cast<UMLComponent*>(m_umlObject.data());
+ UMLComponent *umlcomp = m_umlObject->asUMLComponent();
if (umlcomp && umlcomp->getExecutable()) {
width += 2;
height += 2;
diff --git a/umbrello/umlwidgets/entitywidget.cpp b/umbrello/umlwidgets/entitywidget.cpp
index c272e5d..7607713 100644
--- a/umbrello/umlwidgets/entitywidget.cpp
+++ b/umbrello/umlwidgets/entitywidget.cpp
@@ -103,7 +103,7 @@ void EntityWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
painter->drawLine(0, y, w, y);
QFontMetrics fontMetrics(font);
- UMLClassifier *classifier = dynamic_cast<UMLClassifier*>(m_umlObject.data());
+ UMLClassifier *classifier = m_umlObject->asUMLClassifier();
UMLClassifierListItem* entityattribute = 0;
UMLClassifierListItemList list = classifier->getFilteredList(UMLObject::ot_EntityAttribute);
foreach (entityattribute, list) {
@@ -146,7 +146,7 @@ void EntityWidget::slotMenuSelection(QAction* action)
ListPopupMenu::MenuType sel = ListPopupMenu::typeFromAction(action);
switch(sel) {
case ListPopupMenu::mt_EntityAttribute:
- if (Object_Factory::createChildObject(dynamic_cast<UMLClassifier*>(m_umlObject.data()),
+ if (Object_Factory::createChildObject(m_umlObject->asUMLClassifier(),
UMLObject::ot_EntityAttribute)) {
UMLApp::app()->document()->setModified();
}
@@ -154,19 +154,19 @@ void EntityWidget::slotMenuSelection(QAction* action)
case ListPopupMenu::mt_PrimaryKeyConstraint:
case ListPopupMenu::mt_UniqueConstraint:
- if (UMLObject* obj = Object_Factory::createChildObject(dynamic_cast<UMLEntity*>(m_umlObject.data()),
+ if (UMLObject* obj = Object_Factory::createChildObject(m_umlObject->asUMLEntity(),
UMLObject::ot_UniqueConstraint)) {
UMLApp::app()->document()->setModified();
if (sel == ListPopupMenu::mt_PrimaryKeyConstraint) {
UMLUniqueConstraint* uc = obj->asUMLUniqueConstraint();
- dynamic_cast<UMLEntity*>(m_umlObject.data())->setAsPrimaryKey(uc);
+ m_umlObject->asUMLEntity()->setAsPrimaryKey(uc);
}
}
break;
case ListPopupMenu::mt_ForeignKeyConstraint:
- if (Object_Factory::createChildObject(dynamic_cast<UMLEntity*>(m_umlObject.data()),
+ if (Object_Factory::createChildObject(m_umlObject->asUMLEntity(),
UMLObject::ot_ForeignKeyConstraint)) {
UMLApp::app()->document()->setModified();
@@ -174,7 +174,7 @@ void EntityWidget::slotMenuSelection(QAction* action)
break;
case ListPopupMenu::mt_CheckConstraint:
- if (Object_Factory::createChildObject(dynamic_cast<UMLEntity*>(m_umlObject.data()),
+ if (Object_Factory::createChildObject(m_umlObject->asUMLEntity(),
UMLObject::ot_CheckConstraint)) {
UMLApp::app()->document()->setModified();
@@ -209,7 +209,7 @@ QSizeF EntityWidget::minimumSize() const
lines++;
}
- const int numberOfEntityAttributes = dynamic_cast<UMLEntity*>(m_umlObject.data())->entityAttributes();
+ const int numberOfEntityAttributes = m_umlObject->asUMLEntity()->entityAttributes();
height = width = 0;
//set the height of the entity
@@ -231,7 +231,7 @@ QSizeF EntityWidget::minimumSize() const
width = w > width ? w : width;
- UMLClassifier* classifier = dynamic_cast<UMLClassifier*>(m_umlObject.data());
+ UMLClassifier* classifier = m_umlObject->asUMLClassifier();
UMLClassifierListItemList list = classifier->getFilteredList(UMLObject::ot_EntityAttribute);
UMLClassifierListItem* listItem = 0;
foreach (listItem, list) {
diff --git a/umbrello/umlwidgets/enumwidget.cpp b/umbrello/umlwidgets/enumwidget.cpp
index 7335846..e16f7ac 100644
--- a/umbrello/umlwidgets/enumwidget.cpp
+++ b/umbrello/umlwidgets/enumwidget.cpp
@@ -138,7 +138,7 @@ void EnumWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
painter->drawLine(0, y, w, y);
QFontMetrics fontMetrics(font);
- UMLClassifier *classifier = dynamic_cast<UMLClassifier*>(m_umlObject.data());
+ UMLClassifier *classifier = m_umlObject->asUMLClassifier();
UMLClassifierListItem* enumLiteral = 0;
UMLClassifierListItemList list = classifier->getFilteredList(UMLObject::ot_EnumLiteral);
foreach (enumLiteral, list) {
@@ -189,7 +189,7 @@ void EnumWidget::slotMenuSelection(QAction* action)
{
ListPopupMenu::MenuType sel = ListPopupMenu::typeFromAction(action);
if (sel == ListPopupMenu::mt_EnumLiteral) {
- if (Object_Factory::createChildObject(dynamic_cast<UMLClassifier*>(m_umlObject.data()),
+ if (Object_Factory::createChildObject(m_umlObject->asUMLClassifier(),
UMLObject::ot_EnumLiteral)) {
/* I don't know why it works without these calls:
updateComponentSize();
@@ -223,7 +223,7 @@ QSizeF EnumWidget::minimumSize() const
int lines = 1;//always have one line - for name
lines++; //for the stereotype
- const int numberOfEnumLiterals = dynamic_cast<UMLEnum*>(m_umlObject.data())->enumLiterals();
+ const int numberOfEnumLiterals = m_umlObject->asUMLEnum()->enumLiterals();
height = width = 0;
//set the height of the enum
@@ -247,7 +247,7 @@ QSizeF EnumWidget::minimumSize() const
width = w > width?w:width;
- UMLClassifier *classifier = dynamic_cast<UMLClassifier*>(m_umlObject.data());
+ UMLClassifier *classifier = m_umlObject->asUMLClassifier();
UMLClassifierListItemList list = classifier->getFilteredList(UMLObject::ot_EnumLiteral);
UMLClassifierListItem* listItem = 0;
foreach (listItem, list) {
diff --git a/umbrello/umlwidgets/messagewidget.cpp b/umbrello/umlwidgets/messagewidget.cpp
index 7f4c18c..fb103d8 100644
--- a/umbrello/umlwidgets/messagewidget.cpp
+++ b/umbrello/umlwidgets/messagewidget.cpp
@@ -936,7 +936,7 @@ UMLClassifier *MessageWidget::operationOwner()
*/
UMLOperation *MessageWidget::operation()
{
- return dynamic_cast<UMLOperation*>(m_umlObject.data());
+ return m_umlObject->asUMLOperation();
}
/**