Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Fix drawing of RemoveGutterStrategy

Agata Cacko7d2763c0abf7
diff --git a/plugins/tools/tool_knife/RemoveGutterStrategy.cpp b/plugins/tools/tool_knife/RemoveGutterStrategy.cpp
index 8b37759093..beef2cc15f 100644
--- a/plugins/tools/tool_knife/RemoveGutterStrategy.cpp
+++ b/plugins/tools/tool_knife/RemoveGutterStrategy.cpp
@@ -361,8 +361,30 @@ void RemoveGutterStrategy::finishInteraction(Qt::KeyboardModifiers modifiers)
void RemoveGutterStrategy::paint(QPainter &painter, const KoViewConverter &converter)
{
painter.save();
- painter.setPen(QPen(QBrush(Qt::black), 5));
- painter.drawLine(converter.documentToView().map(QLineF(m_startPoint, m_endPoint)));
+ painter.setPen(QPen(QBrush(Qt::darkGray), 2));
+
+ QLineF line = converter.documentToView().map(QLineF(m_startPoint, m_endPoint));
+ if (line.length() > 0) {
+ QPointF vector = line.p2() - line.p1();
+ vector = vector/line.length();
+ int arrowLength = 20;
+ int arrowThickness = 10;
+
+ QPointF before = line.p1() - vector*arrowLength;
+ QPointF after = line.p2() + vector*arrowLength;
+
+ QPointF perpendicular = QPointF(vector.y(), -vector.x());
+
+ painter.drawLine(QPointF(before + arrowThickness*perpendicular), line.p1());
+ painter.drawLine(QPointF(before - arrowThickness*perpendicular), line.p1());
+
+ painter.drawLine(QPointF(after + arrowThickness*perpendicular), line.p2());
+ painter.drawLine(QPointF(after - arrowThickness*perpendicular), line.p2());
+
+
+ }
+ painter.drawLine(line);
+
painter.restore();
}