PageItem cutting and deleting has been forbidden

This commit is contained in:
Arin Alexander 2016-05-30 21:32:55 +04:00
parent de6ce6741f
commit be63934c32

View File

@ -1224,12 +1224,12 @@ void PageDesignIntf::paste()
void PageDesignIntf::deleteSelected()
{
if (selectedItems().count()==1){
saveCommand(removeReportItemCommand(dynamic_cast<BaseDesignIntf*>(selectedItems().at(0))));
if (!dynamic_cast<PageItemDesignIntf*>(selectedItems().at(0)))
saveCommand(removeReportItemCommand(dynamic_cast<BaseDesignIntf*>(selectedItems().at(0))));
} else {
QList<QGraphicsItem*> itemsToDelete = selectedItems();
CommandGroup::Ptr commandGroup = CommandGroup::create();
QList<BandDesignIntf*> bands;
@ -1270,7 +1270,7 @@ void PageDesignIntf::deleteSelected()
}
void PageDesignIntf::cut()
{
{
CommandIf::Ptr command = CutCommand::create(this);
saveCommand(command);
}
@ -1797,11 +1797,13 @@ CommandIf::Ptr CutCommand::create(PageDesignIntf *page)
command->setPage(page);
ItemsWriterIntf *writer = new XMLWriter();
foreach(QGraphicsItem * item, page->selectedItems()) {
BaseDesignIntf *reportItem = dynamic_cast<BaseDesignIntf *>(item);
if (reportItem) {
command->m_itemNames.push_back(reportItem->objectName());
writer->putItem(reportItem);
if (!dynamic_cast<PageItemDesignIntf*>(item)){
BaseDesignIntf *reportItem = dynamic_cast<BaseDesignIntf *>(item);
if (reportItem) {
command->m_itemNames.push_back(reportItem->objectName());
writer->putItem(reportItem);
}
}
}
command->setXML(writer->saveToString());