[Uml-devel] branches/work/soc-umbrello/umbrello/widgets

Gopala Krishna A krishna.ggk at gmail.com
Fri Jun 5 07:37:33 UTC 2009


SVN commit 977720 by gopala:

Added New::AssociationWidget::roleForWidget() method to return the role of a
given UMLWidget in the Association.


 M  +12 -0     newassociationwidget.cpp  
 M  +2 -0      newassociationwidget.h  


--- branches/work/soc-umbrello/umbrello/widgets/newassociationwidget.cpp #977719:977720
@@ -455,6 +455,18 @@
         }
     }
 
+    Uml::Role_Type AssociationWidget::roleForWidget(UMLWidget *widget) const
+    {
+        if (m_widgetRole[Uml::A].umlWidget == widget) {
+            return Uml::A;
+        } else if (m_widgetRole[Uml::B].umlWidget == widget) {
+            return Uml::B;
+        } else {
+            Q_ASSERT_X(false, "roleForWidget()", "widget passed isn't pariticpant of association");
+        }
+        return Uml::A; // unreachable.
+    }
+
     UMLWidget* AssociationWidget::widgetForRole(Uml::Role_Type role) const
     {
         return m_widgetRole[role].umlWidget;
--- branches/work/soc-umbrello/umbrello/widgets/newassociationwidget.h #977719:977720
@@ -106,6 +106,8 @@
 
         void setRoleName (const QString &strRole, Uml::Role_Type role);
 
+        Uml::Role_Type roleForWidget(UMLWidget *widget) const;
+
         UMLWidget* widgetForRole(Uml::Role_Type role) const;
         void setWidgetForRole(UMLWidget *widget, Uml::Role_Type role);
 




More information about the umbrello-devel mailing list