Skip to content

Commit

Permalink
ticket:4490 Use cosmetic pen for correct scaling and zooming effects
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Oct 11, 2017
1 parent da6dc6c commit 47db56e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions OMEdit/OMEditGUI/Annotations/ShapeAnnotation.cpp
Expand Up @@ -484,6 +484,14 @@ QRectF ShapeAnnotation::getBoundingRect() const
void ShapeAnnotation::applyLinePattern(QPainter *painter)
{
qreal thickness = Utilities::convertMMToPixel(mLineThickness);
/* Ticket #4490
* The specification doesn't say anything about it.
* But just to keep this consist with Dymola set a default line thickness for border patterns raised & sunken.
* We need better handling of border patterns.
*/
if (mBorderPattern == StringHandler::BorderRaised || mBorderPattern == StringHandler::BorderSunken) {
thickness = Utilities::convertMMToPixel(0.25);
}
QPen pen(mLineColor, thickness, StringHandler::getLinePatternType(mLinePattern), Qt::SquareCap, Qt::MiterJoin);
/* The specification doesn't say anything about it.
* But just to keep this consist with Dymola we use Qt::BevelJoin for Line shapes.
Expand All @@ -493,12 +501,9 @@ void ShapeAnnotation::applyLinePattern(QPainter *painter)
pen.setJoinStyle(Qt::BevelJoin);
}
/* Ticket #3222
* Make all the shapes use cosmetic pens so that they perserve their pen widht when scaled i.e zoomed in/out.
* Only shapes with border patterns raised & sunken don't use cosmetic pens. We need better handling of border patterns.
* Make all the shapes use cosmetic pens so that they perserve their pen width when scaled i.e zoomed in/out.
*/
if (mBorderPattern != StringHandler::BorderRaised && mBorderPattern != StringHandler::BorderSunken) {
pen.setCosmetic(true);
}
pen.setCosmetic(true);
/* Ticket #2272, Ticket #2268.
* 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.
*/
Expand Down

0 comments on commit 47db56e

Please sign in to comment.