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

Gopala Krishna A krishna.ggk at gmail.com
Tue Jul 8 17:23:40 UTC 2008


SVN commit 829583 by gopala:

Supporting one argument construtor for widgets

 M  +2 -2      datatypewidget.cpp  
 M  +6 -3      datatypewidget.h  
 M  +7 -3      widget_factory.cpp  


--- branches/work/soc-umbrello/umbrello/datatypewidget.cpp #829582:829583
@@ -20,8 +20,8 @@
 // qt/kde includes
 #include <QtGui/QPainter>
 
-DatatypeWidget::DatatypeWidget(UMLScene* scene, UMLClassifier *d) :
-    NewUMLRectWidget(scene, d),
+DatatypeWidget::DatatypeWidget(UMLClassifier *d) :
+    NewUMLRectWidget(d),
     m_minimumSize(100, 30)
 {
     m_textItemGroup = new TextItemGroup(this);
--- branches/work/soc-umbrello/umbrello/datatypewidget.h #829582:829583
@@ -20,11 +20,14 @@
 #define DATATYPE_MARGIN 5
 
 /**
- * Defines a graphical version of the datatype.  Most of the functionality
- * will come from the @ref NewUMLRectWidget class from which class inherits from.
+ * Defines a graphical version of the datatype.  Most of the
+ * functionality will come from the @ref NewUMLRectWidget class from
+ * which class inherits from.
  *
  * @short A graphical version of an datatype.
  * @author Jonathan Riddell
+ * @author Gopala Krishna (port using TextItems)
+ *
  * @see NewUMLRectWidget
  * Bugs and comments to uml-devel at lists.sf.net or http://bugs.kde.org
  */
@@ -38,7 +41,7 @@
      * @param view The parent of this DatatypeWidget.
      * @param d    The UMLClassifier this will be representing.
      */
-    DatatypeWidget(UMLScene* scene, UMLClassifier *d);
+    DatatypeWidget(UMLClassifier *d);
     virtual ~DatatypeWidget();
 
     bool loadFromXMI(QDomElement& qElement);
--- branches/work/soc-umbrello/umbrello/widget_factory.cpp #829582:829583
@@ -101,7 +101,7 @@
         newWidget = new ArtifactWidget(scene, static_cast<UMLArtifact*>(o));
         break;
     case Uml::ot_Datatype:
-        newWidget = new DatatypeWidget(scene, static_cast<UMLClassifier*>(o));
+        newWidget = new DatatypeWidget(static_cast<UMLClassifier*>(o));
         break;
     case Uml::ot_Enum:
         newWidget = new EnumWidget(scene, static_cast<UMLEnum*>(o));
@@ -151,6 +151,7 @@
     if (newWidget) {
         newWidget->setX( pos.x() );
         newWidget->setY( y );
+        scene->addItem(newWidget);
     }
 
     return newWidget;
@@ -254,7 +255,7 @@
                 widget = new ClassifierWidget(scene, static_cast<UMLClassifier*>(o));
         } else if (tag == "datatypewidget") {
             if (validateObjType(Uml::ot_Datatype, o, id))
-                widget = new DatatypeWidget(scene, static_cast<UMLClassifier*>(o));
+                widget = new DatatypeWidget(static_cast<UMLClassifier*>(o));
         } else if (tag == "enumwidget") {
             if (validateObjType(Uml::ot_Enum, o, id))
                 widget = new EnumWidget(scene, static_cast<UMLEnum*>(o));
@@ -270,8 +271,11 @@
             uWarning() << "Trying to create an unknown widget:" << tag;
         }
     }
+
+    if(widget) {
+        scene->addItem(widget);
+    }
     return widget;
-
 }
 
 }   // end namespace Widget_Factory




More information about the umbrello-devel mailing list