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

Gopala Krishna A krishna.ggk at gmail.com
Fri Jun 12 13:52:05 UTC 2009


SVN commit 980764 by gopala:

* Got New::AssociationWidget's alignment working with multipoint Association
  lines as well. (before it worked only with 2 point association line)

* Moving any point or segment of Association line also properly aligns the
  other end of Association line.

* Resizing widgets now also aligns the connected Association lines.



 M  +15 -5     newlinepath.cpp  
 M  +1 -0      widgets/umlwidget.cpp  


--- branches/work/soc-umbrello/umbrello/newlinepath.cpp #980763:980764
@@ -249,6 +249,7 @@
     {
         m_activePointIndex = m_activeSegmentIndex = -1;
         m_startHeadSymbol = m_endHeadSymbol = 0;
+        // This tracker is only for debugging and testing purpose.
         tracker = new QGraphicsLineItem;
         tracker->setPen(QPen(Qt::darkBlue, 1));
         tracker->setZValue(100);
@@ -698,7 +699,10 @@
             QPointF delta = event->scenePos() - event->lastScenePos();
             setPoint(m_activeSegmentIndex, m_points[m_activeSegmentIndex] + delta);
             setPoint(m_activeSegmentIndex + 1, m_points[m_activeSegmentIndex + 1] + delta);
+        } else {
+            return;
         }
+        calculateEndPoints();
     }
 
     /// Reset active indices and also push undo command.
@@ -844,21 +848,27 @@
         bRectLines[Uml::East] = QLineF(bRect.topRight(), bRect.bottomRight());
         bRectLines[Uml::South] = QLineF(bRect.bottomLeft(), bRect.bottomRight());
 
-        QLineF centerLine = QLineF(aRect.center(), bRect.center());
+        QLineF  aLine = QLineF(aRect.center(), bRect.center());
+        QLineF bLine = aLine;
+        if (count() > 2) {
+            uDebug() << "here";
+            aLine.setP2(m_associationWidget->mapToScene(point(1)));
+            bLine.setP1(m_associationWidget->mapToScene(point(count()-2)));
+        }
         if (!tracker->scene()) {
-            widA->scene()->addItem(tracker);
+            //widA->scene()->addItem(tracker);
         }
-        tracker->setLine(centerLine);
+        tracker->setLine(aLine);
         bool aNoIntersections = false, bNoIntersections = false;
 
         for (int i = Uml::West; i <= Uml::South; ++i) {
             Uml::Region r = (Uml::Region)i;
             QPointF temp;
-            aIntersections[r] = (centerLine.intersect(aRectLines[r], &temp) ==
+            aIntersections[r] = (aLine.intersect(aRectLines[r], &temp) ==
                     QLineF::BoundedIntersection);
             aNoIntersections = aNoIntersections || aIntersections[r];
 
-            bIntersections[r] = (centerLine.intersect(bRectLines[r], &temp) ==
+            bIntersections[r] = (bLine.intersect(bRectLines[r], &temp) ==
                     QLineF::BoundedIntersection);
             bNoIntersections = bNoIntersections || bIntersections[r];
         }
--- branches/work/soc-umbrello/umbrello/widgets/umlwidget.cpp #980763:980764
@@ -300,6 +300,7 @@
         if(m_widgetHandle) {
             m_widgetHandle->updateHandlePosition();
         }
+        adjustAssociations();
         return QVariant();
     }
     else if(change == FontHasChanged) {




More information about the umbrello-devel mailing list