[graphics/krita] plugins/tools/basictools: Show angle for line tool

Dmitry Kazakov <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit f75dfcbf5594ebae8a7a245fff9b1016cc230539 by Dmitry Kazakov, on behalf of Moritz Staudinger.
Committed on 17/07/2026 at 10:40.
Pushed by dkazakov into branch 'master'.

Show angle for line tool

M  +5    -1    plugins/tools/basictools/kis_tool_line.cc

https://invent.kde.org/graphics/krita/-/commit/f75dfcbf5594ebae8a7a245fff9b1016cc230539

diff --git a/plugins/tools/basictools/kis_tool_line.cc b/plugins/tools/basictools/kis_tool_line.cc
index cc4485b13b1..e9d5577141e 100644
--- a/plugins/tools/basictools/kis_tool_line.cc
+++ b/plugins/tools/basictools/kis_tool_line.cc
@@ -462,7 +462,11 @@ void KisToolLine::showSize()
 {
     KisCanvas2 *kisCanvas =dynamic_cast<KisCanvas2*>(canvas());
     KIS_ASSERT(kisCanvas);
-    kisCanvas->viewManager()->showFloatingMessage(i18n("Length: %1 px", QString::number(QLineF(m_startPoint,m_endPoint).length(), 'f',1))
+    const QPointF lineVector = m_endPoint - m_startPoint;
+    const qreal angle = std::atan2(qAbs(lineVector.y()), qAbs(lineVector.x())) * 180.0 / M_PI;
+    kisCanvas->viewManager()->showFloatingMessage(i18nc("%1=length in pixels %2=angle in degrees", "Length: %1 px\nAngle: %2°",
+                                                         QString::number(QLineF(m_startPoint,m_endPoint).length(), 'f', 1),
+                                                         QString::number(angle, 'f', 1))
                                                         , QIcon(), 1000, KisFloatingMessage::High,  Qt::AlignLeft | Qt::TextWordWrap | Qt::AlignVCenter);
 }
 void KisToolLine::paintLine(QPainter& gc, const QRect&)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.