summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qtransform.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-04-08 19:44:48 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-04-21 07:28:14 +0000
commit05d16937935ff830c3266c4a8566feed7fe33dbf (patch)
treef4f638666520f1d9c935b5cb21440d83120b76eb /src/gui/painting/qtransform.cpp
parent299350f668b0077bbb11331320eeb843d3feb126 (diff)
Add qHash(QMatrix) and qHash(QTransform)
QMatrix and QTransform can be compared for equality, so qHash should be overloaded, too. [ChangeLog][QtCore][QMatrix] Added qHash(QMatrix). [ChangeLog][QtCore][QTransform] Added qHash(QTransform). Change-Id: I1ce925ebe258c9d7e35b68e5ac5c3373f1460c58 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/gui/painting/qtransform.cpp')
-rw-r--r--src/gui/painting/qtransform.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 31d7a2300b..4b3f0b30dc 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -34,6 +34,7 @@
#include "qdatastream.h"
#include "qdebug.h"
+#include "qhashfunctions.h"
#include "qmatrix.h"
#include "qregion.h"
#include "qpainterpath.h"
@@ -776,6 +777,29 @@ bool QTransform::operator==(const QTransform &o) const
}
/*!
+ \since 5.6
+ \relates QTransform
+
+ Returns the hash value for \a key, using
+ \a seed to seed the calculation.
+*/
+uint qHash(const QTransform &key, uint seed) Q_DECL_NOTHROW
+{
+ QtPrivate::QHashCombine hash;
+ seed = hash(key.m11(), seed);
+ seed = hash(key.m12(), seed);
+ seed = hash(key.m21(), seed);
+ seed = hash(key.m22(), seed);
+ seed = hash(key.dx(), seed);
+ seed = hash(key.dy(), seed);
+ seed = hash(key.m13(), seed);
+ seed = hash(key.m23(), seed);
+ seed = hash(key.m33(), seed);
+ return seed;
+}
+
+
+/*!
\fn bool QTransform::operator!=(const QTransform &matrix) const
Returns \c true if this matrix is not equal to the given \a matrix,
otherwise returns \c false.