mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-24 16:44:39 +03:00
FullPage property has been added
This commit is contained in:
parent
b770669b64
commit
34e114d7a4
@ -47,7 +47,7 @@ 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_pageOrientaion(Portrait), m_pageSize(A4), m_sizeChainging(false), m_fullPage(false)
|
||||||
{
|
{
|
||||||
setFixedPos(true);
|
setFixedPos(true);
|
||||||
setPosibleResizeDirectionFlags(Fixed);
|
setPosibleResizeDirectionFlags(Fixed);
|
||||||
@ -57,7 +57,7 @@ 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_pageOrientaion(Portrait), m_pageSize(pageSize), m_sizeChainging(false), m_fullPage(false)
|
||||||
{
|
{
|
||||||
setFixedPos(true);
|
setFixedPos(true);
|
||||||
setPosibleResizeDirectionFlags(Fixed);
|
setPosibleResizeDirectionFlags(Fixed);
|
||||||
@ -297,6 +297,22 @@ void PageItemDesignIntf::initColumnsPos(QVector<qreal> &posByColumns, qreal pos,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PageItemDesignIntf::fullPage() const
|
||||||
|
{
|
||||||
|
return m_fullPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PageItemDesignIntf::setFullPage(bool fullPage)
|
||||||
|
{
|
||||||
|
if (m_fullPage != fullPage){
|
||||||
|
m_fullPage = fullPage;
|
||||||
|
if (!isLoading()){
|
||||||
|
updateMarginRect();
|
||||||
|
notify("fullPage", !m_fullPage, m_fullPage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PageItemDesignIntf::relocateBands()
|
void PageItemDesignIntf::relocateBands()
|
||||||
{
|
{
|
||||||
if (isLoading()) return;
|
if (isLoading()) return;
|
||||||
@ -444,8 +460,8 @@ QSizeF PageItemDesignIntf::getRectByPageSize(const PageSize& size)
|
|||||||
QPrinter printer;
|
QPrinter printer;
|
||||||
printer.setOutputFormat(QPrinter::PdfFormat);
|
printer.setOutputFormat(QPrinter::PdfFormat);
|
||||||
printer.setOrientation((QPrinter::Orientation)pageOrientation());
|
printer.setOrientation((QPrinter::Orientation)pageOrientation());
|
||||||
printer.setPageSize((QPrinter::PageSize)size);
|
printer.setPaperSize((QPrinter::PageSize)size);
|
||||||
return QSizeF(printer.paperRect(QPrinter::Millimeter).width() * 10,
|
return QSizeF(printer.paperSize(QPrinter::Millimeter).width() * 10,
|
||||||
printer.paperSize(QPrinter::Millimeter).height() * 10);
|
printer.paperSize(QPrinter::Millimeter).height() * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ class PageItemDesignIntf : public LimeReport::BaseDesignIntf
|
|||||||
Q_PROPERTY(Orientation pageOrientation READ pageOrientation WRITE setPageOrientation)
|
Q_PROPERTY(Orientation pageOrientation READ pageOrientation WRITE setPageOrientation)
|
||||||
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)
|
||||||
friend class ReportRender;
|
friend class ReportRender;
|
||||||
public:
|
public:
|
||||||
enum Orientation { Portrait, Landscape };
|
enum Orientation { Portrait, Landscape };
|
||||||
@ -104,6 +105,9 @@ public:
|
|||||||
void setGridStep(int value);
|
void setGridStep(int value);
|
||||||
int gridStep();
|
int gridStep();
|
||||||
void objectLoadFinished();
|
void objectLoadFinished();
|
||||||
|
bool fullPage() const;
|
||||||
|
void setFullPage(bool fullPage);
|
||||||
|
|
||||||
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);
|
||||||
@ -128,6 +132,7 @@ private:
|
|||||||
QRectF m_pageRect;
|
QRectF m_pageRect;
|
||||||
bool m_sizeChainging;
|
bool m_sizeChainging;
|
||||||
QList<BandDesignIntf*> m_bands;
|
QList<BandDesignIntf*> m_bands;
|
||||||
|
bool m_fullPage;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // LRPAGEITEM_H
|
#endif // LRPAGEITEM_H
|
||||||
|
@ -158,20 +158,21 @@ void ReportEnginePrivate::printReport(ItemsReaderIntf::Ptr reader, QPrinter& pri
|
|||||||
renderPage.setItemMode(PrintMode);
|
renderPage.setItemMode(PrintMode);
|
||||||
if (reader->first()){
|
if (reader->first()){
|
||||||
reader->readItem(renderPage.pageItem());
|
reader->readItem(renderPage.pageItem());
|
||||||
printer.setPageMargins(renderPage.pageItem()->leftMargin(),
|
printer.setFullPage(renderPage.pageItem()->fullPage());
|
||||||
renderPage.pageItem()->topMargin(),
|
|
||||||
renderPage.pageItem()->rightMargin(),
|
|
||||||
renderPage.pageItem()->bottomMargin(),
|
|
||||||
QPrinter::Millimeter);
|
|
||||||
printer.setOrientation((QPrinter::Orientation)renderPage.pageItem()->pageOrientation());
|
printer.setOrientation((QPrinter::Orientation)renderPage.pageItem()->pageOrientation());
|
||||||
renderPage.setSceneRect(renderPage.pageItem()->mapToScene(renderPage.pageItem()->rect()).boundingRect());
|
renderPage.setSceneRect(renderPage.pageItem()->mapToScene(renderPage.pageItem()->rect()).boundingRect());
|
||||||
|
|
||||||
QSizeF pageSize = (renderPage.pageItem()->pageOrientation()==PageItemDesignIntf::Landscape)?
|
if (renderPage.pageItem()->pageSize()==PageItemDesignIntf::Custom){
|
||||||
QSizeF(renderPage.pageItem()->sizeMM().height(),renderPage.pageItem()->sizeMM().width()):
|
QSizeF pageSize = (renderPage.pageItem()->pageOrientation()==PageItemDesignIntf::Landscape)?
|
||||||
renderPage.pageItem()->sizeMM();
|
QSizeF(renderPage.pageItem()->sizeMM().height(),renderPage.pageItem()->sizeMM().width()):
|
||||||
printer.setPaperSize(pageSize,QPrinter::Millimeter);
|
renderPage.pageItem()->sizeMM();
|
||||||
|
printer.setPaperSize(pageSize,QPrinter::Millimeter);
|
||||||
|
} else {
|
||||||
|
printer.setPaperSize((QPrinter::PageSize)renderPage.pageItem()->pageSize());
|
||||||
|
}
|
||||||
|
|
||||||
QPainter painter(&printer);
|
QPainter painter(&printer);
|
||||||
|
painter.drawRect(printer.pageRect());
|
||||||
renderPage.render(&painter);
|
renderPage.render(&painter);
|
||||||
|
|
||||||
while (reader->next()){
|
while (reader->next()){
|
||||||
@ -206,19 +207,17 @@ void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer, cons
|
|||||||
QPointF pagePos = page->pos();
|
QPointF pagePos = page->pos();
|
||||||
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.setPageMargins(renderPage.pageItem()->leftMargin(),
|
printer.setFullPage(renderPage.pageItem()->fullPage());
|
||||||
renderPage.pageItem()->topMargin(),
|
|
||||||
renderPage.pageItem()->rightMargin(),
|
|
||||||
renderPage.pageItem()->bottomMargin(),
|
|
||||||
QPrinter::Millimeter);
|
|
||||||
printer.setOrientation((QPrinter::Orientation)renderPage.pageItem()->pageOrientation());
|
printer.setOrientation((QPrinter::Orientation)renderPage.pageItem()->pageOrientation());
|
||||||
|
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()):
|
||||||
renderPage.pageItem()->sizeMM();
|
renderPage.pageItem()->sizeMM();
|
||||||
printer.setPaperSize(pageSize,QPrinter::Millimeter);
|
printer.setPaperSize(pageSize,QPrinter::Millimeter);
|
||||||
|
} else {
|
||||||
|
printer.setPaperSize((QPrinter::PageSize)renderPage.pageItem()->pageSize());
|
||||||
|
}
|
||||||
|
|
||||||
if (!isFirst){
|
if (!isFirst){
|
||||||
printer.newPage();
|
printer.newPage();
|
||||||
|
Loading…
Reference in New Issue
Block a user