Changeset View
Changeset View
Standalone View
Standalone View
tools/polygonal/kpToolPolyline.cpp
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | 71 | { | |||
---|---|---|---|---|---|
72 | (void) bcolor; | 72 | (void) bcolor; | ||
73 | (void) isFinal; | 73 | (void) isFinal; | ||
74 | 74 | | |||
75 | QPainter painter(image); | 75 | QPainter painter(image); | ||
76 | painter.setRenderHint(QPainter::Antialiasing, kpToolEnvironment::drawAntiAliased); | 76 | painter.setRenderHint(QPainter::Antialiasing, kpToolEnvironment::drawAntiAliased); | ||
77 | 77 | | |||
78 | painter.setPen(QPen(fcolor.toQColor(), penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); | 78 | painter.setPen(QPen(fcolor.toQColor(), penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); | ||
79 | 79 | | |||
80 | if ( kpPixmapFX::Only1PixelInPointArray(points) ) | 80 | if ( kpPixmapFX::Only1PixelInPointArray(points) ) { | ||
81 | painter.drawPoint(points[0]); | 81 | painter.drawPoint(points[0]); | ||
82 | else | 82 | } | ||
83 | else { | ||||
83 | painter.drawPolyline(points); | 84 | painter.drawPolyline(points); | ||
84 | } | 85 | } | ||
86 | } | ||||
85 | 87 | | |||
86 | //-------------------------------------------------------------------------------- | 88 | //-------------------------------------------------------------------------------- | ||
87 | 89 | | |||
88 | // public virtual [base kpTool] | 90 | // public virtual [base kpTool] | ||
89 | void kpToolPolyline::endDraw (const QPoint &, const QRect &) | 91 | void kpToolPolyline::endDraw (const QPoint &, const QRect &) | ||
90 | { | 92 | { | ||
91 | #if DEBUG_KP_TOOL_POLYLINE | 93 | #if DEBUG_KP_TOOL_POLYLINE | ||
92 | qCDebug(kpLogTools) << "kpToolPolyline::endDraw() points=" | 94 | qCDebug(kpLogTools) << "kpToolPolyline::endDraw() points=" | ||
93 | << points ()->toList () << endl; | 95 | << points ()->toList (); | ||
94 | #endif | 96 | #endif | ||
95 | 97 | | |||
96 | // A click of the other mouse button (to finish shape, instead of adding | 98 | // A click of the other mouse button (to finish shape, instead of adding | ||
97 | // another control point) would have caused endShape() to have been | 99 | // another control point) would have caused endShape() to have been | ||
98 | // called in kpToolPolygonalBase::beginDraw(). The points list would now | 100 | // called in kpToolPolygonalBase::beginDraw(). The points list would now | ||
99 | // be empty. We are being called by kpTool::mouseReleaseEvent(). | 101 | // be empty. We are being called by kpTool::mouseReleaseEvent(). | ||
100 | if (points ()->count () == 0) | 102 | if (points ()->count () == 0) { | ||
101 | return; | 103 | return; | ||
104 | } | ||||
102 | 105 | | |||
103 | if (points ()->count () >= kpToolPolygonalBase::MaxPoints) | 106 | if (points ()->count () >= kpToolPolygonalBase::MaxPoints) | ||
104 | { | 107 | { | ||
105 | #if DEBUG_KP_TOOL_POLYLINE | 108 | #if DEBUG_KP_TOOL_POLYLINE | ||
106 | qCDebug(kpLogTools) << "\tending shape"; | 109 | qCDebug(kpLogTools) << "\tending shape"; | ||
107 | #endif | 110 | #endif | ||
108 | endShape (); | 111 | endShape (); | ||
109 | return; | 112 | return; | ||
Show All 13 Lines |