Commit e486e22a authored by Martin Koller's avatar Martin Koller
Browse files

code formatting

parent 297feb54
Pipeline #202276 passed with stage
in 3 minutes and 39 seconds
......@@ -40,11 +40,11 @@
//---------------------------------------------------------------------
kpToolRectangle::kpToolRectangle (kpToolEnvironment *environ, QObject *parent)
: kpToolRectangularBase (i18n ("Rectangle"),
i18n ("Draws rectangles and squares"),
&kpToolRectangle::drawRect,
Qt::Key_R,
environ, parent, QStringLiteral("tool_rectangle"))
: kpToolRectangularBase(i18n("Rectangle"),
i18n("Draws rectangles and squares"),
&kpToolRectangle::drawRect,
Qt::Key_R,
environ, parent, QStringLiteral("tool_rectangle"))
{
}
......@@ -55,25 +55,21 @@ void kpToolRectangle::drawRect(kpImage *image,
const kpColor &fcolor, int penWidth,
const kpColor &bcolor)
{
if ( (width == 0) || (height == 0) ) {
if ( (width == 0) || (height == 0) )
return;
}
QPainter painter(image);
painter.setRenderHint(QPainter::Antialiasing, kpToolEnvironment::drawAntiAliased);
if ( ((2 * penWidth) > width) || ((2 * penWidth) > height) ) {
if ( ((2 * penWidth) > width) || ((2 * penWidth) > height) )
penWidth = qMin(width, height) / 2;
}
painter.setPen(QPen(fcolor.toQColor(), penWidth, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin));
if ( bcolor.isValid() ) {
if ( bcolor.isValid() )
painter.setBrush(QBrush(bcolor.toQColor()));
}
else {
else
painter.setBrush(Qt::NoBrush);
}
int offset = painter.testRenderHint(QPainter::Antialiasing) ? 1 : 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment