Version: HEAD (using KDE KDE 3.5.1) OS: Linux PROBLEM: If the border width specified for a border exceeds the minor or major axis of the ellipse then the border will extend outside of the ellipse. STEPS TO REPRODUCE: Start Kst Draw an ellipse Switch to layout mode Edit the ellipse and set the Border width to 99 Shrink the ellipse until one of its axes is less than the border width RESULTS: The border is drawn outside of the ellipse. If the ellipse is shrunk enough it will look like a box. EXPECTED RESULTS: The border is constrained to lie within the ellipse. If the ellipse is shrunk it should always resemble an ellipse.
Created attachment 20192 [details] Proposed patch
SVN commit 653120 by arwalker: BUG:143805 Limit the border width of an ellipse so it doesn't extend beyond its own edge M +10 -3 kstviewellipse.cpp --- branches/work/kst/1.5/kst/src/libkstapp/kstviewellipse.cpp #653119:653120 @@ -95,15 +95,22 @@ } } - const int bw(_borderWidth * p.lineWidthAdjustmentFactor()); + const QRect g(geometry()); + int bw(_borderWidth * p.lineWidthAdjustmentFactor()); + if (bw > g.width()/2) { + bw = g.width()/2; + } + if (bw > g.height()/2) { + bw = g.height()/2; + } QPen pen(bw > 0 ? _borderColor : _foregroundColor, bw); p.setPen(pen); if (_transparentFill) { - p.setBrush(Qt::NoBrush); + p.setBrush(Qt::NoBrush); } else { p.setBrush(_foregroundColor); } - const QRect g(geometry()); + p.drawEllipse(g.x() + bw/2, g.y() + bw/2, g.width() - bw, g.height() - bw); p.restore(); }