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

Oliver Kellogg okellogg at users.sourceforge.net
Sat Sep 10 06:07:01 UTC 2005


SVN commit 459238 by okellogg:

BUG:57672 - Inheriting from BoxWidget gives us resizability.


 M  +3 -3      ChangeLog  
 M  +21 -6     umbrello/forkjoinwidget.cpp  
 M  +10 -3     umbrello/forkjoinwidget.h  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #459237:459238
@@ -9,9 +9,9 @@
 * Automatic Diagram Layout (67059, not yet closed)
 
 * Bugs fixed / wishes implemented (see http://bugs.kde.org)
- 57588  58809  66461  67719  72016  79433  87252  88117  97162 105564
-108223 109591 109636 110216 110231 110379 111088 111470 111502 111759
-111768 112017 112293
+ 57588  57672  58809  66461  67719  72016  79433  87252  88117  97162
+105564 108223 109591 109636 110216 110231 110379 111088 111470 111502
+111759 111768 112017 112293
 
 Version 1.4.2 (maintenance release)
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/forkjoinwidget.cpp #459237:459238
@@ -24,7 +24,7 @@
 #include "listpopupmenu.h"
 
 ForkJoinWidget::ForkJoinWidget(UMLView * view, bool drawVertical, Uml::IDType id)
-  : UMLWidget(view, id), m_drawVertical(drawVertical) {
+  : BoxWidget(view, id), m_drawVertical(drawVertical) {
     init();
 }
 
@@ -38,10 +38,9 @@
 }
 
 void ForkJoinWidget::calculateSize() {
-    if (m_drawVertical)
-        setSize(4, 40);
-    else
-        setSize(40, 4);
+    int w = width(), h = height();
+    constrain(w, h);
+    setSize(w, h);
 }
 
 void ForkJoinWidget::draw(QPainter& p, int offsetX, int offsetY) {
@@ -52,9 +51,25 @@
     }
 }
 
-void ForkJoinWidget::drawSelected(QPainter *, int, int, bool) {
+void ForkJoinWidget::drawSelected(QPainter * p, int offsetX, int offsetY, bool resizeable) {
+    if (! resizeable) {
+        UMLWidget::drawSelected(p, offsetX, offsetY, resizeable);
+        return;
+    }
 }
 
+void ForkJoinWidget::constrain(int& width, int& height) {
+    if (m_drawVertical) {
+        width = 4;
+        if (height < 40)
+            height = 40;
+    } else {
+        height = 4;
+        if (width < 40)
+            width = 40;
+    }
+}
+
 void ForkJoinWidget::slotMenuSelection(int sel) {
     switch (sel) {
     case ListPopupMenu::mt_Flip:
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/forkjoinwidget.h #459237:459238
@@ -14,7 +14,7 @@
 //qt includes
 #include <qpainter.h>
 //app includes
-#include "umlwidget.h"
+#include "boxwidget.h"
 
 // fwd decl.
 class UMLView;
@@ -25,7 +25,7 @@
  * @see UMLWidget
  * Bugs and comments to uml-devel at lists.sf.net or http://bugs.kde.org
  */
-class ForkJoinWidget : public UMLWidget {
+class ForkJoinWidget : public BoxWidget {
 public:
 
     /**
@@ -64,6 +64,11 @@
     void slotMenuSelection(int sel);
 
     /**
+     * Reimplement method from BoxWidget.
+     */
+    void constrain(int& width, int& height);
+
+    /**
      * Draws a slim solid black rectangle.
      */
     void draw(QPainter & p, int offsetX, int offsetY);
@@ -80,7 +85,9 @@
 
 protected:
     /**
-     * Reimplements method from UMLWidget. Disables selection adornments and resize.
+     * Reimplement method from UMLWidget to suppress the resize corner.
+     * Although the ForkJoinWidget supports resizing, we suppress the
+     * resize corner because it is too large for this very slim widget.
      */
     void drawSelected(QPainter * p, int offsetX, int offsetY, bool resizeable = false);
 




More information about the umbrello-devel mailing list