summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc
diff options
context:
space:
mode:
authorLaszlo Papp <lpapp@kde.org>2012-08-02 07:18:35 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-26 00:09:14 +0100
commite335fb7254ad6c2ce08eda0d092ea524a302c2e0 (patch)
tree0d6eaa362988c4101d0e210dd97ffa0b44f4beb6 /src/corelib/doc
parent5f481c98de872e7c58a17f090be697c241b9f256 (diff)
Add static dotProduct methods to the QPoint(F) classes
Change-Id: I66ac9433b74341a83569a60038ea2f7a025e81b1 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/corelib/doc')
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qpoint.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qpoint.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qpoint.cpp
index a83fd9a71f..8c6751cbaa 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qpoint.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qpoint.cpp
@@ -79,6 +79,13 @@ p *= 2.5; // p becomes (-3, 10)
//! [5]
+//! [16]
+QPoint p( 3, 7);
+QPoint q(-1, 4);
+int lengthSquared = QPoint::dotProduct(p, q); // lengthSquared becomes 25
+//! [16]
+
+
//! [6]
QPoint p(-3, 10);
p /= 2.5; // p becomes (-1, 4)
@@ -147,3 +154,10 @@ p *= 2.5; // p becomes (-2.75, 10.25)
QPointF p(-2.75, 10.25);
p /= 2.5; // p becomes (-1.1, 4.1)
//! [15]
+
+
+//! [17]
+QPointF p( 3.1, 7.1);
+QPointF q(-1.0, 4.1);
+int lengthSquared = QPointF::dotProduct(p, q); // lengthSquared becomes 26.01
+//! [17]