aboutsummaryrefslogtreecommitdiffstats
path: root/PySide/QtCore/glue
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.lima@openbossa.org>2010-04-06 17:02:13 -0300
committerHugo Parente Lima <hugo.lima@openbossa.org>2010-04-06 19:11:16 -0300
commitfa9a91b59e4dee7e289c9711b86525016491e414 (patch)
tree4a2b814703cd483278f2f992982ddcf8699ab867 /PySide/QtCore/glue
parentfc08b8878113645692f65d84e488de8288fa09b7 (diff)
QStrign uses the same hash function of str/unicode objects.
Diffstat (limited to 'PySide/QtCore/glue')
-rw-r--r--PySide/QtCore/glue/qstring_hashfunc.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/PySide/QtCore/glue/qstring_hashfunc.cpp b/PySide/QtCore/glue/qstring_hashfunc.cpp
new file mode 100644
index 000000000..b2fb6a1c9
--- /dev/null
+++ b/PySide/QtCore/glue/qstring_hashfunc.cpp
@@ -0,0 +1,6 @@
+static long QStringCustomHashFunction(const QString& str)
+{
+ QByteArray data = str.toUtf8();
+ Shiboken::AutoDecRef unicodeObj(PyUnicode_DecodeUTF8(data.constData(), data.length(), 0));
+ return unicodeObj->ob_type->tp_hash(unicodeObj);
+}