mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-25 00:54:39 +03:00
Print process has been fixed
This commit is contained in:
parent
e87b78030e
commit
b839694e59
@ -1531,25 +1531,28 @@ ScriptEngineManager*LimeReport::ReportEnginePrivate::scriptManager(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
PrintProcessor::PrintProcessor(QPrinter* printer)
|
PrintProcessor::PrintProcessor(QPrinter* printer)
|
||||||
: m_printer(printer), m_painter(new QPainter(m_printer)), m_firstPage(true)
|
: m_printer(printer), m_painter(0), m_firstPage(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
bool PrintProcessor::printPage(PageItemDesignIntf::Ptr page)
|
bool PrintProcessor::printPage(PageItemDesignIntf::Ptr page)
|
||||||
{
|
{
|
||||||
if (m_painter && !m_painter->isActive()) return false;
|
if (!m_firstPage && !m_painter->isActive()) return false;
|
||||||
|
|
||||||
LimeReport::PageDesignIntf renderPage;
|
LimeReport::PageDesignIntf renderPage;
|
||||||
renderPage.setPageItem(page);
|
|
||||||
renderPage.setItemMode(PrintMode);
|
renderPage.setItemMode(PrintMode);
|
||||||
initPrinter(renderPage.pageItem());
|
|
||||||
|
|
||||||
QPointF backupPagePos = page->pos();
|
QPointF backupPagePos = page->pos();
|
||||||
page->setPos(0,0);
|
page->setPos(0,0);
|
||||||
|
renderPage.setPageItem(page);
|
||||||
renderPage.setSceneRect(renderPage.pageItem()->mapToScene(renderPage.pageItem()->rect()).boundingRect());
|
renderPage.setSceneRect(renderPage.pageItem()->mapToScene(renderPage.pageItem()->rect()).boundingRect());
|
||||||
|
initPrinter(renderPage.pageItem());
|
||||||
|
|
||||||
if (!m_firstPage){
|
if (!m_firstPage){
|
||||||
m_printer->newPage();
|
m_printer->newPage();
|
||||||
} else {
|
} else {
|
||||||
|
m_painter = new QPainter(m_printer);
|
||||||
|
if (!m_painter->isActive()) return false;
|
||||||
m_firstPage = false;
|
m_firstPage = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user