pysideproperty_p.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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_QPROPERTY_P_H
  4. #define PYSIDE_QPROPERTY_P_H
  5. #include <sbkpython.h>
  6. #include "pysideproperty.h"
  7. #include <pysidemacros.h>
  8. #include <QtCore/qbytearray.h>
  9. #include <QtCore/qtclasshelpermacros.h>
  10. #include <QtCore/qmetaobject.h>
  11. struct PySideProperty;
  12. class PYSIDE_API PySidePropertyPrivate
  13. {
  14. public:
  15. Q_DISABLE_COPY_MOVE(PySidePropertyPrivate)
  16. PySidePropertyPrivate() noexcept;
  17. virtual ~PySidePropertyPrivate();
  18. virtual void metaCall(PyObject *source, QMetaObject::Call call, void **args);
  19. PyObject *getValue(PyObject *source) const;
  20. int setValue(PyObject *source, PyObject *value);
  21. int reset(PyObject *source);
  22. QByteArray typeName;
  23. // Type object: A real PyTypeObject ("@Property(int)") or a string
  24. // "@Property('QVariant')".
  25. PyObject *pyTypeObject = nullptr;
  26. PyObject *fget = nullptr;
  27. PyObject *fset = nullptr;
  28. PyObject *freset = nullptr;
  29. PyObject *fdel = nullptr;
  30. PyObject *notify = nullptr;
  31. bool getter_doc = false;
  32. QByteArray notifySignature;
  33. QByteArray doc;
  34. bool designable = true;
  35. bool scriptable = true;
  36. bool stored = true;
  37. bool user = false;
  38. bool constant = false;
  39. bool final = false;
  40. };
  41. namespace PySide::Property {
  42. /**
  43. * Init PySide QProperty support system
  44. */
  45. void init(PyObject* module);
  46. /**
  47. * This function call reset property function
  48. * This function does not check the property object type
  49. *
  50. * @param self The property object
  51. * @param source The QObject witch has the property
  52. * @return Return 0 if ok or -1 if this function fail
  53. **/
  54. int reset(PySideProperty* self, PyObject* source);
  55. /**
  56. * This function return the property type
  57. * This function does not check the property object type
  58. *
  59. * @param self The property object
  60. * @return Return the property type name
  61. **/
  62. const char* getTypeName(const PySideProperty* self);
  63. /**
  64. * This function check if property has read function
  65. * This function does not check the property object type
  66. *
  67. * @param self The property object
  68. * @return Return a boolean value
  69. **/
  70. bool isReadable(const PySideProperty* self);
  71. /**
  72. * This function check if property has write function
  73. * This function does not check the property object type
  74. *
  75. * @param self The property object
  76. * @return Return a boolean value
  77. **/
  78. bool isWritable(const PySideProperty* self);
  79. /**
  80. * This function check if property has reset function
  81. * This function does not check the property object type
  82. *
  83. * @param self The property object
  84. * @return Return a boolean value
  85. **/
  86. bool hasReset(const PySideProperty* self);
  87. /**
  88. * This function check if property has the flag DESIGNABLE setted
  89. * This function does not check the property object type
  90. *
  91. * @param self The property object
  92. * @return Return a boolean value
  93. **/
  94. bool isDesignable(const PySideProperty* self);
  95. /**
  96. * This function check if property has the flag SCRIPTABLE setted
  97. * This function does not check the property object type
  98. *
  99. * @param self The property object
  100. * @return Return a boolean value
  101. **/
  102. bool isScriptable(const PySideProperty* self);
  103. /**
  104. * This function check if property has the flag STORED setted
  105. * This function does not check the property object type
  106. *
  107. * @param self The property object
  108. * @return Return a boolean value
  109. **/
  110. bool isStored(const PySideProperty* self);
  111. /**
  112. * This function check if property has the flag USER setted
  113. * This function does not check the property object type
  114. *
  115. * @param self The property object
  116. * @return Return a boolean value
  117. **/
  118. bool isUser(const PySideProperty* self);
  119. /**
  120. * This function check if property has the flag CONSTANT setted
  121. * This function does not check the property object type
  122. *
  123. * @param self The property object
  124. * @return Return a boolean value
  125. **/
  126. bool isConstant(const PySideProperty* self);
  127. /**
  128. * This function check if property has the flag FINAL setted
  129. * This function does not check the property object type
  130. *
  131. * @param self The property object
  132. * @return Return a boolean value
  133. **/
  134. bool isFinal(const PySideProperty* self);
  135. /// This function returns the type object of the property. It is either a real
  136. /// PyTypeObject ("@Property(int)") or a string "@Property('QVariant')".
  137. /// @param self The property object
  138. /// @return type object
  139. PyObject *getTypeObject(const PySideProperty* self);
  140. } // namespace PySide::Property
  141. #endif