summaryrefslogtreecommitdiffstats
path: root/sip/qt/qobject.sip
diff options
context:
space:
mode:
Diffstat (limited to 'sip/qt/qobject.sip')
-rw-r--r--sip/qt/qobject.sip169
1 files changed, 125 insertions, 44 deletions
diff --git a/sip/qt/qobject.sip b/sip/qt/qobject.sip
index 2ce5778..0f3a23e 100644
--- a/sip/qt/qobject.sip
+++ b/sip/qt/qobject.sip
@@ -403,7 +403,11 @@ public:
// the true (Python) class name.
SIP_PYOBJECT className() const;
%MethodCode
+#if PY_MAJOR_VERSION >= 3
+ sipRes = PyUnicode_FromString(sipSelf->ob_type->tp_name);
+#else
sipRes = sipClassName(sipSelf);
+#endif
%End
%If (- TQt_3_0_0)
@@ -425,49 +429,69 @@ public:
// trUtf8() methods for a Python sub-class instance in the sub-class's
// ctor.
- TQString tr(const char *,const char * = 0);
+ TQString tr(SIP_PYOBJECT sourceText /TypeHint="str"/,const char * = 0);
%MethodCode
- PyObject *nmobj;
+ if (tqApp)
+ {
+ const char *source = PyTQt_qt_encode(&a0, TQApplication::DefaultCodec);
- if ((nmobj = sipClassName(sipSelf)) == NULL)
- sipIsErr = 1;
+ if (source)
+ {
+ sipRes = new TQString(tqApp->translate(Py_TYPE(sipSelf)->tp_name, source,
+ a1, TQApplication::DefaultCodec));
+ Py_DECREF(a0);
+ }
+ else
+ {
+ sipIsErr = 1;
+ }
+ }
else
{
- char *cname = PyString_AsString(nmobj);
+ const char *source = sipString_AsLatin1String(&a0);
- Py_BEGIN_ALLOW_THREADS
-
- if (cname && tqApp)
- sipRes = new TQString(tqApp -> translate(cname,a0,a1,TQApplication::DefaultCodec));
+ if (source)
+ {
+ sipRes = new TQString(QString::fromLatin1(source));
+ Py_DECREF(a0);
+ }
else
- sipRes = new TQString(TQString::fromLatin1(a0));
-
- Py_END_ALLOW_THREADS
-
- Py_DECREF(nmobj);
+ {
+ sipIsErr = 1;
+ }
}
%End
- TQString trUtf8(const char *,const char * = 0);
+ TQString trUtf8(SIP_PYOBJECT sourceText /TypeHint="str"/,const char * = 0);
%MethodCode
- PyObject *nmobj;
+ if (tqApp)
+ {
+ const char *source = PyTQt_qt_encode(&a0, TQApplication::DefaultCodec);
- if ((nmobj = sipClassName(sipSelf)) == NULL)
- sipIsErr = 1;
+ if (source)
+ {
+ sipRes = new TQString(tqApp->translate(Py_TYPE(sipSelf)->tp_name, source,
+ a1, TQApplication::UnicodeUTF8));
+ Py_DECREF(a0);
+ }
+ else
+ {
+ sipIsErr = 1;
+ }
+ }
else
{
- char *cname = PyString_AsString(nmobj);
-
- Py_BEGIN_ALLOW_THREADS
+ const char *source = sipString_AsLatin1String(&a0);
- if (cname && tqApp)
- sipRes = new TQString(tqApp -> translate(cname,a0,a1,TQApplication::UnicodeUTF8));
+ if (source)
+ {
+ sipRes = new TQString(TQString::fromLatin1(source));
+ Py_DECREF(a0);
+ }
else
- sipRes = new TQString(TQString::fromUtf8(a0));
-
- Py_END_ALLOW_THREADS
-
- Py_DECREF(nmobj);
+ {
+ sipIsErr = 1;
+ }
}
%End
%End
@@ -811,7 +835,11 @@ public:
// it we can ignore it.
SIP_PYOBJECT className() const;
%MethodCode
+#if PY_MAJOR_VERSION >= 3
+ sipRes = PyUnicode_FromString(sipSelf->ob_type->tp_name);
+#else
sipRes = sipClassName(sipSelf);
+#endif
%End
bool isA(const char *) const;
@@ -866,7 +894,7 @@ private:
%End
-SIP_PYOBJECT SLOT(const char *);
+SIP_PYOBJECT SLOT(const char * /Encoding="ASCII"/) /TypeHint="QT_SLOT"/;
%MethodCode
if (!a0)
{
@@ -877,11 +905,11 @@ SIP_PYOBJECT SLOT(const char *);
{
int len = strlen(a0);
- if ((sipRes = PyString_FromStringAndSize(NULL,1 + len)) == NULL)
+ if ((sipRes = SIPBytes_FromStringAndSize(NULL,1 + len)) == NULL)
sipIsErr = 1;
else
{
- char *dp = PyString_AS_STRING(sipRes);
+ char *dp = SIPBytes_AS_STRING(sipRes);
*dp++ = '1';
@@ -891,7 +919,7 @@ SIP_PYOBJECT SLOT(const char *);
%End
-SIP_PYOBJECT SIGNAL(const char *);
+SIP_PYOBJECT SIGNAL(const char * /Encoding="ASCII"/) /TypeHint="QT_SIGNAL"/;
%MethodCode
if (!a0)
{
@@ -902,11 +930,11 @@ SIP_PYOBJECT SIGNAL(const char *);
{
int len = strlen(a0);
- if ((sipRes = PyString_FromStringAndSize(NULL,1 + len)) == NULL)
+ if ((sipRes = SIPBytes_FromStringAndSize(NULL,1 + len)) == NULL)
sipIsErr = 1;
else
{
- char *dp = PyString_AS_STRING(sipRes);
+ char *dp = SIPBytes_AS_STRING(sipRes);
*dp++ = '2';
@@ -916,7 +944,7 @@ SIP_PYOBJECT SIGNAL(const char *);
%End
-SIP_PYOBJECT PYSIGNAL(const char *);
+SIP_PYOBJECT PYSIGNAL(const char * /Encoding="ASCII"/);
%MethodCode
if (!a0)
{
@@ -927,11 +955,11 @@ SIP_PYOBJECT PYSIGNAL(const char *);
{
int len = strlen(a0);
- if ((sipRes = PyString_FromStringAndSize(NULL,1 + len)) == NULL)
+ if ((sipRes = SIPBytes_FromStringAndSize(NULL,1 + len)) == NULL)
sipIsErr = 1;
else
{
- char *dp = PyString_AS_STRING(sipRes);
+ char *dp = SIPBytes_AS_STRING(sipRes);
*dp++ = '9';
@@ -992,16 +1020,30 @@ extern "C" {
// The meta-type for PyTQt classes. It is just a marker type so that we can
// safely cast to get access to PyTQt3-specific data structures.
PyTypeObject pyqtWrapperType_Type = {
+#if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(NULL, 0)
+#else
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
+#endif
"qt.pyqtWrapperType", /* tp_name */
sizeof (sipWrapperType), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
+#if PY_VERSION_HEX >= 0x03080000
+ 0, /* tp_vectorcall_offset */
+#else
0, /* tp_print */
+#endif
0, /* tp_getattr */
0, /* tp_setattr */
+#if PY_VERSION_HEX >= 0x03050000
+ 0, /* tp_as_async */
+#elif PY_VERSION_HEX >= 0x03010000
+ 0, /* tp_reserved */
+#else
0, /* tp_compare */
+#endif
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -1042,6 +1084,15 @@ PyTypeObject pyqtWrapperType_Type = {
#if PY_VERSION_HEX >= 0x02060000
0, /* tp_version_tag */
#endif
+#if PY_VERSION_HEX >= 0x03040000
+ 0, /* tp_finalize */
+#endif
+#if PY_VERSION_HEX >= 0x03080000
+ 0, /* tp_vectorcall */
+#endif
+#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 8
+ 0, /* tp_print (deprecated) */
+#endif
};
@@ -1196,16 +1247,30 @@ static sipWrapperType pyqtWrapper_Type = {
{
#endif
{
+#if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(&pyqtWrapperType_Type, 0)
+#else
PyObject_HEAD_INIT(&pyqtWrapperType_Type)
0, /* ob_size */
+#endif
"qt.pyqtWrapper", /* tp_name */
sizeof (pyqtWrapper), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)pyqtWrapper_dealloc, /* tp_dealloc */
+#if PY_VERSION_HEX >= 0x03080000
+ 0, /* tp_vectorcall_offset */
+#else
0, /* tp_print */
+#endif
0, /* tp_getattr */
0, /* tp_setattr */
+#if PY_VERSION_HEX >= 0x03050000
+ 0, /* tp_as_async */
+#elif PY_VERSION_HEX >= 0x03010000
+ 0, /* tp_reserved */
+#else
0, /* tp_compare */
+#endif
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -1246,6 +1311,15 @@ static sipWrapperType pyqtWrapper_Type = {
#if PY_VERSION_HEX >= 0x02060000
0, /* tp_version_tag */
#endif
+#if PY_VERSION_HEX >= 0x03040000
+ 0, /* tp_finalize */
+#endif
+#if PY_VERSION_HEX >= 0x03080000
+ 0, /* tp_vectorcall */
+#endif
+#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 8
+ 0, /* tp_print (deprecated) */
+#endif
},
#if !defined(STACKLESS)
},
@@ -1500,17 +1574,17 @@ bool UniversalSlot::tqt_invoke(int id, TQUObject *qargs)
case char_sat:
case schar_sat:
case uchar_sat:
- arg = PyString_FromStringAndSize((char *)static_QUType_ptr.get(qargs), 1);
+ arg = SIPBytes_FromStringAndSize((char *)static_QUType_ptr.get(qargs), 1);
break;
case string_sat:
case sstring_sat:
case ustring_sat:
- arg = PyString_FromString((char *)static_QUType_ptr.get(qargs));
+ arg = SIPBytes_FromString((char *)static_QUType_ptr.get(qargs));
break;
case short_sat:
- arg = PyInt_FromLong(*(short *)static_QUType_ptr.get(qargs));
+ arg = PyLong_FromLong(*(short *)static_QUType_ptr.get(qargs));
break;
case ushort_sat:
@@ -1519,9 +1593,9 @@ bool UniversalSlot::tqt_invoke(int id, TQUObject *qargs)
case int_sat:
if (qv)
- arg = PyInt_FromLong(qv -> asInt());
+ arg = PyLong_FromLong(qv -> asInt());
else
- arg = PyInt_FromLong(static_QUType_int.get(qargs));
+ arg = PyLong_FromLong(static_QUType_int.get(qargs));
break;
case uint_sat:
@@ -1557,7 +1631,7 @@ bool UniversalSlot::tqt_invoke(int id, TQUObject *qargs)
break;
case bool_sat:
- arg = PyInt_FromLong(static_QUType_bool.get(qargs));
+ arg = PyLong_FromLong(static_QUType_bool.get(qargs));
break;
case void_sat:
@@ -1628,7 +1702,14 @@ static void *sipTQtCreateUniversalSlot(sipWrapper *tx, const char *sig,
pyqt3SlotConnection conn;
/* Initialise the connection. */
- conn.sc_transmitter = (tx ? sipGetCppPtr((sipSimpleWrapper *)tx, 0) : 0);
+ if (sipGetAddress(&tx->super) == NULL)
+ {
+ conn.sc_transmitter = 0;
+ }
+ else
+ {
+ conn.sc_transmitter = (tx ? sipGetCppPtr(&tx->super, 0) : 0);
+ }
/* Save the real slot. */
if (sipSaveSlot(&conn.sc_slot, rxObj, slot) < 0)