Merge branch 'feature/manual-layout' into 'feature/manual-layout'

Feature/manual layout  small functionalities

See merge request smart-pattern/valentina!12
This commit is contained in:
Roman Telezhynskyi 2021-04-24 11:31:40 +00:00
commit cd1ba3a64e
22 changed files with 800 additions and 20 deletions

View File

@ -16,5 +16,13 @@
<file>puzzleicon/16x16/roll.png</file> <file>puzzleicon/16x16/roll.png</file>
<file>puzzleicon/16x16/template.png</file> <file>puzzleicon/16x16/template.png</file>
<file>puzzleicon/svg/cursor_rotate.svg</file> <file>puzzleicon/svg/cursor_rotate.svg</file>
<file>puzzleicon/svg/icon_rotate_90_anticlockwise.svg</file>
<file>puzzleicon/svg/icon_rotate_90_clockwise.svg</file>
<file>puzzleicon/64x64/iconRotate90Anticlockwise.png</file>
<file>puzzleicon/64x64/iconRotate90Clockwise.png</file>
<file>puzzleicon/64x64/iconRotateGrainlineHorizontal.png</file>
<file>puzzleicon/64x64/iconRotateGrainlineVertical.png</file>
<file>puzzleicon/svg/icon_rotate_grainline_horizontal.svg</file>
<file>puzzleicon/svg/icon_rotate_grainline_vertical.svg</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1,79 @@
<?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"
id="svg893"
width="128"
height="128"
viewBox="0 0 128 128"
sodipodi:docname="icon_rotate_90_anticlockwise.svg"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
inkscape:export-filename="/home/ronan/Workspace_cpp/valentina/src/app/puzzle/share/resources/puzzleicon/64x64/cursorRotate@2x.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<metadata
id="metadata899">
<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>
<defs
id="defs897" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1043"
id="namedview895"
showgrid="false"
inkscape:zoom="1.9070797"
inkscape:cx="-10.361902"
inkscape:cy="69.818165"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="g901"
showguides="false"
inkscape:lockguides="false"
inkscape:document-rotation="0" />
<g
inkscape:groupmode="layer"
inkscape:label="Image"
id="g901">
<path
id="path1502"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:16.3619;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1"
d="M 55.896493,2.9375026 C 33.6579,6.5065667 18.949296,20.13637 11.102943,39.261394 L 0.54579357,31.704504 9.2043998,61.438917 33.336678,43.163337 20.178057,41.964226 C 26.09616,28.336396 41.286906,13.618412 57.166066,10.475466 83.491044,5.26499 118.31674,25.305285 118.92695,54.737111 c 3.26906,-0.0857 5.15084,-0.118802 8.51053,-0.256065 C 127.26422,20.979551 89.86429,-2.5139775 55.896493,2.9375026 Z"
sodipodi:nodetypes="scccccsccs" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:80.5149px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.25804"
x="27.286873"
y="104.23756"
id="text1480"
transform="scale(0.94780675,1.0550674)"><tspan
sodipodi:role="line"
id="tspan1478"
x="27.286873"
y="104.23756"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:80.5149px;font-family:Garuda;-inkscape-font-specification:Garuda;stroke-width:1.25804">90</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -0,0 +1,79 @@
<?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"
id="svg893"
width="128"
height="128"
viewBox="0 0 128 128"
sodipodi:docname="icon_rotate_90_clockwise.svg"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
inkscape:export-filename="/home/ronan/Workspace_cpp/valentina/src/app/puzzle/share/resources/puzzleicon/64x64/iconRotate90Clockwise@2x.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<metadata
id="metadata899">
<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>
<defs
id="defs897" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1043"
id="namedview895"
showgrid="false"
inkscape:zoom="1.9070797"
inkscape:cx="-10.361902"
inkscape:cy="69.818165"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="g901"
showguides="false"
inkscape:lockguides="false"
inkscape:document-rotation="0" />
<g
inkscape:groupmode="layer"
inkscape:label="Image"
id="g901">
<path
id="path1502"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:16.3619;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1"
d="M 72.086781,2.9375026 C 94.325374,6.5065667 109.03398,20.13637 116.88033,39.261394 l 10.55715,-7.55689 -8.65861,29.734413 -24.132274,-18.27558 13.158624,-1.199111 C 101.88711,28.336396 86.696368,13.618412 70.817208,10.475466 44.49223,5.26499 9.6665336,25.305285 9.0563236,54.737111 5.7872636,54.651411 3.9054836,54.618309 0.54579357,54.481046 0.71905357,20.979551 38.118984,-2.5139775 72.086781,2.9375026 Z"
sodipodi:nodetypes="scccccsccs" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:80.5149px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.25804"
x="18.815292"
y="103.3251"
id="text1480"
transform="scale(0.94780675,1.0550674)"><tspan
sodipodi:role="line"
id="tspan1478"
x="18.815292"
y="103.3251"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:80.5149px;font-family:Garuda;-inkscape-font-specification:Garuda;stroke-width:1.25804">90</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.3 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"
id="svg893"
width="128"
height="128"
viewBox="0 0 128 128"
sodipodi:docname="icon_rotate_grainline_horizontal_clockwise.svg"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
inkscape:export-filename="/home/ronan/Workspace_cpp/valentina/src/app/puzzle/share/resources/puzzleicon/64x64/iconRotateGrainlineHorizontal@2x.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<metadata
id="metadata899">
<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>
<defs
id="defs897" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1043"
id="namedview895"
showgrid="false"
inkscape:zoom="1.9070797"
inkscape:cx="73.591374"
inkscape:cy="127.65689"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="g901"
showguides="false"
inkscape:lockguides="false"
inkscape:document-rotation="0" />
<g
inkscape:groupmode="layer"
inkscape:label="Image"
id="g901">
<g
id="g2862"
style="fill:#000000">
<path
id="path1502-1"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:15.9493;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1"
d="M 60.996394,0.20303699 C 58.149666,0.24970079 55.302575,0.50557789 52.47989,0.98233389 31.348865,4.5513981 17.373357,18.181529 9.9177848,37.306553 L -0.11309389,29.747959 8.1138972,59.484287 31.044802,41.206943 18.540073,40.007724 C 24.163438,26.379894 38.59788,11.662388 53.686194,8.5194431 56.908693,7.8481862 60.45821,7.3123197 63.862041,7.4453147 c 0,0 -0.0094,-3.1734682 -0.01877,-7.21884021 -0.947752,-0.030357 -1.897966,-0.038992 -2.846876,-0.023437 z m 2.865647,7.24227771 c 3.40383,-0.132995 6.956636,0.4028716 10.179135,1.0741284 15.088313,3.1429449 29.522754,17.8604509 35.146114,31.4882809 l -12.502866,1.199219 22.930896,18.277344 8.22699,-29.736328 -10.03088,7.558594 C 110.35586,18.181529 96.378506,4.5513978 75.24748,0.98233389 71.4839,0.34665889 67.634281,0.10504749 63.84327,0.22647449 63.83387,4.2718465 63.86204,7.4453147 63.862041,7.4453147 Z"
sodipodi:nodetypes="sscccccsccscscccccscc" />
</g>
<path
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.267085px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 101.4024,97.530244 -0.16286,-12.678896 -72.108879,0.170445 -0.0485,12.272785 -17.45021,-15.328335 17.49634,-15.217299 0.10731,12.160556 72.067279,0.126254 -0.13651,-12.556319 17.57604,15.800751 z"
id="path815"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccccc" />
</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"
id="svg893"
width="128"
height="128"
viewBox="0 0 128 128"
sodipodi:docname="icon_rotate_grainline_vertical_clockwise.svg"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
inkscape:export-filename="/home/ronan/Workspace_cpp/valentina/src/app/puzzle/share/resources/puzzleicon/64x64/iconRotateGrainlineVertical@2x.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<metadata
id="metadata899">
<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>
<defs
id="defs897" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1043"
id="namedview895"
showgrid="false"
inkscape:zoom="1.9070797"
inkscape:cx="73.591374"
inkscape:cy="127.65689"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="g901"
showguides="false"
inkscape:lockguides="false"
inkscape:document-rotation="0" />
<g
inkscape:groupmode="layer"
inkscape:label="Image"
id="g901">
<g
id="g2862"
style="fill:#000000">
<path
id="path1502-1"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:15.9493;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1"
d="M 60.996394,0.20303699 C 58.149666,0.24970079 55.302575,0.50557789 52.47989,0.98233389 31.348865,4.5513981 17.373357,18.181529 9.9177848,37.306553 L -0.11309389,29.747959 8.1138972,59.484287 31.044802,41.206943 18.540073,40.007724 C 24.163438,26.379894 38.59788,11.662388 53.686194,8.5194431 56.908693,7.8481862 60.45821,7.3123197 63.862041,7.4453147 c 0,0 -0.0094,-3.1734682 -0.01877,-7.21884021 -0.947752,-0.030357 -1.897966,-0.038992 -2.846876,-0.023437 z m 2.865647,7.24227771 c 3.40383,-0.132995 6.956636,0.4028716 10.179135,1.0741284 15.088313,3.1429449 29.522754,17.8604509 35.146114,31.4882809 l -12.502866,1.199219 22.930896,18.277344 8.22699,-29.736328 -10.03088,7.558594 C 110.35586,18.181529 96.378506,4.5513978 75.24748,0.98233389 71.4839,0.34665889 67.634281,0.10504749 63.84327,0.22647449 63.83387,4.2718465 63.86204,7.4453147 63.862041,7.4453147 Z"
sodipodi:nodetypes="sscccccsccscscccccscc" />
</g>
<path
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.267085px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 78.712585,37.789626 -12.678895,0.162859 0.170444,72.108875 12.272786,0.0485 -15.328336,17.45021 -15.217299,-17.49634 12.160556,-0.10731 0.126255,-72.06728 -12.556319,0.13651 15.800751,-17.576041 z"
id="path815"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -57,6 +57,8 @@ void VPGraphicsSheet::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
painter->setPen(pen); painter->setPen(pen);
painter->setBrush(noBrush); painter->setBrush(noBrush);
QRectF sheetRect = GetSheetRect();
if(m_showMargin) if(m_showMargin)
{ {
painter->drawRect(GetMarginsRect()); painter->drawRect(GetMarginsRect());
@ -67,10 +69,41 @@ void VPGraphicsSheet::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
pen.setColor(Qt::black); pen.setColor(Qt::black);
painter->setPen(pen); painter->setPen(pen);
painter->drawRect(GetSheetRect()); painter->drawRect(sheetRect);
} }
m_boundingRect = GetSheetRect(); if(m_sheet->GetShowGrid())
{
pen.setColor(QColor(204,204,204));
painter->setPen(pen);
qreal colWidth = m_sheet->GetGridColWidth();
if(colWidth > 0)
{
qreal colX = colWidth;
while (colX < sheetRect.right())
{
QLineF line = QLineF(colX, 0, colX, sheetRect.bottom());
painter->drawLine(line);
colX += colWidth;
}
}
qreal rowHeight = m_sheet->GetGridRowHeight();
if(rowHeight > 0)
{
qreal rowY = rowHeight;
while (rowY < sheetRect.bottom())
{
QLineF line = QLineF(0, rowY, sheetRect.right(), rowY);
painter->drawLine(line);
rowY += rowHeight;
}
}
}
m_boundingRect = sheetRect;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -116,7 +149,6 @@ void VPGraphicsSheet::SetShowBorder(bool value)
m_showBorder = value; m_showBorder = value;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QRectF VPGraphicsSheet::boundingRect() const QRectF VPGraphicsSheet::boundingRect() const
{ {

View File

@ -48,19 +48,17 @@ public:
QRectF GetMarginsRect() const; QRectF GetMarginsRect() const;
/** /**
* @brief ShowMargin Sets Wether we see the margin * @brief SetShowMargin Sets Wether we see the margin
* @param value true to show the margin * @param value true to show the margin
*/ */
void SetShowMargin(bool value); void SetShowMargin(bool value);
/** /**
* @brief ShowBorder Sets whether we see the border of the sheet * @brief SetShowBorder Sets whether we see the border of the sheet
* @param value true to show the border * @param value true to show the border
*/ */
void SetShowBorder(bool value); void SetShowBorder(bool value);
private: private:
Q_DISABLE_COPY(VPGraphicsSheet) Q_DISABLE_COPY(VPGraphicsSheet)

View File

@ -95,6 +95,9 @@ void VPMainGraphicsView::PrepareForExport()
m_graphicsSheet->SetShowBorder(false); m_graphicsSheet->SetShowBorder(false);
m_graphicsSheet->SetShowMargin(false); m_graphicsSheet->SetShowMargin(false);
m_showGridTmp = m_layout->GetFocusedSheet()->GetShowGrid();
m_layout->GetFocusedSheet()->SetShowGrid(false);
m_showTilesTmp = m_layout->GetShowTiles(); m_showTilesTmp = m_layout->GetShowTiles();
m_layout->SetShowTiles(false); m_layout->SetShowTiles(false);
@ -107,6 +110,8 @@ void VPMainGraphicsView::CleanAfterExport()
m_graphicsSheet->SetShowBorder(true); m_graphicsSheet->SetShowBorder(true);
m_graphicsSheet->SetShowMargin(true); m_graphicsSheet->SetShowMargin(true);
m_layout->GetFocusedSheet()->SetShowGrid(m_showGridTmp);
m_layout->SetShowTiles(m_showTilesTmp); m_layout->SetShowTiles(m_showTilesTmp);
RefreshLayout(); RefreshLayout();

View File

@ -112,6 +112,11 @@ private:
*/ */
bool m_showTilesTmp{false}; bool m_showTilesTmp{false};
/**
* variable to hold temporarly hte value of the show grid
*/
bool m_showGridTmp{false};
}; };
#endif // VPMAINGRAPHICSVIEW_H #endif // VPMAINGRAPHICSVIEW_H

View File

@ -65,7 +65,7 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent) :
// create a standard sheet // create a standard sheet
VPSheet *sheet = new VPSheet(m_layout); VPSheet *sheet = new VPSheet(m_layout);
sheet->SetName(QObject::tr("Sheet #1")); sheet->SetName(QObject::tr("Sheet 1"));
m_layout->AddSheet(sheet); m_layout->AddSheet(sheet);
m_layout->SetFocusedSheet(); m_layout->SetFocusedSheet();
@ -82,7 +82,7 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent) :
m_layout->SetTilesSizeConverted(21,29.7); m_layout->SetTilesSizeConverted(21,29.7);
m_layout->SetTilesOrientation(PageOrientation::Portrait); m_layout->SetTilesOrientation(PageOrientation::Portrait);
m_layout->SetTilesMarginsConverted(1,1,1,1); m_layout->SetTilesMarginsConverted(1,1,1,1);
m_layout->SetShowTiles(true); // m_layout->SetShowTiles(true);
// -------------------------------------------------------- // --------------------------------------------------------
@ -509,6 +509,11 @@ void VPMainWindow::SetPropertyTabSheetData()
SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetMarginRight, margins.right()); SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetMarginRight, margins.right());
SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetMarginBottom, margins.bottom()); SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetMarginBottom, margins.bottom());
// set placement grid
SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetGridColWidth, m_layout->GetFocusedSheet()->GetGridColWidthConverted());
SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetGridRowHeight, m_layout->GetFocusedSheet()->GetGridRowHeightConverted());
SetCheckBoxValue(ui->checkBoxSheetShowGrid, m_layout->GetFocusedSheet()->GetShowGrid());
// set pieces gap // set pieces gap
SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetPiecesGap, m_layout->GetFocusedSheet()->GetPiecesGapConverted()); SetDoubleSpinBoxValue(ui->doubleSpinBoxSheetPiecesGap, m_layout->GetFocusedSheet()->GetPiecesGapConverted());
@ -779,7 +784,7 @@ void VPMainWindow::generateTiledPdf(QString fileName)
printer->setOutputFileName(fileName); printer->setOutputFileName(fileName);
printer->setResolution(static_cast<int>(PrintDPI)); printer->setResolution(static_cast<int>(PrintDPI));
printer->setDocName("Test"); // FIXME printer->setDocName(m_layout->GetFocusedSheet()->GetName());
// ------------- Set up the painter // ------------- Set up the painter
QPainter painter; QPainter painter;
@ -1150,6 +1155,27 @@ void VPMainWindow::on_SheetMarginChanged()
m_graphicsView->RefreshLayout(); m_graphicsView->RefreshLayout();
} }
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_checkBoxSheetShowGrid_toggled(bool checked)
{
m_layout->GetFocusedSheet()->SetShowGrid(checked);
m_graphicsView->RefreshLayout();
}
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_doubleSpinBoxSheetGridColWidth_valueChanged(double value)
{
m_layout->GetFocusedSheet()->SetGridColWidthConverted(value);
m_graphicsView->RefreshLayout();
}
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_doubleSpinBoxSheetGridRowHeight_valueChanged(double value)
{
m_layout->GetFocusedSheet()->SetGridRowHeightConverted(value);
m_graphicsView->RefreshLayout();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_comboBoxTilesTemplate_currentIndexChanged(int index) void VPMainWindow::on_comboBoxTilesTemplate_currentIndexChanged(int index)
{ {
@ -1253,7 +1279,7 @@ void VPMainWindow::on_pushButtonTilesExport_clicked()
QString dir = QDir::homePath(); QString dir = QDir::homePath();
QString filters(tr("PDF Files") + QLatin1String("(*.pdf)")); QString filters(tr("PDF Files") + QLatin1String("(*.pdf)"));
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"),
dir + QLatin1String("/") + tr("Layout") + QLatin1String(".pdf"), dir + QLatin1String("/") + m_layout->GetFocusedSheet()->GetName() + QLatin1String(".pdf"),
filters, nullptr filters, nullptr
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
, QFileDialog::DontUseNativeDialog , QFileDialog::DontUseNativeDialog
@ -1323,7 +1349,7 @@ void VPMainWindow::on_pushButtonSheetExport_clicked()
QString dir = QDir::homePath(); QString dir = QDir::homePath();
QString filters(tr("SVG Files") + QLatin1String("(*.svg)")); QString filters(tr("SVG Files") + QLatin1String("(*.svg)"));
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"),
dir + QLatin1String("/") + tr("Layout") + QLatin1String(".svg"), dir + QLatin1String("/") + m_layout->GetFocusedSheet()->GetName() + QLatin1String(".svg"),
filters, nullptr filters, nullptr
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
, QFileDialog::DontUseNativeDialog , QFileDialog::DontUseNativeDialog
@ -1341,7 +1367,7 @@ void VPMainWindow::on_pushButtonSheetExport_clicked()
generator.setFileName(fileName); generator.setFileName(fileName);
generator.setSize(QSize(qFloor(s.width()),qFloor(s.height()))); generator.setSize(QSize(qFloor(s.width()),qFloor(s.height())));
generator.setViewBox(r); generator.setViewBox(r);
generator.setTitle(tr("Pattern")); generator.setTitle(m_layout->GetFocusedSheet()->GetName());
generator.setDescription(m_layout->GetDescription().toHtmlEscaped()); generator.setDescription(m_layout->GetDescription().toHtmlEscaped());
generator.setResolution(static_cast<int>(PrintDPI)); generator.setResolution(static_cast<int>(PrintDPI));
@ -1376,6 +1402,42 @@ void VPMainWindow::on_checkBoxCurrentPieceMirrorPiece_toggled(bool checked)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_pushButtonCurrentPieceRotate90Anticlockwise_clicked()
{
if(m_selectedPieces.count() == 1)
{
m_selectedPieces.first()->RotateBy(90);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_pushButtonCurrentPieceRotate90Clockwise_clicked()
{
if(m_selectedPieces.count() == 1)
{
m_selectedPieces.first()->RotateBy(-90);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_pushButtonCurrentPieceRotateGrainlineVertical_clicked()
{
if(m_selectedPieces.count() == 1)
{
m_selectedPieces.first()->RotateToGrainline(90, true);
}
}
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_pushButtonCurrentPieceRotateGrainlineHorizontal_clicked()
{
if(m_selectedPieces.count() == 1)
{
m_selectedPieces.first()->RotateToGrainline(0, true);
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::on_doubleSpinBoxCurrentPieceAngle_valueChanged(double value) void VPMainWindow::on_doubleSpinBoxCurrentPieceAngle_valueChanged(double value)
{ {

View File

@ -326,6 +326,29 @@ private slots:
*/ */
void on_SheetMarginChanged(); void on_SheetMarginChanged();
/**
* @brief on_checkBoxSheetShowGrid_toggled When the checkbox "show grid" is
* clicked
* @param checked
*/
void on_checkBoxSheetShowGrid_toggled(bool checked);
/**
* @brief on_doubleSpinBoxSheetGridColWidth_valueChanged When the "grid placement
* column width" value is changed in the layout property tab.
* The slot is automatically connected through name convention.
* @param value the new value of the grid placement column width
*/
void on_doubleSpinBoxSheetGridColWidth_valueChanged(double value);
/**
* @brief on_doubleSpinBoxSheetGridRowHeight_valueChanged When the "grid placement
* row height" value is changed in the layout property tab.
* The slot is automatically connected through name convention.
* @param value the new value of the grid placement row height
*/
void on_doubleSpinBoxSheetGridRowHeight_valueChanged(double value);
/** /**
* @brief LayoutFollowGrainlineChanged When one of the radio boxes for the * @brief LayoutFollowGrainlineChanged When one of the radio boxes for the
* "Follow grainline" has been clicked in the sheet property tab. * "Follow grainline" has been clicked in the sheet property tab.
@ -370,7 +393,7 @@ private slots:
/** /**
* @brief on_checkBoxTilesShowTiles_toggled When the checkbox "show tiles" is * @brief on_checkBoxTilesShowTiles_toggled When the checkbox "show tiles" is
* clicked * clicked
* @param checked´ * @param checked
*/ */
void on_checkBoxTilesShowTiles_toggled(bool checked); void on_checkBoxTilesShowTiles_toggled(bool checked);
@ -428,6 +451,30 @@ private slots:
*/ */
void on_checkBoxCurrentPieceMirrorPiece_toggled(bool checked); void on_checkBoxCurrentPieceMirrorPiece_toggled(bool checked);
/**
* @brief on_pushButtonCurrentPieceRotate90Antilockwise_clicked When the 90
* anticlockwise angle button is clicked
*/
void on_pushButtonCurrentPieceRotate90Anticlockwise_clicked();
/**
* @brief on_pushButtonCurrentPieceRotate90Clockwise_clicked When the 90
* clockwise angle button is clicked
*/
void on_pushButtonCurrentPieceRotate90Clockwise_clicked();
/**
* @brief on_pushButtonCurrentPieceRotateGrainlineVertical_clicked
* When the grainline vertical angle button is clicked
*/
void on_pushButtonCurrentPieceRotateGrainlineVertical_clicked();
/**
* @brief on_pushButtonCurrentPieceRotateGrainlineHorizontal_clicked
* When the grainline horizontal angle button is clicked
*/
void on_pushButtonCurrentPieceRotateGrainlineHorizontal_clicked();
/** /**
* @brief on_doubleSpinBoxCurrentPieceAngle_valueChanged When the * @brief on_doubleSpinBoxCurrentPieceAngle_valueChanged When the
* "Current Piece Angle" value in the current piece property is changed * "Current Piece Angle" value in the current piece property is changed

View File

@ -17,6 +17,9 @@
<iconset resource="share/resources/puzzleicon.qrc"> <iconset resource="share/resources/puzzleicon.qrc">
<normaloff>:/puzzleicon/64x64/logo.png</normaloff>:/puzzleicon/64x64/logo.png</iconset> <normaloff>:/puzzleicon/64x64/logo.png</normaloff>:/puzzleicon/64x64/logo.png</iconset>
</property> </property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<widget class="QWidget" name="centralWidget"> <widget class="QWidget" name="centralWidget">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@ -176,7 +179,7 @@
<enum>QTabWidget::Rounded</enum> <enum>QTabWidget::Rounded</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -234,7 +237,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>342</width> <width>342</width>
<height>1318</height> <height>1370</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
@ -359,14 +362,14 @@
<string>Rotation</string> <string>Rotation</string>
</property> </property>
<layout class="QFormLayout" name="formLayout_5"> <layout class="QFormLayout" name="formLayout_5">
<item row="0" column="0"> <item row="2" column="0">
<widget class="QLabel" name="labelCurrentPieceAngle"> <widget class="QLabel" name="labelCurrentPieceAngle">
<property name="text"> <property name="text">
<string>Angle:</string> <string>Angle:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="2" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxCurrentPieceAngle"> <widget class="QDoubleSpinBox" name="doubleSpinBoxCurrentPieceAngle">
<property name="maximum"> <property name="maximum">
<double>360.000000000000000</double> <double>360.000000000000000</double>
@ -376,6 +379,90 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayoutCurrentPieceAngleShortcuts">
<item>
<widget class="QPushButton" name="pushButtonCurrentPieceRotate90Clockwise">
<property name="toolTip">
<string>Rotate the piece by 90° clockwise</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="share/resources/puzzleicon.qrc">
<normaloff>:/puzzleicon/64x64/iconRotate90Clockwise.png</normaloff>:/puzzleicon/64x64/iconRotate90Clockwise.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonCurrentPieceRotate90Anticlockwise">
<property name="toolTip">
<string>Rotate the piece by 90° anti-clockwise</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="share/resources/puzzleicon.qrc">
<normaloff>:/puzzleicon/64x64/iconRotate90Anticlockwise.png</normaloff>:/puzzleicon/64x64/iconRotate90Anticlockwise.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonCurrentPieceRotateGrainlineVertical">
<property name="toolTip">
<string>Rotate the piece so that the grainline is vertical</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="share/resources/puzzleicon.qrc">
<normaloff>:/puzzleicon/64x64/iconRotateGrainlineVertical.png</normaloff>:/puzzleicon/64x64/iconRotateGrainlineVertical.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonCurrentPieceRotateGrainlineHorizontal">
<property name="toolTip">
<string>Rotate the piece so that the grainline is horizontal</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="share/resources/puzzleicon.qrc">
<normaloff>:/puzzleicon/64x64/iconRotateGrainlineHorizontal.png</normaloff>:/puzzleicon/64x64/iconRotateGrainlineHorizontal.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -565,7 +652,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>342</width> <width>342</width>
<height>731</height> <height>870</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
@ -803,6 +890,49 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBoxSheetGrid">
<property name="title">
<string>Placement Grid</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_21">
<item>
<layout class="QFormLayout" name="formLayout_9">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxSheetShowGrid">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Show Grid</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelSheetGridColWidth">
<property name="text">
<string>Column width</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxSheetGridColWidth"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelSheetGridRowHeight">
<property name="text">
<string>Row height</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxSheetGridRowHeight"/>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="groupBoxSheetControl"> <widget class="QGroupBox" name="groupBoxSheetControl">
<property name="title"> <property name="title">

View File

@ -136,6 +136,31 @@ void VPPiece::SetRotation(qreal angle)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VPPiece::RotateBy(qreal angle)
{
SetRotation(m_pieceAngle + angle);
}
//---------------------------------------------------------------------------------------------------------------------
void VPPiece::RotateToGrainline(qreal angleOfGrainline, bool add180IfAlreadyInPosition)
{
qreal newAngle = -GrainlineAngle() + angleOfGrainline;
if(newAngle < 0)
{
newAngle += 360;
}
if(not VFuzzyComparePossibleNulls(m_pieceAngle, newAngle))
{
SetRotation(newAngle);
}
else if(add180IfAlreadyInPosition)
{
newAngle += 180;
SetRotation(newAngle);
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
qreal VPPiece::GetRotation() qreal VPPiece::GetRotation()

View File

@ -95,6 +95,23 @@ public:
*/ */
qreal GetRotation(); qreal GetRotation();
/**
* @brief rotateBy adds the given angle to the current rotation (anti-clockwise)
* @param angle the angle to add
*/
void RotateBy(qreal angle);
/**
* @brief RotateToGrainline rotates the piece, so that the grainline has
* the given angle
*
* @param angleOfGrainline
* @param add180IfAlreadyInPosition, automatically adds 180, if the piece is
* already in the grainline position
*/
void RotateToGrainline(qreal angleOfGrainline, bool add180IfAlreadyInPosition = false);
/** /**
* @brief SetIsSelected Sets wether the piece is selected * @brief SetIsSelected Sets wether the piece is selected
* @param value true if the piece is selected * @param value true if the piece is selected
@ -153,7 +170,6 @@ private:
QVector<QPointF> m_grainline{QVector<QPointF>()}; QVector<QPointF> m_grainline{QVector<QPointF>()};
bool m_isGrainlineEnabled{false}; bool m_isGrainlineEnabled{false};
qreal m_grainlineAngle{0};
// for now separate the position of the piece to the matrix coming from vlayoutpiece // for now separate the position of the piece to the matrix coming from vlayoutpiece
// because it's difficult to have the origin of the piece by (0,0) // because it's difficult to have the origin of the piece by (0,0)

View File

@ -467,3 +467,64 @@ void VPSheet::ClearSelection()
{ {
m_pieceList->ClearSelection(); m_pieceList->ClearSelection();
} }
//---------------------------------------------------------------------------------------------------------------------
bool VPSheet::GetShowGrid()
{
return m_showGrid;
}
//---------------------------------------------------------------------------------------------------------------------
void VPSheet::SetShowGrid(bool value)
{
m_showGrid = value;
}
//---------------------------------------------------------------------------------------------------------------------
qreal VPSheet::GetGridColWidth() const
{
return m_gridColWidth;
}
//---------------------------------------------------------------------------------------------------------------------
qreal VPSheet::GetGridColWidthConverted() const
{
return UnitConvertor(m_gridColWidth, Unit::Px, m_layout->GetUnit());
}
//---------------------------------------------------------------------------------------------------------------------
void VPSheet::SetGridColWidth(qreal value)
{
m_gridColWidth = value;
}
//---------------------------------------------------------------------------------------------------------------------
void VPSheet::SetGridColWidthConverted(qreal value)
{
m_gridColWidth = UnitConvertor(value, m_layout->GetUnit(), Unit::Px);
}
//---------------------------------------------------------------------------------------------------------------------
qreal VPSheet::GetGridRowHeight() const
{
return m_gridRowHeight;
}
//---------------------------------------------------------------------------------------------------------------------
qreal VPSheet::GetGridRowHeightConverted() const
{
return UnitConvertor(m_gridRowHeight, Unit::Px, m_layout->GetUnit());
}
//---------------------------------------------------------------------------------------------------------------------
void VPSheet::SetGridRowHeight(qreal value)
{
m_gridRowHeight = value;
}
//---------------------------------------------------------------------------------------------------------------------
void VPSheet::SetGridRowHeightConverted(qreal value)
{
m_gridRowHeight = UnitConvertor(value, m_layout->GetUnit(), Unit::Px);
}

View File

@ -268,6 +268,70 @@ public:
*/ */
void ClearSelection(); void ClearSelection();
/**
* @brief GetShowGrid Returns true if the placement grid has to be shown on the current sheet
* @return
*/
bool GetShowGrid();
/**
* @brief SetShowGrid Returns true if the placement grid has to be shown on the current sheet
* @param value whether to show the grid or not
*/
void SetShowGrid(bool value);
/**
* @brief GetGridColWidth returns the placement grid column width in Unit::Px
* @return the placement grid column width in Unit::Px
*/
qreal GetGridColWidth() const;
/**
* @brief GetGridColWidth returns the placement grid column width in the layout's unit
* @return the placement grid column width in the layout's unit
*/
qreal GetGridColWidthConverted() const;
/**
* @brief SetGridColWidth sets the placement grid column width to the given value, the unit has to be Unit::Px
* @param value the placement grid column width in Unit::Px
*/
void SetGridColWidth(qreal value);
/**
* @brief SetGridColWidthConverted sets the placement grid column width to the given value, the unit has to be in the layout's unit
* @param value the placement grid column width in the layout's unit
*/
void SetGridColWidthConverted(qreal value);
/**
* @brief GetGridRowHeight returns the placement grid row height in Unit::Px
* @return the placement grid row height in Unit::Px
*/
qreal GetGridRowHeight() const;
/**
* @brief GetGridRowHeightConverted returns the placement grid row height in the layout's unit
* @return the placement grid row height in the layout's unit
*/
qreal GetGridRowHeightConverted() const;
/**
* @brief SetGridRowHeight sets the placement grid row height to the given value, the unit has to be Unit::Px
* @param value the placement grid row height in Unit::Px
*/
void SetGridRowHeight(qreal value);
/**
* @brief SetGridRowHeightConverted sets the placement grid row height to the given value, the unit has to be in the layout's unit
* @param value the placement grid row height in the layout's unit
*/
void SetGridRowHeightConverted(qreal value);
void SetStickyEdges(bool state); void SetStickyEdges(bool state);
bool GetStickyEdges() const; bool GetStickyEdges() const;
@ -305,6 +369,21 @@ private:
*/ */
qreal m_piecesGap{0}; qreal m_piecesGap{0};
// placement grid
/**
* @brief GetShowGrid Returns true if the placement grid has to be shown on the current sheet
*/
bool m_showGrid{false};
/**
* @brief m_gridColWidth the column width of the placement grid in Unit::Px
*/
qreal m_gridColWidth{0};
/**
* @brief m_gridRowHeight the row height of the placement grid in Unit::Px
*/
qreal m_gridRowHeight{0};
bool m_stickyEdges{false}; bool m_stickyEdges{false};
}; };