Improve tiles decoration

This commit is contained in:
Ronan Le Tiec 2020-11-15 22:34:24 +01:00
parent cbf0651486
commit db4bd0d616
5 changed files with 379 additions and 11 deletions

View File

@ -11,5 +11,8 @@
<file>puzzleicon/64x64/iconGrainlineHorizontal.png</file>
<file alias="cursor_rotate">puzzleicon/64x64/cursorRotate.png</file>
<file>puzzleicon/64x64/iconProperties.png</file>
<file>puzzleicon/svg/icon_scissors.svg</file>
<file>puzzleicon/svg/icon_scissors_vertical.svg</file>
<file>puzzleicon/svg/icon_scissors_horizontal.svg</file>
</qresource>
</RCC>

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
width="100"
height="56"
id="svg2"
sodipodi:docname="Scissors_icon_black.svg"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
<metadata
id="metadata11">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1825"
inkscape:window-height="947"
id="namedview9"
showgrid="false"
inkscape:zoom="4"
inkscape:cx="88.508712"
inkscape:cy="66.691968"
inkscape:window-x="408"
inkscape:window-y="42"
inkscape:window-maximized="0"
inkscape:current-layer="g4593" />
<defs
id="defs4">
<marker
refX="0"
refY="0"
orient="auto"
id="Scissors"
style="overflow:visible">
<path
d="M 9.0898857,-3.6061018 C 8.1198849,-4.7769976 6.3697607,-4.7358294 5.0623558,-4.2327734 l -8.2124046,3.0779029 c -2.3882933,-1.3067135 -4.7482873,-0.9325372 -4.7482873,-1.5687873 0,-0.4973164 0.4566662,-0.3883222 0.3883068,-1.6831941 -0.065635,-1.2432767 -1.3635771,-2.1630796 -2.5903987,-2.0816435 -1.227271,-0.00735 -2.499439,0.9331613 -2.510341,2.2300611 -0.09143,1.3063864 1.007209,2.5196896 2.306764,2.6052316 1.5223406,0.2266616 4.218258,-0.6955566 5.482945,1.57086006 -0.9422847,1.73825774 -2.6140244,1.74307674 -4.1255107,1.65607034 -1.2548743,-0.072235 -2.7620933,0.2873979 -3.3606483,1.5208605 -0.578367,1.1820862 -0.0112,2.8646022 1.316749,3.226412 1.3401912,0.4918277 3.1806689,-0.129711 3.4993722,-1.6707242 0.2456585,-1.187823 -0.5953659,-1.7459574 -0.2725074,-2.1771537 0.2436135,-0.32536 1.7907806,-0.1368452 4.5471053,-1.3748244 L 5.6763468,4.2330688 C 6.8000164,4.5467672 8.1730685,4.5362646 9.1684433,3.4313614 l -9.22008423,-3.48508362 z m -18.3078016,-1.900504 c 1.294559,0.7227998 1.1888392,2.6835702 -0.1564272,3.0632889 -1.2165179,0.423661 -2.7710269,-0.7589694 -2.3831779,-2.0774648 0.227148,-1.0818519 1.653387,-1.480632 2.5396051,-0.9858241 z m 0.056264,8.0173649 c 1.3508301,0.4988648 1.1214429,2.7844356 -0.2522207,3.091609 -0.9110594,0.3163391 -2.2135494,-0.1387976 -2.3056964,-1.2121394 -0.177609,-1.305055 1.356085,-2.4841482 2.5579171,-1.8794696 z"
id="schere"
style="marker-start:none" />
</marker>
</defs>
<g
transform="matrix(0.88916115,0.40113698,-0.40113698,0.88916115,416.60041,-888.00877)"
id="layer1">
<g
transform="matrix(4.2610846,-1.2351263,1.2351263,4.2610846,-1337.7659,-2994.9736)"
id="g4593">
<path
d="m 59.731665,956.40057 c -0.609784,-1.39286 -2.303491,-1.83556 -3.698902,-1.71226 l -8.742604,0.69566 c -1.935736,-1.91425 -4.307466,-2.2049 -4.132136,-2.81651 0.137044,-0.47806 0.545993,-0.24745 0.837105,-1.51102 0.279511,-1.21323 -0.714709,-2.45509 -1.916471,-2.71488 -1.177727,-0.34526 -2.659814,0.20827 -3.027677,1.45195 -0.447882,1.23061 0.273869,2.69969 1.499535,3.14003 1.400938,0.6374 4.246607,0.49379 4.837778,3.02096 -1.384807,1.41129 -2.993148,0.95525 -4.422137,0.4551 -1.186382,-0.41524 -2.734347,-0.48487 -3.649629,0.53589 -0.881717,0.97694 -0.800158,2.7506 0.376675,3.46434 1.15277,0.8421 3.093263,0.7518 3.824279,-0.64172 0.563472,-1.07414 -0.09119,-1.84242 0.337995,-2.16796 0.32384,-0.24563 1.759155,0.36194 4.749906,-0.0686 l 3.518754,2.50293 c 0.830495,-0.11244 2.357866,-0.33884 2.949854,-0.42081 l -3.108827,-2.3174 9.766502,-0.89574 z m -17.075242,-6.87194 c 1.045256,1.05155 0.403306,2.90727 -0.994512,2.90157 -1.286163,0.072 -2.454591,-1.49318 -1.718425,-2.65375 0.516476,-0.97737 1.997384,-0.96769 2.712937,-0.24782 z m -2.155235,7.72245 c 1.161058,0.85179 0.310724,2.98566 -1.0944,2.9024 -0.962958,0.053 -2.089598,-0.7434 -1.882399,-1.80058 0.188897,-1.30347 1.988129,-2.01427 2.976799,-1.10182 z"
id="path4599"
style="marker-start:none"
sodipodi:nodetypes="cccscccccccccccccccccccccccc" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
width="10mm"
height="5.5999999mm"
id="svg2"
sodipodi:docname="icon_scissors_horizontal.svg"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
<metadata
id="metadata11">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1845"
inkscape:window-height="1016"
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:current-layer="g4593"
inkscape:document-rotation="0"
units="mm" />
<defs
id="defs4">
<marker
refX="0"
refY="0"
orient="auto"
id="Scissors"
style="overflow:visible">
<path
d="M 9.0898857,-3.6061018 C 8.1198849,-4.7769976 6.3697607,-4.7358294 5.0623558,-4.2327734 l -8.2124046,3.0779029 c -2.3882933,-1.3067135 -4.7482873,-0.9325372 -4.7482873,-1.5687873 0,-0.4973164 0.4566662,-0.3883222 0.3883068,-1.6831941 -0.065635,-1.2432767 -1.3635771,-2.1630796 -2.5903987,-2.0816435 -1.227271,-0.00735 -2.499439,0.9331613 -2.510341,2.2300611 -0.09143,1.3063864 1.007209,2.5196896 2.306764,2.6052316 1.5223406,0.2266616 4.218258,-0.6955566 5.482945,1.57086006 -0.9422847,1.73825774 -2.6140244,1.74307674 -4.1255107,1.65607034 -1.2548743,-0.072235 -2.7620933,0.2873979 -3.3606483,1.5208605 -0.578367,1.1820862 -0.0112,2.8646022 1.316749,3.226412 1.3401912,0.4918277 3.1806689,-0.129711 3.4993722,-1.6707242 0.2456585,-1.187823 -0.5953659,-1.7459574 -0.2725074,-2.1771537 0.2436135,-0.32536 1.7907806,-0.1368452 4.5471053,-1.3748244 L 5.6763468,4.2330688 C 6.8000164,4.5467672 8.1730685,4.5362646 9.1684433,3.4313614 l -9.22008423,-3.48508362 z m -18.3078016,-1.900504 c 1.294559,0.7227998 1.1888392,2.6835702 -0.1564272,3.0632889 -1.2165179,0.423661 -2.7710269,-0.7589694 -2.3831779,-2.0774648 0.227148,-1.0818519 1.653387,-1.480632 2.5396051,-0.9858241 z m 0.056264,8.0173649 c 1.3508301,0.4988648 1.1214429,2.7844356 -0.2522207,3.091609 -0.9110594,0.3163391 -2.2135494,-0.1387976 -2.3056964,-1.2121394 -0.177609,-1.305055 1.356085,-2.4841482 2.5579171,-1.8794696 z"
id="schere"
style="marker-start:none" />
</marker>
</defs>
<g
transform="matrix(0.88916115,0.40113698,-0.40113698,0.88916115,416.60041,-888.00877)"
id="layer1">
<g
transform="matrix(4.2610846,-1.2351263,1.2351263,4.2610846,-1337.7659,-2994.9736)"
id="g4593">
<path
d="m 35.464624,949.91014 c 0.230465,0.52643 0.870608,0.69376 1.398007,0.64716 l 3.304293,-0.26293 c 0.731614,0.72349 1.628019,0.83334 1.561751,1.06451 -0.0518,0.18068 -0.206363,0.0935 -0.316383,0.57109 -0.105643,0.45854 0.270125,0.92791 0.724333,1.02609 0.445128,0.1305 1.005282,-0.0787 1.144322,-0.54876 0.169277,-0.46512 -0.103509,-1.02036 -0.566757,-1.18679 -0.529488,-0.2409 -1.605018,-0.18663 -1.828451,-1.14178 0.523391,-0.5334 1.131267,-0.36105 1.671359,-0.172 0.448397,0.15694 1.033456,0.18325 1.379387,-0.20254 0.333251,-0.36924 0.302424,-1.0396 -0.142367,-1.30936 -0.435692,-0.31827 -1.169106,-0.28414 -1.445396,0.24254 -0.212966,0.40597 0.03447,0.69635 -0.127746,0.81938 -0.122393,0.0928 -0.664876,-0.13679 -1.795242,0.0259 l -1.329919,-0.94598 c -0.313891,0.0425 -0.891164,0.12806 -1.114904,0.15904 l 1.174988,0.87587 -3.691276,0.33854 z m 6.453633,2.59727 c -0.395055,-0.39744 -0.15243,-1.09881 0.375877,-1.09666 0.486113,-0.0272 0.927723,0.56435 0.649487,1.00299 -0.195206,0.3694 -0.754918,0.36575 -1.025364,0.0937 z m 0.814577,-2.91872 c -0.438826,-0.32194 -0.11744,-1.12844 0.413631,-1.09697 0.363954,-0.02 0.789772,0.28097 0.711461,0.68053 -0.0714,0.49265 -0.751419,0.7613 -1.125092,0.41644 z"
id="path4599"
style="fill:#c8c8c8;fill-opacity:1;stroke-width:0.377953;marker-start:none"
sodipodi:nodetypes="cccscccccccccccccccccccccccc" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
width="5.5999999mm"
height="10mm"
id="svg2"
sodipodi:docname="icon_scissors_vertical.svg"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
<metadata
id="metadata11">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1845"
inkscape:window-height="1016"
id="namedview9"
showgrid="false"
inkscape:zoom="4"
inkscape:cx="-13.069473"
inkscape:cy="50.393713"
inkscape:window-x="75"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="g4593"
inkscape:document-rotation="0"
units="mm" />
<defs
id="defs4">
<marker
refX="0"
refY="0"
orient="auto"
id="Scissors"
style="overflow:visible">
<path
d="M 9.0898857,-3.6061018 C 8.1198849,-4.7769976 6.3697607,-4.7358294 5.0623558,-4.2327734 l -8.2124046,3.0779029 c -2.3882933,-1.3067135 -4.7482873,-0.9325372 -4.7482873,-1.5687873 0,-0.4973164 0.4566662,-0.3883222 0.3883068,-1.6831941 -0.065635,-1.2432767 -1.3635771,-2.1630796 -2.5903987,-2.0816435 -1.227271,-0.00735 -2.499439,0.9331613 -2.510341,2.2300611 -0.09143,1.3063864 1.007209,2.5196896 2.306764,2.6052316 1.5223406,0.2266616 4.218258,-0.6955566 5.482945,1.57086006 -0.9422847,1.73825774 -2.6140244,1.74307674 -4.1255107,1.65607034 -1.2548743,-0.072235 -2.7620933,0.2873979 -3.3606483,1.5208605 -0.578367,1.1820862 -0.0112,2.8646022 1.316749,3.226412 1.3401912,0.4918277 3.1806689,-0.129711 3.4993722,-1.6707242 0.2456585,-1.187823 -0.5953659,-1.7459574 -0.2725074,-2.1771537 0.2436135,-0.32536 1.7907806,-0.1368452 4.5471053,-1.3748244 L 5.6763468,4.2330688 C 6.8000164,4.5467672 8.1730685,4.5362646 9.1684433,3.4313614 l -9.22008423,-3.48508362 z m -18.3078016,-1.900504 c 1.294559,0.7227998 1.1888392,2.6835702 -0.1564272,3.0632889 -1.2165179,0.423661 -2.7710269,-0.7589694 -2.3831779,-2.0774648 0.227148,-1.0818519 1.653387,-1.480632 2.5396051,-0.9858241 z m 0.056264,8.0173649 c 1.3508301,0.4988648 1.1214429,2.7844356 -0.2522207,3.091609 -0.9110594,0.3163391 -2.2135494,-0.1387976 -2.3056964,-1.2121394 -0.177609,-1.305055 1.356085,-2.4841482 2.5579171,-1.8794696 z"
id="schere"
style="marker-start:none" />
</marker>
</defs>
<g
transform="matrix(0.88916115,0.40113698,-0.40113698,0.88916115,416.60041,-888.00877)"
id="layer1">
<g
transform="matrix(4.2610846,-1.2351263,1.2351263,4.2610846,-1337.7659,-2994.9736)"
id="g4593">
<path
d="m 36.184207,948.95114 c 0.569876,0.0741 0.909488,0.64195 1.012188,1.16134 l 0.671333,3.24604 c 0.899184,0.50018 1.255261,1.33013 1.458678,1.20188 0.158999,-0.10024 0.0321,-0.22428 0.459871,-0.46343 0.410725,-0.22962 0.966427,-6e-5 1.187683,0.40859 0.249732,0.3909 0.205467,0.9872 -0.206972,1.25211 -0.399242,0.29256 -1.008607,0.18588 -1.297908,-0.21237 -0.379329,-0.44103 -0.627899,-1.48884 -1.60743,-1.43634 -0.365808,0.65165 -0.03037,1.1871 0.302112,1.65281 0.276041,0.38663 0.464872,0.94101 0.191168,1.381 -0.261348,0.42319 -0.913595,0.58101 -1.296949,0.22937 -0.427389,-0.32934 -0.599659,-1.04305 -0.171218,-1.45557 0.330248,-0.31797 0.678218,-0.16158 0.751001,-0.35173 0.05492,-0.14347 -0.317221,-0.60012 -0.476999,-1.7309 l -1.280073,-1.01242 c -0.04695,-0.31326 -0.126182,-0.89144 -0.158987,-1.11492 l 1.169432,0.88327 -0.706915,-3.63873 z m 4.297937,5.47019 c -0.492034,-0.26819 -1.097611,0.16084 -0.947845,0.66748 0.109774,0.47433 0.80121,0.73295 1.144574,0.34318 0.300097,-0.29069 0.140107,-0.82706 -0.196729,-1.01066 z m -2.57461,1.59808 c -0.431781,-0.33133 -1.116275,0.20272 -0.937591,0.70381 0.08252,0.35505 0.490562,0.67973 0.8523,0.49284 0.453046,-0.20628 0.52087,-0.93429 0.08529,-1.19665 z"
id="path4599"
style="fill:#c8c8c8;fill-opacity:1;stroke-width:0.377954;marker-start:none"
sodipodi:nodetypes="cccscccccccccccccccccccccccc" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -713,7 +713,6 @@ void VPMainWindow::generateTiledPdf(QString fileName)
QSizeF tilesSize = m_layout->GetTilesSize();
QMarginsF tilesMargins = m_layout->GetTilesMargins();
// ------------- Set up the printer
QPrinter* printer = new QPrinter();
@ -739,8 +738,7 @@ void VPMainWindow::generateTiledPdf(QString fileName)
printer->setOutputFileName(fileName);
printer->setResolution(static_cast<int>(PrintDPI));
printer->setDocName("Test");
printer->setDocName("Test"); // FIXME
// ------------- Set up the painter
@ -752,8 +750,10 @@ void VPMainWindow::generateTiledPdf(QString fileName)
}
painter.setFont( QFont( QStringLiteral("Arial"), 8, QFont::Normal ) );
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setBrush ( QBrush ( Qt::NoBrush ) );
QPen penTileInfos = QPen(QColor(180,180,180), qApp->Settings()->WidthHairLine(), Qt::DashLine, Qt::RoundCap, Qt::RoundJoin);
QPen penTileDrawing = QPen(Qt::black, qApp->Settings()->WidthMainLine(), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
if(tilesOrientation == PageOrientation::Landscape)
{
@ -797,12 +797,67 @@ void VPMainWindow::generateTiledPdf(QString fileName)
int nbCol = qCeil(drawingWidth/tilesDrawingAreaWidth);
int nbRow = qCeil(drawingHeight/tilesDrawingAreaHeight);
// ------------- prepare triangles for positioning
// top triangle
QRectF rectTop = QRectF(tilesMargins.left()+ tilesDrawingAreaWidth/2 - UnitConvertor(0.5, Unit::Cm, Unit::Px),
tilesMargins.top(),
UnitConvertor(1, Unit::Cm, Unit::Px),
UnitConvertor(0.5, Unit::Cm, Unit::Px)
);
QPainterPath triangleTop;
triangleTop.moveTo(rectTop.topLeft());
triangleTop.lineTo(rectTop.topRight());
triangleTop.lineTo(rectTop.left() + (rectTop.width() / 2), rectTop.bottom());
triangleTop.lineTo(rectTop.topLeft());
// left triangle
QRectF rectLeft = QRectF(tilesMargins.left(),
tilesMargins.top() + tilesDrawingAreaHeight/2 - UnitConvertor(0.5, Unit::Cm, Unit::Px),
UnitConvertor(0.5, Unit::Cm, Unit::Px),
UnitConvertor(1, Unit::Cm, Unit::Px)
);
QPainterPath triangleLeft;
triangleLeft.moveTo(rectLeft.topLeft());
triangleLeft.lineTo(rectLeft.right(), rectLeft.top() + (rectLeft.height() / 2));
triangleLeft.lineTo(rectLeft.bottomLeft());
triangleLeft.lineTo(rectLeft.topLeft());
// bottom triangle
QRectF rectBottom = QRectF(tilesMargins.left()+ tilesDrawingAreaWidth/2 - UnitConvertor(0.5, Unit::Cm, Unit::Px),
tilesMargins.top()+tilesDrawingAreaHeight - UnitConvertor(0.5, Unit::Cm, Unit::Px),
UnitConvertor(1, Unit::Cm, Unit::Px),
UnitConvertor(0.5, Unit::Cm, Unit::Px)
);
QPainterPath triangleBottom;
triangleBottom.moveTo(rectBottom.bottomLeft());
triangleBottom.lineTo(rectBottom.left() + (rectBottom.width() / 2), rectBottom.top());
triangleBottom.lineTo(rectBottom.bottomRight());
triangleBottom.lineTo(rectBottom.bottomLeft());
// right triangle
QRectF rectRight = QRectF(tilesMargins.left() + tilesDrawingAreaWidth - UnitConvertor(0.5, Unit::Cm, Unit::Px),
tilesMargins.top() + tilesDrawingAreaHeight/2 - UnitConvertor(0.5, Unit::Cm, Unit::Px),
UnitConvertor(0.5, Unit::Cm, Unit::Px),
UnitConvertor(1, Unit::Cm, Unit::Px)
);
QPainterPath triangleRight;
triangleRight.moveTo(rectRight.topRight());
triangleRight.lineTo(rectRight.bottomRight());
triangleRight.lineTo(rectRight.left(), rectRight.top() + (rectRight.height() / 2));
triangleRight.lineTo(rectRight.topRight());
QBrush triangleBush = QBrush(QColor(200,200,200));
// ------------- Perform the tiling
for(int i=0;i<nbRow;i++) // for each row of the tiling grid
QSvgRenderer* svgRenderer = new QSvgRenderer();
for(int row=0;row<nbRow;row++) // for each row of the tiling grid
{
for(int j=0;j<nbCol;j++) // for each column of tiling grid
for(int col=0;col<nbCol;col++) // for each column of tiling grid
{
if(not (i == 0 && j == 0))
if(not (row == 0 && col == 0))
{
if (not printer->newPage())
{
@ -811,12 +866,93 @@ void VPMainWindow::generateTiledPdf(QString fileName)
}
}
QRectF source = QRectF(j*tilesDrawingAreaWidth, i*tilesDrawingAreaHeight, tilesDrawingAreaWidth, tilesDrawingAreaHeight);
QRectF target = QRectF(m_layout->GetTilesMargins().left(), m_layout->GetTilesMargins().top(),
source.width(), source.height());
// add the tiles decorations (cutting and gluing lines, scissors, infos etc.)
penTileInfos.setStyle(Qt::DashLine);
painter.setPen(penTileInfos);
// TODO: add the lines etc
if(row > 0)
{
// add top triangle
painter.fillPath(triangleTop, triangleBush);
// scissors along the top line
svgRenderer->load(QStringLiteral("://puzzleicon/svg/icon_scissors_horizontal.svg"));
svgRenderer->render(&painter, QRectF(tilesMargins.left()+tilesDrawingAreaWidth,
tilesMargins.top(),
UnitConvertor(1, Unit::Cm, Unit::Px),
UnitConvertor(0.56, Unit::Cm, Unit::Px)
));
// top line
painter.drawLine(QPointF(tilesMargins.left(),
tilesMargins.top()),
QPointF(tilesMargins.left() + tilesDrawingAreaWidth + UnitConvertor(1, Unit::Cm, Unit::Px),
tilesMargins.top())
);
}
if(col > 0)
{
// add left triangle
painter.fillPath(triangleLeft, triangleBush);
// scissors along the left line
svgRenderer->load(QStringLiteral("://puzzleicon/svg/icon_scissors_vertical.svg"));
svgRenderer->render(&painter, QRectF(tilesMargins.left(),
tilesMargins.top()+tilesDrawingAreaHeight,
UnitConvertor(0.56, Unit::Cm, Unit::Px),
UnitConvertor(1, Unit::Cm, Unit::Px)
));
// left line
painter.drawLine(QPointF(tilesMargins.left(),
tilesMargins.top()),
QPointF(tilesMargins.left(),
tilesMargins.top() + tilesDrawingAreaHeight + UnitConvertor(1, Unit::Cm, Unit::Px))
);
}
penTileInfos.setStyle(Qt::DotLine);
painter.setPen(penTileInfos);
if(row < nbRow-1)
{
// add bottom triangle
painter.fillPath(triangleBottom, triangleBush);
// bottom line
painter.drawLine(QPointF(tilesMargins.left(),
tilesMargins.top() + tilesDrawingAreaHeight),
QPointF(tilesMargins.left() + tilesDrawingAreaWidth + UnitConvertor(1, Unit::Cm, Unit::Px),
tilesMargins.top() + tilesDrawingAreaHeight)
);
}
if(col < nbCol-1)
{
// add right triangle
painter.fillPath(triangleRight, triangleBush);
// right line
painter.drawLine(QPointF(tilesMargins.left() + tilesDrawingAreaWidth,
tilesMargins.top()),
QPointF(tilesMargins.left() + tilesDrawingAreaWidth,
tilesMargins.top()+ tilesDrawingAreaHeight + UnitConvertor(1, Unit::Cm, Unit::Px))
);
}
// paint the page
QRectF source = QRectF(col*tilesDrawingAreaWidth,
row*tilesDrawingAreaHeight,
tilesDrawingAreaWidth + UnitConvertor(1, Unit::Cm, Unit::Px),
tilesDrawingAreaHeight + UnitConvertor(1, Unit::Cm, Unit::Px)
);
QRectF target = QRectF(tilesMargins.left(),
tilesMargins.top(),
source.width(),
source.height()
);
painter.setPen(penTileDrawing);
m_graphicsView->GetScene()->render(&painter, target, source, Qt::IgnoreAspectRatio);
}
}