Add arrowstyle preference

This commit is contained in:
WandererFan
2017-01-01 14:43:32 -05:00
parent 1bae86f3b1
commit 9822e30224
10 changed files with 449 additions and 12 deletions

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>521</width>
<height>420</height>
<height>463</height>
</rect>
</property>
<property name="windowTitle">
@@ -145,7 +145,7 @@
<x>10</x>
<y>190</y>
<width>501</width>
<height>201</height>
<height>231</height>
</rect>
</property>
<property name="title">
@@ -157,7 +157,7 @@
<x>20</x>
<y>30</y>
<width>471</width>
<height>161</height>
<height>194</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="1,2,1">
@@ -349,6 +349,82 @@
</property>
</spacer>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Arrow Style</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="Gui::PrefComboBox" name="pcbArrow">
<property name="toolTip">
<string>Preferred arrowhead style</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<property name="maxVisibleItems">
<number>5</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>ArrowStyle</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/TechDraw/Decorations</cstring>
</property>
<item>
<property name="text">
<string>0 - Filled Triangle</string>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/arrowfilled.svg</normalon>
</iconset>
</property>
</item>
<item>
<property name="text">
<string>1 - Open Arrowhead</string>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/arrowopen.svg</normalon>
</iconset>
</property>
</item>
<item>
<property name="text">
<string>2 - Tick</string>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/arrowtick.svg</normalon>
</iconset>
</property>
</item>
<item>
<property name="text">
<string>3 - Dot</string>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/arrowdot.svg</normalon>
</iconset>
</property>
</item>
<item>
<property name="text">
<string>4 - Open Circle</string>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/arrowopendot.svg</normalon>
</iconset>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</widget>
@@ -385,6 +461,8 @@
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>
<resources/>
<resources>
<include location="../../../../../Documents/CAD/DrawingModule/Resources/TechDraw.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -52,6 +52,7 @@ void DlgPrefsTechDraw2Imp::saveSettings()
colCenterLine->onSave();
pcbSectionStyle->onSave();
colSectionLine->onSave();
pcbArrow->onSave();
}
void DlgPrefsTechDraw2Imp::loadSettings()
@@ -65,6 +66,7 @@ void DlgPrefsTechDraw2Imp::loadSettings()
colCenterLine->onRestore();
pcbSectionStyle->onRestore();
colSectionLine->onRestore();
pcbArrow->onRestore();
}
/**

View File

@@ -63,11 +63,17 @@ void QGIArrow::flip(bool state) {
void QGIArrow::draw() {
QPainterPath path;
if (m_style == 0) {
path = makeFilledTriangle(m_size,m_size/6.0,isFlipped); //"arrow l/w sb 3/1" ??
path = makeFilledTriangle(m_size,m_size/6.0,isFlipped); //"arrow l/w sb 3/1" ??
} else if (m_style == 1) {
path = makeOpenArrow(m_size,m_size/3.0,isFlipped); //broad arrow?
path = makeOpenArrow(m_size,m_size/3.0,isFlipped); //broad arrow?
} else if (m_style == 2) {
path = makeHashMark(m_size/2.0,m_size/2.0,isFlipped); //big enough?
path = makeHashMark(m_size/2.0,m_size/2.0,isFlipped); //big enough?
} else if (m_style == 3) {
path = makeDot(m_size/2.0,m_size/2.0,isFlipped);
} else if (m_style == 4) {
path = makeOpenDot(m_size/2.0,m_size/2.0,isFlipped);
} else {
path = makeFilledTriangle(m_size,m_size/6.0,isFlipped); //sb a question mark or ???
}
setPath(path);
}
@@ -109,7 +115,7 @@ QPainterPath QGIArrow::makeOpenArrow(double length, double width, bool flipped)
return path;
}
QPainterPath QGIArrow::makeHashMark(double length, double width, bool flipped)
QPainterPath QGIArrow::makeHashMark(double length, double width, bool flipped) //Arch tick
{
double adjWidth = 1.0;
//(0,0) is tip of arrow
@@ -124,6 +130,27 @@ QPainterPath QGIArrow::makeHashMark(double length, double width, bool flipped)
return path;
}
QPainterPath QGIArrow::makeDot(double length, double width, bool flipped) //closed dot
{
Q_UNUSED(flipped);
QPainterPath path;
path.moveTo(0.0,0.0); ////(0,0) is Center of dot
path.addEllipse(Rez::guiX(-length/2.0), Rez::guiX(-width/2.0), Rez::guiX(length), Rez::guiX(width));
m_fill = Qt::SolidPattern;
return path;
}
QPainterPath QGIArrow::makeOpenDot(double length, double width, bool flipped)
{
Q_UNUSED(flipped);
QPainterPath path;
path.moveTo(0.0,0.0); ////(0,0) is Center of dot
path.addEllipse(Rez::guiX(-length/2.0), Rez::guiX(-width/2.0), Rez::guiX(length), Rez::guiX(width));
m_fill = Qt::NoBrush;
return path;
}
int QGIArrow::getPrefArrowStyle()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().

View File

@@ -44,22 +44,21 @@ public:
public:
void draw();
//void setHighlighted(bool state);
void flip(bool state);
double getSize() { return m_size; }
void setSize(double s);
int getStyle() { return m_style; }
void setStyle(int s) { m_style = s; }
//QPainterPath shape() const;
static int getPrefArrowStyle();
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
protected:
//QVariant itemChange(GraphicsItemChange change, const QVariant &value);
QPainterPath makeFilledTriangle(double length, double width, bool flipped);
QPainterPath makeOpenArrow(double length, double width, bool flipped);
QPainterPath makeHashMark(double length, double width, bool flipped);
QPainterPath makeDot(double length, double width, bool flipped);
QPainterPath makeOpenDot(double length, double width, bool flipped);
private:
QBrush m_brush;
@@ -69,6 +68,6 @@ private:
bool isFlipped;
};
} // namespace MDIViewPageGui
}
#endif // DRAWINGGUI_QGRAPHICSITEMARROW_H

View File

@@ -30,6 +30,11 @@
<file>icons/TechDraw_Dimension_Vertical.svg</file>
<file>icons/TechDraw_Dimension_Link.svg</file>
<file>icons/preferences-techdraw.svg</file>
<file>icons/arrowdot.svg</file>
<file>icons/arrowopendot.svg</file>
<file>icons/arrowfilled.svg</file>
<file>icons/arrowopen.svg</file>
<file>icons/arrowtick.svg</file>
<file>icons/actions/techdraw-new-default.svg</file>
<file>icons/actions/techdraw-new-pick.svg</file>
<file>icons/actions/techdraw-view.svg</file>

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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"
version="1.1"
width="48"
height="48"
id="svg4024">
<defs
id="defs4026" />
<metadata
id="metadata4029">
<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>
<g
id="layer1">
<g
transform="translate(-1.0575472,0.61016946)"
id="g4020">
<path
d="m -18.999999,35.857143 a 11.714286,11.428572 0 1 1 -23.428572,0 11.714286,11.428572 0 1 1 23.428572,0 z"
transform="matrix(0.74568413,0,0,0.76432623,53.996092,-4.0167247)"
id="path3769"
style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:6;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:5.4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
width="24.142857"
height="8.7142859"
rx="1.4997782"
ry="1.7378116"
x="6.8774428"
y="19.809925"
id="rect3805"
style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28200001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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"
version="1.1"
width="48"
height="48"
id="svg3942">
<defs
id="defs3944" />
<metadata
id="metadata3947">
<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>
<g
id="layer1">
<g
transform="translate(5.495789,-0.12462666)"
id="g3801">
<rect
width="24.142857"
height="8.7142859"
rx="1.4997782"
ry="1.7378116"
x="2.8571429"
y="19.642857"
id="rect3803"
style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28200001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<g
id="g3938">
<path
d="M 19,31.428572 8.3448741,16.437454 26.655126,14.705404 z"
transform="matrix(0.82772257,0.51753701,-0.59559817,0.71923839,18.136046,-0.16490738)"
id="path2993"
style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:6;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:5.4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
width="24.142857"
height="8.7142859"
rx="1.4997782"
ry="1.7378116"
x="2.8571429"
y="19.642857"
id="rect3805"
style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28200001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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"
version="1.1"
width="48"
height="48"
id="svg2985">
<defs
id="defs2987" />
<metadata
id="metadata2990">
<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>
<g
id="layer1">
<g
transform="translate(3.4375,-0.13060184)"
id="g3807">
<g
id="g3796">
<rect
width="24.142857"
height="8.7142859"
rx="1.4997782"
ry="1.7378116"
x="2.8571429"
y="19.642857"
id="rect3763"
style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28200001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
width="24.142857"
height="8.7142859"
rx="1.4997782"
ry="1.7378116"
x="2.8571429"
y="19.642857"
id="rect3799"
style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28200001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
<rect
width="24.142857"
height="8.7142859"
rx="1.4997782"
ry="1.7378116"
x="17.57655"
y="-10.165521"
transform="matrix(0.70710678,0.70710678,-0.70710678,0.70710678,0,0)"
id="rect3773"
style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28200001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
width="24.142857"
height="8.7142859"
rx="1.4997782"
ry="1.7378116"
x="-16.567656"
y="-44.272964"
transform="matrix(0.70710678,-0.70710678,-0.70710678,-0.70710678,0,0)"
id="rect3775"
style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28200001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<path
d="m 35.392858,21.017857 2.874999,3.071429 -3.035714,3.303571"
id="path3792"
style="color:#000000;fill:#000000;stroke:#000000;stroke-width:0.28200001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<path
d="m 35.200831,24.273314 -0.129031,-0.129898 0.133942,-0.133048 0.133942,-0.133048 0,0.262945 c 0,0.144621 -0.0022,0.262946 -0.0049,0.262946 -0.0027,0 -0.06298,-0.05845 -0.133942,-0.129897 z"
id="path3794"
style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.10714286;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:5.4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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"
version="1.1"
width="48"
height="48"
id="svg3816">
<defs
id="defs3818" />
<metadata
id="metadata3821">
<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>
<g
id="layer1">
<g
transform="translate(3.3580721,4.7683716e-7)"
id="g3801">
<rect
width="24.142857"
height="8.7142859"
rx="1.4997782"
ry="1.7378116"
x="2.8571429"
y="19.642857"
id="rect3803"
style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28200001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
width="24.142857"
height="8.7142859"
rx="1.4997782"
ry="1.7378116"
x="2.8571429"
y="19.642857"
id="rect3805"
style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28200001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
<path
d="m -18.999999,35.857143 a 11.714286,11.428572 0 1 1 -23.428572,0 11.714286,11.428572 0 1 1 23.428572,0 z"
transform="matrix(0.74568413,0,0,0.76432623,54.118369,-3.4065552)"
id="path3771"
style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:6;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:5.4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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"
version="1.1"
width="48"
height="48"
id="svg2985">
<defs
id="defs2987" />
<metadata
id="metadata2990">
<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>
<g
transform="translate(-1.2369402,2.0609187)"
id="g3106">
<g
transform="translate(10.308369,-1.9117699)"
id="g3796">
<rect
width="24.142857"
height="8.7142859"
rx="1.4997782"
ry="1.7378116"
x="2.8571429"
y="19.642857"
id="rect3763"
style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28200001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
width="24.142857"
height="8.7142859"
rx="1.4997782"
ry="1.7378116"
x="2.8571429"
y="19.642857"
id="rect3799"
style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28200001;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
<rect
width="12.071428"
height="4.3571429"
rx="0.74988908"
ry="0.86890578"
x="-0.50094396"
y="31.798487"
transform="matrix(-0.70710678,0.70710678,0.70710678,0.70710678,0,0)"
id="rect3773"
style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.141;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<rect
width="12.071428"
height="4.3571429"
rx="0.74988908"
ry="0.86890578"
x="-17.214378"
y="31.541357"
transform="matrix(-0.70710678,0.70710678,0.70710678,0.70710678,0,0)"
id="rect3104"
style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.141;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB