0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-10-01 19:51:30 +03:00

Layout undo has been fixed

This commit is contained in:
Arin Alex
2024-07-25 18:32:30 +03:00
parent f3d2efe8ca
commit 9de9cc3ebf
8 changed files with 32 additions and 33 deletions

View File

@@ -48,7 +48,7 @@ void AbstractLayout::setLayoutType(const LayoutType& layoutType)
void AbstractLayout::addChild(BaseDesignIntf* item, bool updateSize)
{
placeItemInLayout(item);
if (updateSize) placeItemInLayout(item);
m_children.append(item);
item->setParentItem(this);
@@ -321,6 +321,19 @@ BaseDesignIntf *AbstractLayout::findPrior(BaseDesignIntf *item)
return 0;
}
void AbstractLayout::insertItemInLayout(BaseDesignIntf *item){
bool inserted = false;
for (int i=0; i<layoutsChildren().length(); ++i){
BaseDesignIntf* child = layoutsChildren()[i];
if (child->pos() == item->pos()){
layoutsChildren().insert(i, item);
inserted = true;
break;
}
}
if (!inserted) layoutsChildren().append(item);
}
void AbstractLayout::slotOnChildDestroy(QObject* child)
{
m_children.removeAll(static_cast<BaseDesignIntf*>(child));