Commit 239f2397 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix draw several page

parent 8b88ab9c
......@@ -104,7 +104,7 @@ void LogViewExport::print(QPrinter *printer)
QPaintDevice *painterDevice = painter.device();
int dpiy = painterDevice->logicalDpiY();
int margin = (int)((2 / 2.54) * dpiy); // 2 cm margins
const int margin = (int)((2 / 2.54) * dpiy); // 2 cm margins
QRect printView(margin, margin, painterDevice->width() - 2 * margin, painterDevice->height() - 2 * margin);
int page = 1;
......@@ -124,7 +124,7 @@ void LogViewExport::print(QPrinter *printer)
movement += moveBy;
if (movement + margin >= printView.height()) {
painter.setPen(originalPen);
printPageNumber(painter, printView, movement, page);
printPageNumber(painter, printView, movement, page, margin);
printer->newPage();
page++;
movement = 0;
......@@ -175,12 +175,12 @@ void LogViewExport::printPreview()
dialog->open();
}
void LogViewExport::printPageNumber(QPainter &painter, QRect &printView, int movement, int page)
void LogViewExport::printPageNumber(QPainter &painter, QRect &printView, int movement, int page, int margin)
{
logDebug() << "Printing page number...";
painter.translate(0, -movement);
printView.moveTo(QPoint(0, printView.height()));
printView.moveTo(QPoint(margin, printView.height() * page + margin));
painter.translate(0, -printView.height());
painter.drawText(printView.right() - painter.fontMetrics().boundingRect(QString::number(page)).width(),
printView.bottom() + painter.fontMetrics().ascent() + 5,
......
......@@ -51,7 +51,7 @@ Q_SIGNALS:
void statusBarChanged(const QString &message);
private:
void printPageNumber(QPainter &painter, QRect &printView, int movement, int page);
void printPageNumber(QPainter &painter, QRect &printView, int movement, int page, int margin);
QWidget *const mParent;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment