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

Oliver Kellogg okellogg at users.sourceforge.net
Mon Jun 18 17:47:51 UTC 2007


SVN commit 677222 by okellogg:

draw(): Do not UMLWidget::setPen(p) because that uses the WidgetBase::m_LineWidth.
This is the actual fix for the bug at hand. But while at it, I made further fixes:
UMLWidget::m_bResizable: Set true unconditionally.
constrain(): New. Override virtual method of UMLWidget for better resize behavior.
Activity_Type, Fork_DEPRECATED: Remove.

BUG:146925


 M  +1 -0      ChangeLog  
 M  +37 -12    umbrello/activitywidget.cpp  
 M  +6 -2      umbrello/activitywidget.h  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #677221:677222
@@ -3,6 +3,7 @@
 * Bugs/wishes from http://bugs.kde.org:
 * Wrong pascal code generation (146676)
 * Crash when linking to undefined xmi.id (146748)
+* End Activity Symbol gets invalid when line thickness is increased (146925)
 
 Version 1.5.71
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/activitywidget.cpp #677221:677222
@@ -62,12 +62,12 @@
         UMLWidget::setPen(p);
         break;
     case Initial :
-        UMLWidget::setPen(p);
+        p.setPen( QPen(m_LineColour, 1) );
         p.setBrush( WidgetBase::getLineColor() );
         p.drawEllipse( offsetX, offsetY, w, h );
         break;
     case End :
-        UMLWidget::setPen(p);
+        p.setPen( QPen(m_LineColour, 1) );
         p.setBrush( WidgetBase::getLineColor() );
         p.drawEllipse( offsetX, offsetY, w, h );
         p.setBrush( Qt::white );
@@ -88,16 +88,45 @@
             p.drawPolyline( array );
         }
         break;
-    case Fork_DEPRECATED :  // to be removed
-        p.fillRect( offsetX, offsetY, width(), height(), QBrush( Qt::darkYellow ));
-        break;
     }
     if(m_bSelected)
         drawSelected(&p, offsetX, offsetY);
 }
 
+void ActivityWidget::constrain(int& width, int& height) {
+    if (m_ActivityType == Normal) {
+        QSize minSize = calculateSize();
+        if (width < minSize.width())
+            width = minSize.width();
+        if (height < minSize.height())
+            height = minSize.height();
+        return;
+    }
+    if (width > height)
+        width = height;
+    else if (height > width)
+        height = width;
+    if (m_ActivityType == Branch) {
+        if (width < 20) {
+            width = 20;
+            height = 20;
+        } else if (width > 50) {
+            width = 50;
+            height = 50;
+        }
+    } else {
+        if (width < 15) {
+            width = 15;
+            height = 15;
+        } else if (width > 30) {
+            width = 30;
+            height = 30;
+        }
+    }
+}
+
 QSize ActivityWidget::calculateSize() {
-    int width = 10, height = 10;
+    int width, height;
     if ( m_ActivityType == Normal ) {
         const QFontMetrics &fm = getFontMetrics(FT_NORMAL);
         const int fontHeight  = fm.lineSpacing();
@@ -107,7 +136,7 @@
         height = height > ACTIVITY_HEIGHT ? height : ACTIVITY_HEIGHT;
         width += ACTIVITY_MARGIN * 2;
         height += ACTIVITY_MARGIN * 2;
-    } else if ( m_ActivityType == Branch ) {
+    } else {
         width = height = 20;
     }
     return QSize(width, height);
@@ -119,7 +148,7 @@
 
 void ActivityWidget::setActivityType( ActivityType activityType ) {
     m_ActivityType = activityType;
-    UMLWidget::m_bResizable = (m_ActivityType == Normal);
+    UMLWidget::m_bResizable = true;
 }
 
 void ActivityWidget::slotMenuSelection(int sel) {
@@ -174,10 +203,6 @@
     case WorkToolBar::tbb_Branch:
         resultType = Branch;
         break;
-    case WorkToolBar::tbb_Fork:
-        kError() << "ActivityWidget::isActivity returns Fork_DEPRECATED" << endl;
-        resultType = Fork_DEPRECATED;
-        break;
     default:
         status = false;
         break;
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/activitywidget.h #677221:677222
@@ -40,8 +40,7 @@
         Initial = 0,
         Normal,
         End,
-        Branch,
-        Fork_DEPRECATED  // use ForkJoinWidget instead
+        Branch
     };
 
     /**
@@ -65,6 +64,11 @@
     void draw(QPainter & p, int offsetX, int offsetY);
 
     /**
+     * Overrides Method from UMLWidget.
+     */
+    void constrain(int& width, int& height);
+
+    /**
      * Returns the type of activity.
      */
     ActivityType getActivityType() const;




More information about the umbrello-devel mailing list