Changeset View
Changeset View
Standalone View
Standalone View
tools/polygonal/kpToolCurve.cpp
Show First 20 Lines • Show All 103 Lines • ▼ Show 20 Line(s) | 102 | : kpToolPolygonalBase ( | |||
---|---|---|---|---|---|
104 | i18n ("Draws curves"), | 104 | i18n ("Draws curves"), | ||
105 | &::DrawCurveShape, | 105 | &::DrawCurveShape, | ||
106 | Qt::Key_V, | 106 | Qt::Key_V, | ||
107 | environ, parent, | 107 | environ, parent, | ||
108 | "tool_curve") | 108 | "tool_curve") | ||
109 | { | 109 | { | ||
110 | } | 110 | } | ||
111 | 111 | | |||
112 | kpToolCurve::~kpToolCurve () | 112 | kpToolCurve::~kpToolCurve () = default; | ||
113 | { | | |||
114 | } | | |||
115 | 113 | | |||
116 | 114 | | |||
117 | // protected virtual [base kpToolPolygonalBase] | 115 | // protected virtual [base kpToolPolygonalBase] | ||
118 | QString kpToolCurve::haventBegunShapeUserMessage () const | 116 | QString kpToolCurve::haventBegunShapeUserMessage () const | ||
119 | { | 117 | { | ||
120 | return i18n ("Drag out the start and end points."); | 118 | return i18n ("Drag out the start and end points."); | ||
121 | } | 119 | } | ||
122 | 120 | | |||
123 | 121 | | |||
124 | // protected virtual [base kpToolPolygonalBase] | 122 | // protected virtual [base kpToolPolygonalBase] | ||
125 | bool kpToolCurve::drawingALine () const | 123 | bool kpToolCurve::drawingALine () const | ||
126 | { | 124 | { | ||
127 | // On the initial drag (consisting of 2 points) creates a line. | 125 | // On the initial drag (consisting of 2 points) creates a line. | ||
128 | // Future drags are for control points. | 126 | // Future drags are for control points. | ||
129 | return (points ()->count () == 2); | 127 | return (points ()->count () == 2); | ||
130 | } | 128 | } | ||
131 | 129 | | |||
132 | 130 | | |||
133 | // public virtual [base kpTool] | 131 | // public virtual [base kpTool] | ||
134 | void kpToolCurve::endDraw (const QPoint &, const QRect &) | 132 | void kpToolCurve::endDraw (const QPoint &, const QRect &) | ||
135 | { | 133 | { | ||
136 | qCDebug(kpLogTools) << "kpToolCurve::endDraw() points=" | 134 | qCDebug(kpLogTools) << "kpToolCurve::endDraw() points=" | ||
137 | << points ()->toList () << endl; | 135 | << points ()->toList (); | ||
138 | 136 | | |||
139 | switch (points ()->count ()) | 137 | switch (points ()->count ()) | ||
140 | { | 138 | { | ||
141 | // A click of the other mouse button (to finish shape, instead of adding | 139 | // A click of the other mouse button (to finish shape, instead of adding | ||
142 | // another control point) would have caused endShape() to have been | 140 | // another control point) would have caused endShape() to have been | ||
143 | // called in kpToolPolygonalBase::beginDraw(). The points list would now | 141 | // called in kpToolPolygonalBase::beginDraw(). The points list would now | ||
144 | // be empty. We are being called by kpTool::mouseReleaseEvent(). | 142 | // be empty. We are being called by kpTool::mouseReleaseEvent(). | ||
145 | case 0: | 143 | case 0: | ||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |