[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Sun Aug 7 16:32:33 UTC 2005


SVN commit 443930 by okellogg:

calculateTextPosition(tr_Name): Add missing assignment of `text'.
Also, apply the constrained coordinates to the FloatingText.
BUG:110231


 M  +12 -5     associationwidget.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/associationwidget.cpp #443929:443930
@@ -1699,7 +1699,7 @@
     int textW = 0, textH = 0;
     int slope = 0, divisor = 1;
     const int SPACE = 2;
-    FloatingText const * text = 0;
+    FloatingText *text = 0;
 
     if(role == tr_MultiA) {
         text = getMultiWidget(A);
@@ -1778,6 +1778,8 @@
 
     } else if(role == tr_Name) {
 
+        calculateNameTextSegment();
+        text = m_pName;
         x = (int)( ( m_LinePath.getPoint(m_unNameLineSegment).x() +
                      m_LinePath.getPoint(m_unNameLineSegment + 1).x() ) / 2 );
 
@@ -1868,9 +1870,14 @@
     }
     if (text) {
         constrainTextPos(x, y, textW, textH, role);
-        // kdDebug() << "AssociationWidget::calculateTextPosition(" 
-        //   << p.x() << "," << p.y() << "): newPoint=("
-     	//   << x << "," << y << ")" << endl;
+        if (x != p.x() || y != p.y()) {
+            // kdDebug() << "AssociationWidget::calculateTextPosition(" 
+            //   << text->getName() << ") textrole " << role
+            //   << ": oldpoint=(" << p.x() << "," << p.y() << ")"
+            //   << ", newPoint=(" << x << "," << y << ")" << endl;
+            text->setX(x);
+            text->setY(y);
+        }
     }
     p = QPoint( x, y );
     return p;
@@ -1973,7 +1980,7 @@
     if (p0.y() == p1.y()) {
         // horizontal line
         // CAUTION: This is calculated in Qt coordinates!
-        ////////////////////////// constrain verticallly ///////////////////////////
+        ////////////////////////// constrain vertically /////////////////////////////
         const int lineY = p0.y();
         if (textY + textHeight < lineY - CORRIDOR_HALFWIDTH)  // constrain at top
             textY = lineY - CORRIDOR_HALFWIDTH - textHeight;




More information about the umbrello-devel mailing list