[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Sun Sep 26 09:44:08 UTC 2004


CVS commit by okellogg: 

Fix bug 88954.


  M +21 -0     messagewidget.cpp   1.47
  M +9 -0      messagewidget.h   1.21


--- kdesdk/umbrello/umbrello/messagewidget.h  #1.20:1.21
@@ -281,4 +281,13 @@ public:
 
         /**
+         * Overrides operation from UMLWidget.
+         *
+         * @param p Point to be checked.
+         *
+         * @return True if the point is on a visual part of the MessageWidget
+         */
+        bool onWidget(const QPoint & p);
+
+        /**
          * Overrides the standard operation.
          */

--- kdesdk/umbrello/umbrello/messagewidget.cpp  #1.46:1.47
@@ -206,4 +206,25 @@ void MessageWidget::drawAsynchronous(QPa
 }
 
+bool MessageWidget::onWidget(const QPoint & p) {
+        if (m_sequenceMessageType == Uml::sequence_message_asynchronous) {
+                return UMLWidget::onWidget(p);
+        }
+        // Synchronous message:
+        // Consists of top arrow (call) and bottom arrow (return.)
+        if (p.x() < getX() || p.x() > getX() + getWidth())
+                return false;
+        const int tolerance = 4;  // pixels
+        if (getHeight() <= 2 * tolerance)
+                return true;
+        const int pY = p.y();
+        const int topArrowY = getY();
+        const int bottomArrowY = topArrowY + getHeight();
+        if (pY < topArrowY - tolerance || pY > bottomArrowY + tolerance)
+                return false;
+        if (pY > topArrowY + tolerance && pY < bottomArrowY - tolerance)
+                return false;
+        return true;
+}
+
 void MessageWidget::setTextPosition() {
         if (m_pFText == NULL) {






More information about the umbrello-devel mailing list