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

In AssociationWidget::widgetMoved() fix endless loop

The loop has been caused by UMLWidget::updateGeometry() updating related
associations too.

Fixup of commit d5cb5adb.

CCBUG:403761
parent 96d20006
......@@ -1966,8 +1966,8 @@ void AssociationWidget::widgetMoved(UMLWidget* widget, qreal dx, qreal dy)
//only calculate position and move text if the segment it is on is moving
setTextPositionRelatively(TextRole::Name, m_oldNamePoint);
}
if (m_role[RoleType::B].umlWidget->changesShape())
m_role[RoleType::B].umlWidget->updateGeometry();
if (m_role[RoleType::B].umlWidget && m_role[RoleType::B].umlWidget->changesShape())
m_role[RoleType::B].umlWidget->updateGeometry(false);
}//end if widgetA moved
else if (m_role[RoleType::B].umlWidget == widget) {
const int size = m_associationLine->count();
......@@ -1975,8 +1975,8 @@ void AssociationWidget::widgetMoved(UMLWidget* widget, qreal dx, qreal dy)
//only calculate position and move text if the segment it is on is moving
setTextPositionRelatively(TextRole::Name, m_oldNamePoint);
}
if (m_role[RoleType::A].umlWidget->changesShape())
m_role[RoleType::A].umlWidget->updateGeometry();
if (m_role[RoleType::A].umlWidget && m_role[RoleType::A].umlWidget->changesShape())
m_role[RoleType::A].umlWidget->updateGeometry(false);
}//end if widgetB moved
if (m_role[RoleType::A].roleWidget && !m_role[RoleType::A].roleWidget->isSelected()) {
......
......@@ -1669,8 +1669,10 @@ void UMLWidget::setSize(const QSizeF& size)
/**
* Update the size of this widget.
*
* @param withAssocs true - update associations too
*/
void UMLWidget::updateGeometry()
void UMLWidget::updateGeometry(bool withAssocs)
{
if (m_doc->loading()) {
return;
......@@ -1685,7 +1687,8 @@ void UMLWidget::updateGeometry()
constrain(clipWidth, clipHeight);
setSize(clipWidth, clipHeight);
slotSnapToGrid();
adjustAssocs(size.width()-oldW, size.height()-oldH);
if (withAssocs)
adjustAssocs(size.width()-oldW, size.height()-oldH);
update();
}
......
......@@ -184,7 +184,7 @@ public:
static bool widgetHasUMLObject(WidgetBase::WidgetType type);
void updateGeometry();
void updateGeometry(bool withAssocs = true);
void clipSize();
......
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