From 97351b58ddb52f1b951cc0bcbd1575842f511168 Mon Sep 17 00:00:00 2001 From: Ronan Le Tiec Date: Mon, 16 Nov 2020 20:22:38 +0100 Subject: [PATCH] Add text infos to the tiles --- .../svg/icon_scissors_horizontal.svg | 12 +++--- .../puzzleicon/svg/icon_scissors_vertical.svg | 2 +- src/app/puzzle/vpmainwindow.cpp | 38 +++++++++++++++++++ 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/app/puzzle/share/resources/puzzleicon/svg/icon_scissors_horizontal.svg b/src/app/puzzle/share/resources/puzzleicon/svg/icon_scissors_horizontal.svg index 03d29b139..c6ed9f159 100644 --- a/src/app/puzzle/share/resources/puzzleicon/svg/icon_scissors_horizontal.svg +++ b/src/app/puzzle/share/resources/puzzleicon/svg/icon_scissors_horizontal.svg @@ -34,16 +34,16 @@ guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:window-width="1845" - inkscape:window-height="1016" + inkscape:window-width="1510" + inkscape:window-height="773" id="namedview9" showgrid="false" inkscape:zoom="4" inkscape:cx="-13.069473" inkscape:cy="57.804097" - inkscape:window-x="75" - inkscape:window-y="27" - inkscape:window-maximized="1" + inkscape:window-x="285" + inkscape:window-y="105" + inkscape:window-maximized="0" inkscape:current-layer="g4593" inkscape:document-rotation="0" units="mm" /> @@ -70,7 +70,7 @@ diff --git a/src/app/puzzle/share/resources/puzzleicon/svg/icon_scissors_vertical.svg b/src/app/puzzle/share/resources/puzzleicon/svg/icon_scissors_vertical.svg index c88794863..8bc4994e4 100644 --- a/src/app/puzzle/share/resources/puzzleicon/svg/icon_scissors_vertical.svg +++ b/src/app/puzzle/share/resources/puzzleicon/svg/icon_scissors_vertical.svg @@ -70,7 +70,7 @@ diff --git a/src/app/puzzle/vpmainwindow.cpp b/src/app/puzzle/vpmainwindow.cpp index 6efa30b7e..07cef248a 100644 --- a/src/app/puzzle/vpmainwindow.cpp +++ b/src/app/puzzle/vpmainwindow.cpp @@ -954,6 +954,44 @@ void VPMainWindow::generateTiledPdf(QString fileName) painter.setPen(penTileDrawing); m_graphicsView->GetScene()->render(&painter, target, source, Qt::IgnoreAspectRatio); + + QTextDocument td; + + td.documentLayout()->setPaintDevice(printer); + td.setPageSize(QSizeF(tilesDrawingAreaWidth - UnitConvertor(2, Unit::Cm, Unit::Px), tilesDrawingAreaHeight)); + + + const QString grid = tr("Grid ( %1 , %2 )").arg(row+1).arg(col+1); + const QString page = tr("Page %1 of %2").arg(row*nbCol+col+1).arg(nbCol*nbRow); + + td.setHtml(QString("" + "" + "" + "" + "
%1
") + .arg(grid)); + painter.setPen(penTileInfos); + painter.save(); + painter.translate(QPointF(tilesMargins.left()+ UnitConvertor(1, Unit::Cm, Unit::Px), + tilesDrawingAreaHeight + tilesMargins.top() + )); + td.drawContents(&painter); + painter.restore(); + + td.setPageSize(QSizeF(tilesDrawingAreaHeight - UnitConvertor(2, Unit::Cm, Unit::Px), tilesDrawingAreaWidth)); + td.setHtml(QString("" + "" + "" + "" + "
%1 - %2
") + .arg(page).arg(m_layout->GetFocusedSheet()->GetName())); + painter.save(); + painter.rotate(-90); + painter.translate(QPointF(-(tilesDrawingAreaHeight+tilesMargins.top()) + UnitConvertor(1, Unit::Cm, Unit::Px), + tilesDrawingAreaWidth + tilesMargins.left() + )); + td.drawContents(&painter); + painter.restore(); } }