Commit a7d6f7dc authored by Ralf Habacker's avatar Ralf Habacker
Browse files

Fix 'Associations connected to the component port do not move when moving the component'

The ComponentWidget class requires an implementation of
adjustUnselectedAssocs() to update the associations attached to the ports.
To do this, UMLWidget::adjustUnselectedAssocs() must be converted to a
virtual method.

BUG:403692
FIXED-IN:2.27.2 (KDE Applications 18.12.2)
parent 40c90537
......@@ -157,6 +157,28 @@ void ComponentWidget::adjustAssocs(qreal dx, qreal dy)
}
}
/**
* Override method from UMLWidget for adjustment of attached PortWidgets.
*/
void ComponentWidget::adjustUnselectedAssocs(qreal dx, qreal dy)
{
if (m_doc->loading()) {
// don't recalculate the assocs during load of XMI
// -> return immediately without action
return;
}
UMLWidget::adjustUnselectedAssocs(dx, dy);
UMLPackage *comp = m_umlObject->asUMLPackage();
foreach (UMLObject *o, comp->containedObjects()) {
uIgnoreZeroPointer(o);
if (o->baseType() != UMLObject::ot_Port)
continue;
UMLWidget *portW = m_scene->widgetOnDiagram(o->id());
if (portW)
portW->adjustUnselectedAssocs(dx, dy);
}
}
/**
* Saves to the "componentwidget" XMI element.
*/
......
......@@ -36,6 +36,7 @@ public:
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
virtual void moveWidgetBy(qreal diffX, qreal diffY);
virtual void adjustAssocs(qreal dx, qreal dy);
virtual void adjustUnselectedAssocs(qreal dx, qreal dy);
virtual void saveToXMI1(QDomDocument& qDoc, QDomElement& qElement);
......
......@@ -175,7 +175,7 @@ public:
virtual bool showPropertiesDialog();
virtual void adjustAssocs(qreal dx, qreal dy);
void adjustUnselectedAssocs(qreal dx, qreal dy);
virtual void adjustUnselectedAssocs(qreal dx, qreal dy);
bool isActivated() const;
void setActivated(bool active = true);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment