Don't show bottom border if only one page need to print.
--HG-- branch : develop
This commit is contained in:
parent
d7d1c0b78a
commit
8bfc9d1ca3
|
@ -153,9 +153,13 @@ QImage VPoster::Cut(int i, int j, const QImage &image) const
|
||||||
|
|
||||||
if (not image.rect().contains(copyRect))
|
if (not image.rect().contains(copyRect))
|
||||||
{
|
{
|
||||||
|
// Create full page with white background
|
||||||
QImage fullPage(copyRect.size(), image.format());
|
QImage fullPage(copyRect.size(), image.format());
|
||||||
fullPage.fill(Qt::white);
|
fullPage.fill(Qt::white);
|
||||||
|
|
||||||
|
// Real size that we can copy from image.
|
||||||
|
// Because in areas beyond the image, pixels are set to 0 by copy() method.
|
||||||
|
// For 32-bit RGB images, this means black.
|
||||||
copyRect = image.rect().intersected(copyRect);
|
copyRect = image.rect().intersected(copyRect);
|
||||||
|
|
||||||
QPainter painter(&fullPage);
|
QPainter painter(&fullPage);
|
||||||
|
@ -197,6 +201,8 @@ QImage VPoster::Borders(int rows, int colomns, int i, int j, QImage &image, int
|
||||||
painter.drawImage(QPoint(image.rect().width()-allowence, 0), QImage("://scissors_horizontal.png"));
|
painter.drawImage(QPoint(image.rect().width()-allowence, 0), QImage("://scissors_horizontal.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rows*colomns > 1)
|
||||||
|
{ // Don't show bottom border if only one page need
|
||||||
// Bottom border (mandatory)
|
// Bottom border (mandatory)
|
||||||
painter.drawLine(QLine(0, image.rect().height()-allowence,
|
painter.drawLine(QLine(0, image.rect().height()-allowence,
|
||||||
image.rect().width(), image.rect().height()-allowence));
|
image.rect().width(), image.rect().height()-allowence));
|
||||||
|
@ -205,6 +211,7 @@ QImage VPoster::Borders(int rows, int colomns, int i, int j, QImage &image, int
|
||||||
painter.drawImage(QPoint(image.rect().width()-allowence, image.rect().height()-allowence),
|
painter.drawImage(QPoint(image.rect().width()-allowence, image.rect().height()-allowence),
|
||||||
QImage("://scissors_horizontal.png"));
|
QImage("://scissors_horizontal.png"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Labels
|
// Labels
|
||||||
const int layoutX = 15;
|
const int layoutX = 15;
|
||||||
|
@ -225,7 +232,9 @@ QImage VPoster::Borders(int rows, int colomns, int i, int j, QImage &image, int
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QRect VPoster::PageRect() const
|
QRect VPoster::PageRect() const
|
||||||
{
|
{
|
||||||
|
// Because the Point unit is defined to be 1/72th of an inch
|
||||||
|
// we can't use method pageRect(QPrinter::Point). Our dpi different can be different.
|
||||||
|
// We convert value yourself to pixels.
|
||||||
const QRectF rect = printer->pageRect(QPrinter::Millimeter);
|
const QRectF rect = printer->pageRect(QPrinter::Millimeter);
|
||||||
QRect pageRect(qFloor(ToPixel(rect.x())), qFloor(ToPixel(rect.y())), qFloor(ToPixel(rect.width())),
|
QRect pageRect(qFloor(ToPixel(rect.x())), qFloor(ToPixel(rect.y())), qFloor(ToPixel(rect.width())),
|
||||||
qFloor(ToPixel(rect.height())));
|
qFloor(ToPixel(rect.height())));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user