|
|
|
@ -370,8 +370,8 @@ PyObject \*sipTransferObj
|
|
|
|
|
The handwritten code must explicitly return a ``PyObject *``. If there was an
|
|
|
|
|
error then a Python exception must be raised and ``NULL`` returned.
|
|
|
|
|
|
|
|
|
|
The following example converts a ``QPtrList<QWidget *>`` instance to a Python
|
|
|
|
|
list of ``QWidget`` instances::
|
|
|
|
|
The following example converts a ``QPtrList<TQWidget *>`` instance to a Python
|
|
|
|
|
list of ``TQWidget`` instances::
|
|
|
|
|
|
|
|
|
|
%ConvertFromTypeCode
|
|
|
|
|
PyObject *l;
|
|
|
|
@ -381,13 +381,13 @@ list of ``QWidget`` instances::
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
// Go through each element in the C++ instance and convert it to a
|
|
|
|
|
// wrapped QWidget.
|
|
|
|
|
// wrapped TQWidget.
|
|
|
|
|
for (int i = 0; i < sipCpp->size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
QWidget *w = sipCpp->at(i);
|
|
|
|
|
TQWidget *w = sipCpp->at(i);
|
|
|
|
|
PyObject *wobj;
|
|
|
|
|
|
|
|
|
|
// Get the Python wrapper for the QWidget instance, creating a new
|
|
|
|
|
// Get the Python wrapper for the TQWidget instance, creating a new
|
|
|
|
|
// one if necessary, and handle any ownership transfer.
|
|
|
|
|
if ((wobj = sipConvertFromType(w, sipType_QWidget, sipTransferObj)) == NULL)
|
|
|
|
|
{
|
|
|
|
@ -514,8 +514,8 @@ the correct type prior to conversion.
|
|
|
|
|
|
|
|
|
|
When used as part of a class specification it can automatically convert
|
|
|
|
|
additional types of Python object. For example, PyQt uses it in the
|
|
|
|
|
specification of the ``QString`` class to allow Python string objects and
|
|
|
|
|
unicode objects to be used wherever ``QString`` instances are expected.
|
|
|
|
|
specification of the ``TQString`` class to allow Python string objects and
|
|
|
|
|
unicode objects to be used wherever ``TQString`` instances are expected.
|
|
|
|
|
|
|
|
|
|
The following variables are made available to the handwritten code:
|
|
|
|
|
|
|
|
|
@ -1395,9 +1395,9 @@ For example::
|
|
|
|
|
%End
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Using this we can use, for example, ``QPtrList<QObject *>`` throughout the
|
|
|
|
|
Using this we can use, for example, ``QPtrList<TQObject *>`` throughout the
|
|
|
|
|
module's specification files (and in any module that imports this one). The
|
|
|
|
|
generated code will automatically map this to and from a Python list of QObject
|
|
|
|
|
generated code will automatically map this to and from a Python list of TQObject
|
|
|
|
|
instances when appropriate.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|