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

Gopala Krishna A krishna.ggk at gmail.com
Wed Aug 27 16:45:46 UTC 2008


SVN commit 853387 by gopala:

Fixed
1) UMLScene::onWidgetLine implementation.
2) Crash due to non existance of IDChangeLog object.
3) UMLScene::addWidget also now calls QGraphicsScene::addItem, thereby
   fixing "non appearance of wigdet" bug.



 M  +14 -10    umlscene.cpp  


--- branches/work/soc-umbrello/umbrello/umlscene.cpp #853386:853387
@@ -621,18 +621,15 @@
 
 ObjectWidget * UMLScene::onWidgetLine(const QPointF &point) const
 {
-    foreach(NewUMLRectWidget* obj, m_WidgetList) {
-        ObjectWidget *ow = dynamic_cast<ObjectWidget*>(obj);
-        if (ow == NULL)
+    QList<QGraphicsItem*> itemsAtPoint = items(point);
+    qDebug() << Q_FUNC_INFO << itemsAtPoint;
+    foreach(QGraphicsItem *item, itemsAtPoint) {
+        SeqLineWidget *pLine = dynamic_cast<SeqLineWidget*>(item);
+        if (!pLine) {
             continue;
-        SeqLineWidget *pLine = ow->sequentialLine();
-        if (pLine == NULL) {
-            uError() << "SeqLineWidget of " << ow->getName()
-                     << " (id=" << ID2STR(ow->localID()) << ") is NULL" << endl;
-            continue;
         }
-        if (pLine->contains(pLine->mapFromScene(point)))
-            return ow;
+
+        return pLine->objectWidget();
     }
     return 0;
 }
@@ -1339,6 +1336,10 @@
     if (!pWidget) {
         return false;
     }
+    if (pWidget->scene() != this) {
+        addItem(pWidget);
+    }
+
     Widget_Type type = pWidget->getBaseType();
     if (isPasteOperation) {
         if (type == Uml::wt_Message)
@@ -1358,6 +1359,9 @@
         uError() << " Cant addWidget to view in paste op because a log is not open" << endl;
         return false;
     }
+    if (!m_pIDChangesLog) {
+        m_pIDChangesLog = new IDChangeLog();
+    }
     qreal wX = pWidget->getX();
     qreal wY = pWidget->getY();
     bool xIsOutOfRange = (wX <= 0. || wX >= FloatingTextWidget::restrictPositionMax);




More information about the umbrello-devel mailing list