pysideproperty.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Copyright (C) 2016 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_PROPERTY_H
  4. #define PYSIDE_PROPERTY_H
  5. #include <pysidemacros.h>
  6. #include <sbkpython.h>
  7. #include <QtCore/qmetaobject.h>
  8. class PySidePropertyPrivate;
  9. extern "C"
  10. {
  11. extern PYSIDE_API PyTypeObject *PySideProperty_TypeF(void);
  12. struct PYSIDE_API PySideProperty
  13. {
  14. PyObject_HEAD
  15. PySidePropertyPrivate* d;
  16. };
  17. };
  18. namespace PySide::Property {
  19. PYSIDE_API bool checkType(PyObject *pyObj);
  20. /**
  21. * This function call set property function and pass value as arg
  22. * This function does not check the property object type
  23. *
  24. * @param self The property object
  25. * @param source The QObject witch has the property
  26. * @param value The value to set in property
  27. * @return Return 0 if ok or -1 if this function fail
  28. **/
  29. PYSIDE_API int setValue(PySideProperty *self, PyObject *source, PyObject *value);
  30. /**
  31. * This function call get property function
  32. * This function does not check the property object type
  33. *
  34. * @param self The property object
  35. * @param source The QObject witch has the property
  36. * @return Return the result of property get function or 0 if this fail
  37. **/
  38. PYSIDE_API PyObject *getValue(PySideProperty *self, PyObject *source);
  39. /**
  40. * This function return the notify name used on this property
  41. *
  42. * @param self The property object
  43. * @return Return a const char with the notify name used
  44. **/
  45. PYSIDE_API const char *getNotifyName(PySideProperty *self);
  46. /**
  47. * This function search in the source object for desired property
  48. *
  49. * @param source The QObject object
  50. * @param name The property name
  51. * @return Return a new reference to property object
  52. **/
  53. PYSIDE_API PySideProperty *getObject(PyObject *source, PyObject *name);
  54. PYSIDE_API void setTypeName(PySideProperty *self, const char *typeName);
  55. } //namespace PySide::Property
  56. #endif