[Uml-devel] branches/work/soc-umbrello/umbrello
Gopala Krishna A
krishna.ggk at gmail.com
Tue Aug 12 10:12:43 UTC 2008
SVN commit 845685 by gopala:
Implemented *horizontal only* movement constraint while dragging an
ObjectWidget in sequence diagram.
M +19 -0 objectwidget.cpp
M +1 -0 objectwidget.h
--- branches/work/soc-umbrello/umbrello/objectwidget.cpp #845684:845685
@@ -490,6 +490,25 @@
}
/**
+ * Reimplemented from QGraphicsItem::itemChange to handle @ref
+ * ItemPositionChange to allow only horizontal movement of Object
+ * widget.
+ */
+QVariant ObjectWidget::itemChange(GraphicsItemChange change, const QVariant& value)
+{
+ UMLScene *uScene = umlScene();
+
+ if (change == ItemPositionChange) {
+ if (uScene && uScene->getType() == Uml::dt_Sequence && uScene->isMouseMovingItems()) {
+ QPointF newPoint = value.toPointF();
+ newPoint.setY(y()); // set old y, so no vertical movement
+ return newPoint;
+ }
+ }
+ return NewUMLRectWidget::itemChange(change, value);
+}
+
+/**
* Shifts the object a little higher, provided it is still in diagram
* limits.
*/
--- branches/work/soc-umbrello/umbrello/objectwidget.h #845684:845685
@@ -100,6 +100,7 @@
virtual void updateGeometry();
virtual void updateTextItemGroups();
virtual QVariant attributeChange(WidgetAttributeChange change, const QVariant& oldValue);
+ virtual QVariant itemChange(GraphicsItemChange change, const QVariant& value);
private:
void tabUp();
More information about the umbrello-devel
mailing list