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

Oliver Kellogg okellogg at users.sourceforge.net
Sat Sep 10 06:03:14 UTC 2005


SVN commit 459233 by okellogg:

constrain(): New.

 M  +8 -2      boxwidget.cpp  
 M  +5 -0      boxwidget.h  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/boxwidget.cpp #459232:459233
@@ -41,6 +41,13 @@
     }
 }
 
+void BoxWidget::constrain(int& width, int& height) {
+    if (width < 20)
+        width = 20;
+    if (height < 20)
+        height = 20;
+}
+
 void BoxWidget::mouseMoveEvent(QMouseEvent *me) {
     if(!m_bResizing) {
         UMLWidget::mouseMoveEvent(me);
@@ -56,8 +63,7 @@
     }
     int newW = m_nOldW + newX - m_nOldX - m_nPressOffsetX;
     int newH = m_nOldH + newY - m_nOldY - m_nPressOffsetY;
-    newW = newW < 20?20:newW;
-    newH = newH < 20?20:newH;
+    constrain(newW, newH);
     setSize( newW, newH );
     adjustAssocs( getX(), getY() );
 }
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/boxwidget.h #459232:459233
@@ -49,6 +49,11 @@
     virtual ~BoxWidget();
 
     /**
+     * Apply possible constraints to the given candidate width and height.
+     */
+    virtual void constrain(int& width, int& height);
+
+    /**
      * Overrides the standard function.
      * Changes the cursor if in the lower right corner.
      */




More information about the umbrello-devel mailing list