blob: 40b011fcf596c84431c2db3b412d085ac80ae671 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "pysideqslotobject_p.h"
#include "signalmanager.h"
#include <gilstate.h>
namespace PySide
{
PySideQSlotObject::PySideQSlotObject(PyObject *callable,
const QByteArrayList ¶meterTypes,
const char *returnType) :
QtPrivate::QSlotObjectBase(&impl),
m_callable(callable),
m_parameterTypes(parameterTypes),
m_returnType(returnType)
{
Py_INCREF(callable);
}
PySideQSlotObject::~PySideQSlotObject()
{
Shiboken::GilState state;
Py_DECREF(m_callable);
}
void PySideQSlotObject::call(void **args)
{
SignalManager::callPythonMetaMethod(m_parameterTypes, m_returnType, args, m_callable);
}
void PySideQSlotObject::impl(int which, QSlotObjectBase *this_, QObject *receiver,
void **args, bool *ret)
{
auto *self = static_cast<PySideQSlotObject *>(this_);
switch (which) {
case Destroy:
delete self;
break;
case Call:
self->call(args);
break;
case Compare:
case NumOperations:
Q_UNUSED(receiver);
Q_UNUSED(args);
Q_UNUSED(ret);
break;
}
}
} // namespace PySide
|