draw rectange if thickness == 0

This commit is contained in:
Eric Blanquer
2020-06-24 00:17:30 +02:00
committed by borgmanJeremy
parent 489769949a
commit b1edf99be1

View File

@@ -60,9 +60,14 @@ void RectangleTool::process(QPainter& painter,
if (recordUndo) {
updateBackup(pixmap);
}
painter.setPen(QPen(m_color, m_thickness));
painter.setPen(QPen(m_color, PADDING_VALUE + m_thickness));
painter.setBrush(QBrush(m_color));
painter.drawRoundedRect(QRect(m_points.first, m_points.second), m_thickness, m_thickness);
if (m_thickness == 0) {
painter.drawRect(QRect(m_points.first, m_points.second));
}
else {
painter.drawRoundedRect(QRect(m_points.first, m_points.second), m_thickness, m_thickness);
}
}
void RectangleTool::paintMousePreview(QPainter& painter,
@@ -75,7 +80,7 @@ void RectangleTool::paintMousePreview(QPainter& painter,
void RectangleTool::drawStart(const CaptureContext& context)
{
m_color = context.color;
m_thickness = context.thickness + PADDING_VALUE;
m_thickness = context.thickness;
m_points.first = context.mousePos;
m_points.second = context.mousePos;
}