aboutsummaryrefslogtreecommitdiffstats
path: root/libpyside/pyside.h
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-06-08 17:42:43 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-06-08 18:00:02 -0300
commitbf8a60db4cdbfc3e7c9c98778b219e9c83746d44 (patch)
tree6d7b4c00e220b17fc676d2617158af3e6e1dc021 /libpyside/pyside.h
parentcf6e5f16687a0b28677a5c4ff035eebc5424272d (diff)
Created support to hash objects with type QDate, QTime, QDateTime, QUrl.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>, Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'libpyside/pyside.h')
-rw-r--r--libpyside/pyside.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/libpyside/pyside.h b/libpyside/pyside.h
index 2048265f4..52aeec17e 100644
--- a/libpyside/pyside.h
+++ b/libpyside/pyside.h
@@ -45,6 +45,15 @@ namespace PySide
PYSIDE_API void init(PyObject *module);
/**
+ * Hash function used to enable hash on objects not supported on native Qt library which has toString function.
+ */
+template<class T>
+inline uint hash(const T& value)
+{
+ return qHash(value.toString());
+}
+
+/**
* If the type \p T was registered on Qt meta type system with Q_DECLARE_METATYPE macro, this class will initialize
* the meta type.
*