mirror of
https://github.com/fralx/LimeReport.git
synced 2025-01-11 17:18:10 +03:00
oldPrintMode property has been added for previous versions compatibility
This commit is contained in:
parent
2132bc9e34
commit
8d3dd7c09b
@ -47,7 +47,8 @@ bool bandSortBandLessThenByIndex(const BandDesignIntf *c1, const BandDesignIntf
|
||||
PageItemDesignIntf::PageItemDesignIntf(QObject *owner, QGraphicsItem *parent) :
|
||||
BaseDesignIntf("PageItem",owner,parent),
|
||||
m_topMargin(0), m_bottomMargin(0), m_leftMargin(0), m_rightMargin(0),
|
||||
m_pageOrientaion(Portrait), m_pageSize(A4), m_sizeChainging(false), m_fullPage(false)
|
||||
m_pageOrientaion(Portrait), m_pageSize(A4), m_sizeChainging(false),
|
||||
m_fullPage(false), m_oldPrintMode(false)
|
||||
{
|
||||
setFixedPos(true);
|
||||
setPosibleResizeDirectionFlags(Fixed);
|
||||
@ -57,7 +58,8 @@ PageItemDesignIntf::PageItemDesignIntf(QObject *owner, QGraphicsItem *parent) :
|
||||
PageItemDesignIntf::PageItemDesignIntf(const PageSize pageSize, const QRectF &rect, QObject *owner, QGraphicsItem *parent) :
|
||||
BaseDesignIntf("PageItem",owner,parent),
|
||||
m_topMargin(0), m_bottomMargin(0), m_leftMargin(0), m_rightMargin(0),
|
||||
m_pageOrientaion(Portrait), m_pageSize(pageSize), m_sizeChainging(false), m_fullPage(false)
|
||||
m_pageOrientaion(Portrait), m_pageSize(pageSize), m_sizeChainging(false),
|
||||
m_fullPage(false), m_oldPrintMode(false)
|
||||
{
|
||||
setFixedPos(true);
|
||||
setPosibleResizeDirectionFlags(Fixed);
|
||||
@ -297,6 +299,16 @@ void PageItemDesignIntf::initColumnsPos(QVector<qreal> &posByColumns, qreal pos,
|
||||
}
|
||||
}
|
||||
|
||||
bool PageItemDesignIntf::oldPrintMode() const
|
||||
{
|
||||
return m_oldPrintMode;
|
||||
}
|
||||
|
||||
void PageItemDesignIntf::setOldPrintMode(bool oldPrintMode)
|
||||
{
|
||||
m_oldPrintMode = oldPrintMode;
|
||||
}
|
||||
|
||||
bool PageItemDesignIntf::fullPage() const
|
||||
{
|
||||
return m_fullPage;
|
||||
@ -324,7 +336,7 @@ void PageItemDesignIntf::relocateBands()
|
||||
qSort(m_bands.begin(),m_bands.end(),bandSortBandLessThenByIndex);
|
||||
|
||||
if (m_bands.count()>0) {
|
||||
initColumnsPos(posByColumn,pageRect().x(),m_bands[0]->columnsCount());
|
||||
initColumnsPos(posByColumn,pageRect().y(),m_bands[0]->columnsCount());
|
||||
m_bands[0]->setPos(pageRect().x(),pageRect().y());
|
||||
posByColumn[0]+=m_bands[0]->height()+bandSpace;
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ class PageItemDesignIntf : public LimeReport::BaseDesignIntf
|
||||
Q_PROPERTY(PageSize pageSize READ pageSize WRITE setPageSize )
|
||||
Q_PROPERTY(int gridStep READ gridStep WRITE setGridStep)
|
||||
Q_PROPERTY(bool fullPage READ fullPage WRITE setFullPage)
|
||||
Q_PROPERTY(bool oldPrintMode READ oldPrintMode WRITE setOldPrintMode)
|
||||
friend class ReportRender;
|
||||
public:
|
||||
enum Orientation { Portrait, Landscape };
|
||||
@ -108,6 +109,9 @@ public:
|
||||
bool fullPage() const;
|
||||
void setFullPage(bool fullPage);
|
||||
|
||||
bool oldPrintMode() const;
|
||||
void setOldPrintMode(bool oldPrintMode);
|
||||
|
||||
protected slots:
|
||||
void bandDeleted(QObject* band);
|
||||
void bandGeometryChanged(QObject* /*object*/, QRectF newGeometry, QRectF oldGeometry);
|
||||
@ -133,6 +137,7 @@ private:
|
||||
bool m_sizeChainging;
|
||||
QList<BandDesignIntf*> m_bands;
|
||||
bool m_fullPage;
|
||||
bool m_oldPrintMode;
|
||||
};
|
||||
}
|
||||
#endif // LRPAGEITEM_H
|
||||
|
@ -175,7 +175,6 @@ void ReportEnginePrivate::printReport(ItemsReaderIntf::Ptr reader, QPrinter& pri
|
||||
}
|
||||
|
||||
QPainter painter(&printer);
|
||||
painter.drawRect(printer.pageRect());
|
||||
renderPage.render(&painter);
|
||||
|
||||
while (reader->next()){
|
||||
@ -211,6 +210,18 @@ void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer, cons
|
||||
page->setPos(0,0);
|
||||
renderPage.setPageItem(page);
|
||||
renderPage.setSceneRect(renderPage.pageItem()->mapToScene(renderPage.pageItem()->rect()).boundingRect());
|
||||
if (renderPage.pageItem()->oldPrintMode()){
|
||||
printer.setPageMargins(renderPage.pageItem()->leftMargin(),
|
||||
renderPage.pageItem()->topMargin(),
|
||||
renderPage.pageItem()->rightMargin(),
|
||||
renderPage.pageItem()->bottomMargin(),
|
||||
QPrinter::Millimeter);
|
||||
printer.setOrientation((QPrinter::Orientation)renderPage.pageItem()->pageOrientation());
|
||||
QSizeF pageSize = (renderPage.pageItem()->pageOrientation()==PageItemDesignIntf::Landscape)?
|
||||
QSizeF(renderPage.pageItem()->sizeMM().height(),renderPage.pageItem()->sizeMM().width()):
|
||||
renderPage.pageItem()->sizeMM();
|
||||
printer.setPaperSize(pageSize,QPrinter::Millimeter);
|
||||
} else {
|
||||
printer.setFullPage(renderPage.pageItem()->fullPage());
|
||||
printer.setOrientation((QPrinter::Orientation)renderPage.pageItem()->pageOrientation());
|
||||
if (renderPage.pageItem()->pageSize()==PageItemDesignIntf::Custom){
|
||||
@ -221,6 +232,7 @@ void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer, cons
|
||||
} else {
|
||||
printer.setPaperSize((QPrinter::PageSize)renderPage.pageItem()->pageSize());
|
||||
}
|
||||
}
|
||||
|
||||
if (!isFirst){
|
||||
printer.newPage();
|
||||
|
Loading…
Reference in New Issue
Block a user