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) :
|
PageItemDesignIntf::PageItemDesignIntf(QObject *owner, QGraphicsItem *parent) :
|
||||||
BaseDesignIntf("PageItem",owner,parent),
|
BaseDesignIntf("PageItem",owner,parent),
|
||||||
m_topMargin(0), m_bottomMargin(0), m_leftMargin(0), m_rightMargin(0),
|
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);
|
setFixedPos(true);
|
||||||
setPosibleResizeDirectionFlags(Fixed);
|
setPosibleResizeDirectionFlags(Fixed);
|
||||||
@ -57,7 +58,8 @@ PageItemDesignIntf::PageItemDesignIntf(QObject *owner, QGraphicsItem *parent) :
|
|||||||
PageItemDesignIntf::PageItemDesignIntf(const PageSize pageSize, const QRectF &rect, QObject *owner, QGraphicsItem *parent) :
|
PageItemDesignIntf::PageItemDesignIntf(const PageSize pageSize, const QRectF &rect, QObject *owner, QGraphicsItem *parent) :
|
||||||
BaseDesignIntf("PageItem",owner,parent),
|
BaseDesignIntf("PageItem",owner,parent),
|
||||||
m_topMargin(0), m_bottomMargin(0), m_leftMargin(0), m_rightMargin(0),
|
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);
|
setFixedPos(true);
|
||||||
setPosibleResizeDirectionFlags(Fixed);
|
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
|
bool PageItemDesignIntf::fullPage() const
|
||||||
{
|
{
|
||||||
return m_fullPage;
|
return m_fullPage;
|
||||||
@ -324,7 +336,7 @@ void PageItemDesignIntf::relocateBands()
|
|||||||
qSort(m_bands.begin(),m_bands.end(),bandSortBandLessThenByIndex);
|
qSort(m_bands.begin(),m_bands.end(),bandSortBandLessThenByIndex);
|
||||||
|
|
||||||
if (m_bands.count()>0) {
|
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());
|
m_bands[0]->setPos(pageRect().x(),pageRect().y());
|
||||||
posByColumn[0]+=m_bands[0]->height()+bandSpace;
|
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(PageSize pageSize READ pageSize WRITE setPageSize )
|
||||||
Q_PROPERTY(int gridStep READ gridStep WRITE setGridStep)
|
Q_PROPERTY(int gridStep READ gridStep WRITE setGridStep)
|
||||||
Q_PROPERTY(bool fullPage READ fullPage WRITE setFullPage)
|
Q_PROPERTY(bool fullPage READ fullPage WRITE setFullPage)
|
||||||
|
Q_PROPERTY(bool oldPrintMode READ oldPrintMode WRITE setOldPrintMode)
|
||||||
friend class ReportRender;
|
friend class ReportRender;
|
||||||
public:
|
public:
|
||||||
enum Orientation { Portrait, Landscape };
|
enum Orientation { Portrait, Landscape };
|
||||||
@ -108,6 +109,9 @@ public:
|
|||||||
bool fullPage() const;
|
bool fullPage() const;
|
||||||
void setFullPage(bool fullPage);
|
void setFullPage(bool fullPage);
|
||||||
|
|
||||||
|
bool oldPrintMode() const;
|
||||||
|
void setOldPrintMode(bool oldPrintMode);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void bandDeleted(QObject* band);
|
void bandDeleted(QObject* band);
|
||||||
void bandGeometryChanged(QObject* /*object*/, QRectF newGeometry, QRectF oldGeometry);
|
void bandGeometryChanged(QObject* /*object*/, QRectF newGeometry, QRectF oldGeometry);
|
||||||
@ -133,6 +137,7 @@ private:
|
|||||||
bool m_sizeChainging;
|
bool m_sizeChainging;
|
||||||
QList<BandDesignIntf*> m_bands;
|
QList<BandDesignIntf*> m_bands;
|
||||||
bool m_fullPage;
|
bool m_fullPage;
|
||||||
|
bool m_oldPrintMode;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // LRPAGEITEM_H
|
#endif // LRPAGEITEM_H
|
||||||
|
@ -175,7 +175,6 @@ void ReportEnginePrivate::printReport(ItemsReaderIntf::Ptr reader, QPrinter& pri
|
|||||||
}
|
}
|
||||||
|
|
||||||
QPainter painter(&printer);
|
QPainter painter(&printer);
|
||||||
painter.drawRect(printer.pageRect());
|
|
||||||
renderPage.render(&painter);
|
renderPage.render(&painter);
|
||||||
|
|
||||||
while (reader->next()){
|
while (reader->next()){
|
||||||
@ -211,15 +210,28 @@ void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer, cons
|
|||||||
page->setPos(0,0);
|
page->setPos(0,0);
|
||||||
renderPage.setPageItem(page);
|
renderPage.setPageItem(page);
|
||||||
renderPage.setSceneRect(renderPage.pageItem()->mapToScene(renderPage.pageItem()->rect()).boundingRect());
|
renderPage.setSceneRect(renderPage.pageItem()->mapToScene(renderPage.pageItem()->rect()).boundingRect());
|
||||||
printer.setFullPage(renderPage.pageItem()->fullPage());
|
if (renderPage.pageItem()->oldPrintMode()){
|
||||||
printer.setOrientation((QPrinter::Orientation)renderPage.pageItem()->pageOrientation());
|
printer.setPageMargins(renderPage.pageItem()->leftMargin(),
|
||||||
if (renderPage.pageItem()->pageSize()==PageItemDesignIntf::Custom){
|
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 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.setPaperSize((QPrinter::PageSize)renderPage.pageItem()->pageSize());
|
printer.setFullPage(renderPage.pageItem()->fullPage());
|
||||||
|
printer.setOrientation((QPrinter::Orientation)renderPage.pageItem()->pageOrientation());
|
||||||
|
if (renderPage.pageItem()->pageSize()==PageItemDesignIntf::Custom){
|
||||||
|
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.setPaperSize((QPrinter::PageSize)renderPage.pageItem()->pageSize());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isFirst){
|
if (!isFirst){
|
||||||
|
Loading…
Reference in New Issue
Block a user