0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-10-08 21:53:14 +03:00

Reassign children from child layout to parent layout

This commit is contained in:
Emil Sawicki
2022-01-31 19:47:03 +01:00
parent d081955bc3
commit ee07abb6c5
5 changed files with 46 additions and 23 deletions

View File

@@ -554,17 +554,16 @@ CommandIf::Ptr PageDesignIntf::removeReportItemCommand(BaseDesignIntf *item){
CommandIf::Ptr command = createBandDeleteCommand(this,band);
return command;
} else {
LayoutDesignIntf* layout = dynamic_cast<LayoutDesignIntf*>(item->parent());
if (layout && (layout->childrenCount()==2)){
LayoutDesignIntf* parentLayout = dynamic_cast<LayoutDesignIntf*>(item->parent());
LayoutDesignIntf* layout = dynamic_cast<LayoutDesignIntf*>(item);
// When removing layout child all his children will be assigned to parent
if (!layout && parentLayout && (parentLayout->childrenCount() == 2)) {
CommandGroup::Ptr commandGroup = CommandGroup::create();
commandGroup->addCommand(DeleteLayoutCommand::create(this, layout),false);
commandGroup->addCommand(DeleteLayoutCommand::create(this, parentLayout),false);
commandGroup->addCommand(DeleteItemCommand::create(this,item),false);
return commandGroup;
} else {
CommandIf::Ptr command = (dynamic_cast<LayoutDesignIntf*>(item))?
DeleteLayoutCommand::create(this, dynamic_cast<LayoutDesignIntf*>(item)) :
DeleteItemCommand::create(this, item) ;
return command;
return layout ? DeleteLayoutCommand::create(this, layout) : DeleteItemCommand::create(this, item) ;
}
}
}