pysideqhash.h 546 B

123456789101112131415161718192021222324
  1. // Copyright (C) 2021 The Qt Company Ltd.
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
  3. #ifndef PYSIDEQHASH_H
  4. #define PYSIDEQHASH_H
  5. #include <sbkpython.h>
  6. #include <QtCore/qhash.h>
  7. namespace PySide
  8. {
  9. /// Hash function used to enable hash on objects not supported by the native Qt
  10. /// library which have a toString() function.
  11. template<class T>
  12. [[deprecated]] inline Py_ssize_t hash(const T& value)
  13. {
  14. return qHash(value.toString());
  15. }
  16. } //namespace PySide
  17. #endif // PYSIDEQHASH_H