[Uml-devel] branches/work/soc-umbrello/umbrello/widgets
Gopala Krishna A
krishna.ggk at gmail.com
Fri Jun 19 12:08:59 UTC 2009
SVN commit 983874 by gopala:
Move all points of self New::AssociationWidget in case of ItemPositionChange
event in UMLWidget::itemChange.
M +15 -0 umlwidget.cpp
--- branches/work/soc-umbrello/umbrello/widgets/umlwidget.cpp #983873:983874
@@ -379,6 +379,7 @@
QVariant UMLWidget::itemChange(GraphicsItemChange change, const QVariant &value)
{
if(change == QGraphicsItem::ItemSelectedHasChanged) {
+ // create/delete widget handle on selection change
bool selection = value.toBool();
if(selection) {
if(!m_widgetHandle) {
@@ -389,7 +390,21 @@
delete m_widgetHandle;
m_widgetHandle = 0;
}
+ } else if (change == QGraphicsItem::ItemPositionChange) {
+ // move all points of self associations before this widget is moved.
+ // normal adjusting is not enough for self association updation.
+ QPointF diff(value.toPointF() - pos());
+ foreach (New::AssociationWidget* assoc,
+ m_associationSpaceManager->associationWidgets()) {
+ if (assoc->isSelf()) {
+ New::AssociationLine *line = assoc->associationLine();
+ for (int i = 0; i < line->count(); ++i) {
+ line->setPoint(i, line->point(i) + diff);
+ }
+ }
+ }
} else if (change == QGraphicsItem::ItemPositionHasChanged) {
+ // adjust the association lines by new computations.
adjustAssociations();
}
return WidgetBase::itemChange(change, value);
More information about the umbrello-devel
mailing list