diff --git a/src/capture/screenshot.cpp b/src/capture/screenshot.cpp index b45631ea..cf6dcc3e 100644 --- a/src/capture/screenshot.cpp +++ b/src/capture/screenshot.cpp @@ -156,6 +156,32 @@ QPixmap Screenshot::paintBaseModifications( return m_modifiedScreenshot; } +QPainterPath getArrowHead(QPoint p1, QPoint p2) { + QLineF body(p1, p2); + int originalLength = body.length(); + body.setLength(10); + // move across the line up to the head + //QPointF = ; + QLineF temp(QPoint(0,0), p2-p1); + temp.setLength(originalLength-20); + QPointF bottonTranslation(temp.p2()); + + // generates the transformation to center the head of the arrow + body.setAngle(body.angle()+90); + QPointF temp2 = p1-body.p2(); + QPointF centerTranslation((temp2.x()/2), (temp2.y()/2)); + + body.translate(bottonTranslation); + body.translate(centerTranslation); + + QPainterPath path; + path.moveTo(p2); + path.lineTo(body.p1()); + path.lineTo(body.p2()); + path.lineTo(p2); + return path; +} + // paintInPainter is an aux method to prevent duplicated code, it draws the // passed modification to the painter. void Screenshot::paintInPainter(QPainter &painter, @@ -165,8 +191,8 @@ void Screenshot::paintInPainter(QPainter &painter, switch (modification.getType()) { case Button::Type::arrow: painter.drawLine(points[0], points[1]); - // TODO - + painter.fillPath(getArrowHead(points[0], points[1]), + QBrush(modification.getColor())); break; case Button::Type::circle: painter.drawEllipse(QRect(points[0], points[1])); @@ -189,7 +215,6 @@ void Screenshot::paintInPainter(QPainter &painter, default: break; } - } void Screenshot::uploadToImgur(QNetworkAccessManager *accessManager,