[Uml-devel] KDE/kdesdk/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Fri Mar 9 18:01:49 UTC 2012


SVN commit 1284663 by okellogg:

UMLWidget::drawSelected():
- Don't draw the resize anchor if the widget is so small that the anchor
  would cover up most of the widget.

UMLWidgetController::isInResizeArea():
- If the widget itself is very small then make the resize area small, too.
  Reason: Else it becomes impossible to do a Move instead of Resize.

BUG: 295605


 M  +1 -0      ChangeLog  
 M  +10 -3     umbrello/controller/umlwidgetcontroller.cpp  
 M  +3 -1      umbrello/widgets/umlwidget.cpp  


--- trunk/KDE/kdesdk/umbrello/ChangeLog #1284662:1284663
@@ -4,6 +4,7 @@
 * Cannot anchor note in state diagram (270597)
 * Color of role text on diagram (e.g. Role B) nearly invisible (291401)
 * Junk residual UMLAssociations saved to XMI (293042)
+* Problems with widget moving/resizing in state diagrams (295605)
 
 Version 2.8.1
 
--- trunk/KDE/kdesdk/umbrello/umbrello/controller/umlwidgetcontroller.cpp #1284662:1284663
@@ -402,11 +402,18 @@
  */
 bool UMLWidgetController::isInResizeArea(QMouseEvent *me)
 {
-    const int m = 10;
+    int m = 10;
+    const int w = m_widget->width();
+    const int h = m_widget->height();
 
+    // If the widget itself is very small then make the resize area small, too.
+    // Reason: Else it becomes impossible to do a Move instead of Resize.
+    if (w - m < m || h - m < m)
+        m = 2;
+
     if (m_widget->m_resizable &&
-            me->x() >= (m_widget->getX() + m_widget->width() - m) &&
-            me->y() >= (m_widget->getY() + m_widget->height() - m)) {
+            me->x() >= (m_widget->getX() + w - m) &&
+            me->y() >= (m_widget->getY() + h - m)) {
         m_widget->m_scene->setCursor(getResizeCursor());
         return true;
     } else {
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/umlwidget.cpp #1284662:1284663
@@ -631,7 +631,9 @@
     p->fillRect(offsetX + w - s, offsetY, s, s, brush);
 
     // Draw the resize anchor in the lower right corner.
-    if (m_resizable) {
+    // Don't draw it if the widget is so small that the
+    // resize anchor would cover up most of the widget.
+    if (m_resizable && w * h > (s*3) * (s*3)) {
         brush.setColor(Qt::red);
         const int right = offsetX + w;
         const int bottom = offsetY + h;




More information about the umbrello-devel mailing list