##// END OF EJS Templates
Finetuning shape of line chart item to remove drawing artifacts
Tero Ahola -
r1823:a1c4c93bea9c
parent child
Show More
@@ -82,10 +82,14 void LineChartItem::updateGeometry()
82 82 }
83 83
84 84 m_linePath=linePath;
85
85 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 90 stroker.setWidth(m_linePen.width()*1.42);
87 stroker.setJoinStyle(m_linePen.joinStyle());
88 stroker.setCapStyle(m_linePen.capStyle());
91 stroker.setJoinStyle(Qt::MiterJoin);
92 stroker.setCapStyle(Qt::SquareCap);
89 93 stroker.setMiterLimit(m_linePen.miterLimit());
90 94
91 95 prepareGeometryChange();
@@ -109,6 +113,7 void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
109 113 Q_UNUSED(widget)
110 114 Q_UNUSED(option)
111 115
116
112 117 painter->setPen(m_linePen);
113 118
114 119 painter->setBrush(m_linePen.color());
General Comments 0
You need to be logged in to leave comments. Login now