@@ -473,30 +473,37 @@ QRectF ShapeAnnotation::getBoundingRect() const
473473}
474474
475475/* !
476- Applies the shape line pattern.
477- \param painter - pointer to QPainter
478- */
476+ * \brief ShapeAnnotation::applyLinePattern
477+ * Applies the shape line pattern.
478+ * \param painter - pointer to QPainter
479+ */
479480void ShapeAnnotation::applyLinePattern (QPainter *painter)
480481{
481- qreal thicknessFactor = mLineThickness / 0.5 ;
482- qreal thickness = thicknessFactor < 1 ? 1.0 : thicknessFactor;
482+ qreal thickness = Utilities::convertMMToPixel (mLineThickness );
483483 QPen pen (mLineColor , thickness, StringHandler::getLinePatternType (mLinePattern ), Qt::SquareCap, Qt::MiterJoin);
484+ /* The specification doesn't say anything about it.
485+ * But just to keep this consist with Dymola we use Qt::BevelJoin for Line shapes.
486+ * All other shapes use Qt::MiterJoin
487+ */
488+ if (dynamic_cast <LineAnnotation*>(this )) {
489+ pen.setJoinStyle (Qt::BevelJoin);
490+ }
484491 /* Ticket #3222
485492 * Make all the shapes use cosmetic pens so that they perserve their pen widht when scaled i.e zoomed in/out.
486493 * Only shapes with border patterns raised & sunken don't use cosmetic pens. We need better handling of border patterns.
487494 */
488495 if (mBorderPattern != StringHandler::BorderRaised && mBorderPattern != StringHandler::BorderSunken) {
489496 pen.setCosmetic (true );
490497 }
491- if (mpGraphicsView && mpGraphicsView-> isRenderingLibraryPixmap ()) {
492- /* Ticket #2272, Ticket #2268 .
493- * If thickness is greater than 2 then don't make the pen cosmetic since cosmetic pens don't change the width with respect to zoom.
494- */
495- if (thickness <= 2 ) {
496- pen. setCosmetic ( true );
497- } else {
498- pen. setCosmetic ( false );
499- }
498+ /* Ticket #2272, Ticket #2268.
499+ * If thickness is greater than 2 then don't make the pen cosmetic since cosmetic pens don't change the width with respect to zoom .
500+ */
501+ if (mpGraphicsView && mpGraphicsView-> isRenderingLibraryPixmap () && thickness > 2 ) {
502+ pen. setCosmetic ( false );
503+ }
504+ // if thickness is greater than 1 pixel then use antialiasing.
505+ if (thickness > 1 ) {
506+ painter-> setRenderHint (QPainter::Antialiasing);
500507 }
501508 painter->setPen (pen);
502509}
0 commit comments