diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-09-27 19:03:30 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-09-27 19:41:41 -0300 |
commit | 4787f1eb0fd1363536dc64f168d382e6247f1097 (patch) | |
tree | 24c88f68a95c3f46f09a6cde329e7334d1866db1 /PySide | |
parent | 62234b4f86eea914b8bb802f5d5f3c110f5db92a (diff) |
Added hash functions for QLine, QPoint, QRect and QSize classes.
Tests where also added.
Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Reviewed by Renato Araújo <renato.filho@openbossa.org>
Diffstat (limited to 'PySide')
-rw-r--r-- | PySide/QtCore/typesystem_core.xml | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 0eafbb1d7..70e18e538 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -674,7 +674,15 @@ <include file-name="QSize" location="global"/> </extra-includes> </object-type> - <value-type name="QLine"/> + <value-type name="QLine" hash-function="PySide::hash"> + <inject-code class="native" position="beginning"> + namespace PySide { + template<> inline uint hash(const QLine& v) { + return qHash(qMakePair(qMakePair(v.x1(), v.y1()), qMakePair(v.x2(), v.y2()))); + } + }; + </inject-code> + </value-type> <value-type name="QLineF"> <enum-type name="IntersectType" /> <modify-function signature="intersect(QLineF, QPointF*)const"> @@ -756,7 +764,14 @@ <modify-function signature="QDir(QString,QString,QFlags<QDir::SortFlag>,QFlags<QDir::Filter>)" remove="all" /> </value-type> - <value-type name="QPoint"> + <value-type name="QPoint" hash-function="PySide::hash"> + <inject-code class="native" position="beginning"> + namespace PySide { + template<> inline uint hash(const QPoint& v) { + return qHash(qMakePair(v.x(), v.y())); + } + }; + </inject-code> <modify-function signature="rx()" remove="all"/> <modify-function signature="ry()" remove="all"/> </value-type> @@ -764,7 +779,14 @@ <modify-function signature="rx()" remove="all"/> <modify-function signature="ry()" remove="all"/> </value-type> - <value-type name="QRect"> + <value-type name="QRect" hash-function="PySide::hash"> + <inject-code class="native" position="beginning"> + namespace PySide { + template<> inline uint hash(const QRect& v) { + return qHash(qMakePair(qMakePair(v.x(), v.y()), qMakePair(v.width(), v.height()))); + } + }; + </inject-code> <modify-function signature="getCoords(int*,int*,int*,int*)const"> <remove/> </modify-function> @@ -780,7 +802,15 @@ <remove/> </modify-function> </value-type> - <value-type name="QSize"> + + <value-type name="QSize" hash-function="PySide::hash"> + <inject-code class="native" position="beginning"> + namespace PySide { + template<> inline uint hash(const QSize& v) { + return qHash(qMakePair(v.width(), v.height())); + } + }; + </inject-code> <modify-function signature="rheight()" remove="all"/> <modify-function signature="rwidth()" remove="all"/> </value-type> |