[Uml-devel] kdesdk/umbrello/umbrello
Sebastian Stein
seb.kde at hpfsc.de
Wed Jul 21 08:22:03 UTC 2004
CVS commit by sstein:
patch by Achim Spangler:
the XMI load of message widgets is currently quite broken in CVS
The reason was a wrong logical combination in UMLView:
WAS:
- if(!m_pDoc->loading() && !obj->activate(m_pDoc->getChangeLog()))
+{
SHOULD BE:
+ if(!m_pDoc->loading() || !obj->activate(m_pDoc->getChangeLog()))
+{
==>
The MessageWidget activation call was never performed during load of XMI.
==>
The lifeline of the objects weren't adopted to the message widget position AND
by the missing signal connection, each TRY to move a loaded message widget
caused a flip to the left margin of the QCanvas.
As the debug message of UMLWidget::adjustAssocs() was then activa again, I
used the KDebug function: KGlobal::kdBacktrace () from kdebug.h to get the
call stack for this unwanted call.
==>
The activate() method of MessageWidget called calculateDimensions(), which
then causes the call of UMLWidget::adjustAssocs(). As this calculation is
only needed for a new MessageWidget - and not during load - this call should
be made dependend on NotLoadingState.
With the attached diff, this call is performed only for new instances.
M +8 -1 messagewidget.cpp 1.41
M +1 -1 umlview.cpp 1.161
M +2 -0 umlwidget.cpp 1.91
--- kdesdk/umbrello/umbrello/umlwidget.cpp #1.90:1.91
@@ -750,6 +750,8 @@ void UMLWidget::adjustAssocs(int x, int
// don't recalculate the assocs during load of XMI
// -> return immediately without action
+ QString trace = kdBacktrace();
kdDebug() << "UMLWidget::adjustAssocs() called during load of XMI for ViewType: " << m_pView -> getType()
<< ", and BaseType: " << getBaseType()
+ << ",\nwith Backtrace: " << trace
<< endl;
return;
--- kdesdk/umbrello/umbrello/umlview.cpp #1.160:1.161
@@ -1515,5 +1515,5 @@ bool UMLView::activate() {
continue;
- if(!m_pDoc->loading() && !obj->activate(m_pDoc->getChangeLog())) {
+ if(!m_pDoc->loading() || !obj->activate(m_pDoc->getChangeLog())) {
kdDebug() << "Couldn't activate message widget" << endl;
continue;
--- kdesdk/umbrello/umbrello/messagewidget.cpp #1.40:1.41
@@ -328,5 +328,12 @@ bool MessageWidget::activate(IDChangeLog
connect(m_pOw[A], SIGNAL(sigWidgetMoved(int)), this, SLOT(slotWidgetMoved(int)));
connect(m_pOw[B], SIGNAL(sigWidgetMoved(int)), this, SLOT(slotWidgetMoved(int)));
+ if ( ! m_pView->getDocument()->loading() )
+ { // calculate the dimensions only if no XMI file is loaded
+ // - this functions derives the dimension properties of this widget ( as said by the
+ // function
+ // - thus it calls also the UMLWidget::adjustAssocs() function - which is bad
+ // Despite in case of a _NEW_ message widget, this calculation is important
calculateDimensions();
+ }
connect(this, SIGNAL(sigMessageMoved()), m_pOw[A], SLOT(slotMessageMoved()) );
More information about the umbrello-devel
mailing list