@@ -82,10 +82,14 void LineChartItem::updateGeometry() | |||||
82 | } |
|
82 | } | |
83 |
|
83 | |||
84 | m_linePath=linePath; |
|
84 | m_linePath = linePath; | |
|
85 | ||||
85 | QPainterPathStroker stroker; |
|
86 | QPainterPathStroker stroker; | |
|
87 | // QPainter::drawLine does not respect join styles, for example BevelJoin becomes MiterJoin. | |||
|
88 | // This is why we are prepared for the "worst case" scenario, i.e. use always MiterJoin and | |||
|
89 | // multiply line width with square root of two when defining shape and bounding rectangle. | |||
86 | stroker.setWidth(m_linePen.width()*1.42); |
|
90 | stroker.setWidth(m_linePen.width() * 1.42); | |
87 |
stroker.setJoinStyle( |
|
91 | stroker.setJoinStyle(Qt::MiterJoin); | |
88 |
stroker.setCapStyle( |
|
92 | stroker.setCapStyle(Qt::SquareCap); | |
89 | stroker.setMiterLimit(m_linePen.miterLimit()); |
|
93 | stroker.setMiterLimit(m_linePen.miterLimit()); | |
90 |
|
94 | |||
91 | prepareGeometryChange(); |
|
95 | prepareGeometryChange(); | |
@@ -109,6 +113,7 void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt | |||||
109 | Q_UNUSED(widget) |
|
113 | Q_UNUSED(widget) | |
110 | Q_UNUSED(option) |
|
114 | Q_UNUSED(option) | |
111 |
|
115 | |||
|
116 | ||||
112 | painter->setPen(m_linePen); |
|
117 | painter->setPen(m_linePen); | |
113 |
|
118 | |||
114 | painter->setBrush(m_linePen.color()); |
|
119 | painter->setBrush(m_linePen.color()); |
General Comments 0
You need to be logged in to leave comments.
Login now