0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-25 00:54:39 +03:00

TextItem placement on a page has been fixed

This commit is contained in:
Arin Alexander 2019-02-21 22:44:43 +03:00
parent b74a72531c
commit 78cac1126c
2 changed files with 20 additions and 13 deletions

View File

@ -66,6 +66,7 @@ void ItemDesignIntf::setItemLocation(LocationType location)
} else { } else {
if (scene()){ if (scene()){
PageItemDesignIntf* page = dynamic_cast<PageDesignIntf*>(scene())->pageItem(); PageItemDesignIntf* page = dynamic_cast<PageDesignIntf*>(scene())->pageItem();
if (page){
QPointF parentPos = page->mapFromItem(parentItem(),x(),y()); QPointF parentPos = page->mapFromItem(parentItem(),x(),y());
setParentItem(page); setParentItem(page);
setParent(page); setParent(page);
@ -73,6 +74,7 @@ void ItemDesignIntf::setItemLocation(LocationType location)
emit itemLocationChanged(this, page); emit itemLocationChanged(this, page);
} }
} }
}
notify("locationType",oldValue,location); notify("locationType",oldValue,location);
} }
} }

View File

@ -491,14 +491,17 @@ BaseDesignIntf *PageDesignIntf::addReportItem(const QString &itemType, QPointF p
reportItem->setSize(placeSizeOnGrid(size)); reportItem->setSize(placeSizeOnGrid(size));
return reportItem; return reportItem;
} else { } else {
BaseDesignIntf *reportItem = addReportItem(itemType, pageItem(), pageItem()); PageItemDesignIntf* page = pageItem() ? pageItem() : m_currentPage;
reportItem->setPos(placePosOnGrid(pageItem()->mapFromScene(pos))); if (page){
BaseDesignIntf *reportItem = addReportItem(itemType, page, page);
reportItem->setPos(placePosOnGrid(page->mapFromScene(pos)));
reportItem->setSize(placeSizeOnGrid(size)); reportItem->setSize(placeSizeOnGrid(size));
ItemDesignIntf* ii = dynamic_cast<ItemDesignIntf*>(reportItem); ItemDesignIntf* ii = dynamic_cast<ItemDesignIntf*>(reportItem);
if (ii) if (ii)
ii->setItemLocation(ItemDesignIntf::Page); ii->setItemLocation(ItemDesignIntf::Page);
return reportItem; return reportItem;
} }
}
return 0; return 0;
} }
@ -1066,7 +1069,9 @@ PageItemDesignIntf* PageDesignIntf::getCurrentPage() const
void PageDesignIntf::setCurrentPage(PageItemDesignIntf* currentPage) void PageDesignIntf::setCurrentPage(PageItemDesignIntf* currentPage)
{ {
if (m_currentPage != currentPage ){
m_currentPage = currentPage; m_currentPage = currentPage;
}
} }
ReportSettings *PageDesignIntf::getReportSettings() const ReportSettings *PageDesignIntf::getReportSettings() const