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

Finish ignore_priner_rect

This commit is contained in:
Arin Alexander 2019-02-02 16:36:07 +03:00
commit d32b42d933

View File

@ -322,14 +322,14 @@ void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer)
renderPage.pageItem()->rightMargin(), renderPage.pageItem()->rightMargin(),
renderPage.pageItem()->bottomMargin(), renderPage.pageItem()->bottomMargin(),
QPrinter::Millimeter); QPrinter::Millimeter);
printer.setOrientation((QPrinter::Orientation)renderPage.pageItem()->pageOrientation()); printer.setOrientation(static_cast<QPrinter::Orientation>(renderPage.pageItem()->pageOrientation()));
QSizeF pageSize = (renderPage.pageItem()->pageOrientation()==PageItemDesignIntf::Landscape)? QSizeF pageSize = (renderPage.pageItem()->pageOrientation()==PageItemDesignIntf::Landscape)?
QSizeF(renderPage.pageItem()->sizeMM().height(),renderPage.pageItem()->sizeMM().width()): QSizeF(renderPage.pageItem()->sizeMM().height(),renderPage.pageItem()->sizeMM().width()):
renderPage.pageItem()->sizeMM(); renderPage.pageItem()->sizeMM();
printer.setPaperSize(pageSize,QPrinter::Millimeter); printer.setPaperSize(pageSize,QPrinter::Millimeter);
} else { } else {
printer.setFullPage(renderPage.pageItem()->fullPage()); printer.setFullPage(renderPage.pageItem()->fullPage());
printer.setOrientation((QPrinter::Orientation)renderPage.pageItem()->pageOrientation()); printer.setOrientation(static_cast<QPrinter::Orientation>(renderPage.pageItem()->pageOrientation()));
if (renderPage.pageItem()->pageSize()==PageItemDesignIntf::Custom){ if (renderPage.pageItem()->pageSize()==PageItemDesignIntf::Custom){
QSizeF pageSize = (renderPage.pageItem()->pageOrientation()==PageItemDesignIntf::Landscape)? QSizeF pageSize = (renderPage.pageItem()->pageOrientation()==PageItemDesignIntf::Landscape)?
QSizeF(renderPage.pageItem()->sizeMM().height(),renderPage.pageItem()->sizeMM().width()): QSizeF(renderPage.pageItem()->sizeMM().height(),renderPage.pageItem()->sizeMM().width()):
@ -338,7 +338,7 @@ void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer)
printer.setPaperSize(pageSize,QPrinter::Millimeter); printer.setPaperSize(pageSize,QPrinter::Millimeter);
} else { } else {
if (page->getSetPageSizeToPrinter() || printer.outputFormat() == QPrinter::PdfFormat) if (page->getSetPageSizeToPrinter() || printer.outputFormat() == QPrinter::PdfFormat)
printer.setPaperSize((QPrinter::PageSize)renderPage.pageItem()->pageSize()); printer.setPaperSize(static_cast<QPrinter::PageSize>(renderPage.pageItem()->pageSize()));
} }
} }
@ -347,13 +347,19 @@ void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer)
} else { } else {
isFirst=false; isFirst=false;
painter = new QPainter(&printer); painter = new QPainter(&printer);
if (!painter->isActive()){
delete painter;
return;
}
} }
QRectF printerPageRect = printer.pageRect(QPrinter::Millimeter); QRectF printerPageRect = printer.pageRect(QPrinter::Millimeter);
printerPageRect = QRectF(0,0,(printerPageRect.size().width() + rightMargin + leftMargin) * Const::mmFACTOR, printerPageRect = QRectF(0,0,(printerPageRect.size().width() + rightMargin + leftMargin) * Const::mmFACTOR,
(printerPageRect.size().height() + bottomMargin +topMargin) * Const::mmFACTOR); (printerPageRect.size().height() + bottomMargin +topMargin) * Const::mmFACTOR);
if (printerPageRect.width() < page->geometry().width()){ if (printer.pageSize() != static_cast<QPrinter::PageSize>(page->pageSize()) &&
printerPageRect.width() < page->geometry().width())
{
qreal pageWidth = page->geometry().width(); qreal pageWidth = page->geometry().width();
QRectF currentPrintingRect = printerPageRect; QRectF currentPrintingRect = printerPageRect;
while (pageWidth>0){ while (pageWidth>0){