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

Fix of 'No undo support for applying layouts'.

CCBUG: 336709
parent bf2958d7
......@@ -12,13 +12,16 @@
#include "associationline.h"
#include "associationwidget.h"
#include "cmds.h"
#include "debug_utils.h"
#include "floatingtextwidget.h"
#include "uml.h"
#include "umlwidget.h"
// app includes
// kde includes
#include <KConfigGroup>
#include <KDesktopFile>
#include <KLocale>
#include <KStandardDirs>
// qt includes
......@@ -245,15 +248,21 @@ bool LayoutGenerator::apply(UMLScene *scene)
*/
}
UMLApp::app()->beginMacro(i18n("Apply layout"));
foreach(UMLWidget *widget, scene->widgetList()) {
QString id = Uml::ID::toString(widget->localID());
if (!m_nodes.contains(id))
continue;
QPoint p = origin(id);
widget->setStartMovePosition(widget->pos());
widget->setX(p.x());
widget->setY(p.y()-widget->height());
widget->adjustAssocs(widget->x(), widget->y()); // adjust assoc lines
UMLApp::app()->executeCommand(new Uml::CmdMoveWidget(widget));
}
UMLApp::app()->endMacro();
foreach(AssociationWidget *assoc, scene->associationList()) {
assoc->calculateEndingPoints();
......
......@@ -610,6 +610,15 @@ QPointF UMLWidget::startMovePosition() const
return m_startMovePostion;
}
/**
* Set the start position of the move action.
* @param position point where the move began
*/
void UMLWidget::setStartMovePosition(const QPointF &position)
{
m_startMovePostion = position;
}
/**
* Return the start size of the resize action.
* @return size where the resize began
......
......@@ -200,6 +200,8 @@ public:
virtual void saveToXMI(QDomDocument &qDoc, QDomElement &qElement);
QPointF startMovePosition() const;
void setStartMovePosition(const QPointF &position);
QSizeF startResizeSize() const;
virtual QSizeF calculateSize();
......
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