dynamicslot_p.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright (C) 2024 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 DYNAMICSLOT_P_H
  4. #define DYNAMICSLOT_P_H
  5. #include <sbkpython.h>
  6. #include <QtCore/qcompare.h>
  7. #include <QtCore/qmetaobject.h>
  8. QT_FORWARD_DECLARE_CLASS(QDebug)
  9. namespace PySide
  10. {
  11. class DynamicSlot
  12. {
  13. Q_DISABLE_COPY_MOVE(DynamicSlot)
  14. public:
  15. enum SlotType
  16. {
  17. Callable,
  18. Method,
  19. CompiledMethod,
  20. C_Function
  21. };
  22. virtual ~DynamicSlot() = default;
  23. virtual void call(const QByteArrayList &parameterTypes, const char *returnType,
  24. void **cppArgs) = 0;
  25. virtual void formatDebug(QDebug &debug) const = 0;
  26. static SlotType slotType(PyObject *callback);
  27. static DynamicSlot *create(PyObject *callback);
  28. protected:
  29. DynamicSlot() noexcept = default;
  30. };
  31. QDebug operator<<(QDebug debug, const DynamicSlot *ds);
  32. void registerSlotConnection(QObject *source, int signalIndex, PyObject *callback,
  33. const QMetaObject::Connection &connection);
  34. bool disconnectSlot(QObject *source, int signalIndex, PyObject *callback);
  35. }
  36. #endif // DYNAMICSLOT_P_H