pysideqenum.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright (C) 2020 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 PYSIDE_QENUM_H
  4. #define PYSIDE_QENUM_H
  5. #include <sbkpython.h>
  6. #include <pysidemacros.h>
  7. #include <vector>
  8. #include <QtCore/qbytearray.h>
  9. QT_FORWARD_DECLARE_CLASS(QMetaType)
  10. namespace PySide::QEnum {
  11. // PYSIDE-957: Support the QEnum macro
  12. PYSIDE_API PyObject *QEnumMacro(PyObject *, bool);
  13. PYSIDE_API int isFlag(PyObject *);
  14. PYSIDE_API std::vector<PyObject *> resolveDelayedQEnums(PyTypeObject *);
  15. PYSIDE_API void init();
  16. // PYSIDE-2840: For an enum registered in Qt, return the C++ name.
  17. // Ignore flags here; their underlying enums are of Python type flags anyways.
  18. PYSIDE_API QByteArray getTypeName(PyTypeObject *type);
  19. // Create a QMetaType for a decorated Python enum (int), enabling
  20. // modification of properties by Qt Widgets Designer.
  21. QMetaType createGenericEnumMetaType(const QByteArray &name, PyTypeObject *pyType);
  22. // Like createGenericEnumMetaType(), but for "unsigned long long".
  23. QMetaType createGenericEnum64MetaType(const QByteArray &name, PyTypeObject *pyType);
  24. } // namespace PySide::QEnum
  25. #endif