Bug 146925

Summary: End Activity Symbol gets invalid when line thickness is increased
Product: [Applications] umbrello Reporter: Martin M <martin.meitzner>
Component: generalAssignee: Umbrello Development Group <umbrello-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Martin M 2007-06-18 16:57:25 UTC
Version:            (using KDE KDE 3.5.6)
Installed from:    Compiled From Sources
OS:                Linux

When I set the line width to anything > 1 in the properties dialog of an activity diagram, the symbol for the end activity becomes one fat dot. The thin white line between the center and the margin of the circle disappears. This is disturbing, since end activities can not be easily recognized anymore.

This applies to both on-screen and printed (1200 dpi) versions of the diagram
Comment 1 Oliver Kellogg 2007-06-18 19:37:02 UTC
SVN commit 677219 by okellogg:

updateComponentSize(): Remove special casing code, precondition for fixing
CCBUG:146925


 M  +0 -3      umlwidget.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlwidget.cpp #677218:677219
@@ -824,9 +824,6 @@
     const QSize minSize = calculateSize();
     const int w = minSize.width();
     const int h = minSize.height();
-    if (m_Type != Uml::wt_ForkJoin && m_Type != Uml::wt_Object &&
-        getWidth() >= w && getHeight() >= h)
-        return;
     setSize(w, h);
     adjustAssocs( getX(), getY() );  // adjust assoc lines
 }
Comment 2 Oliver Kellogg 2007-06-18 19:47:54 UTC
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;