コード例 #1
0
bool PythonScripting::setQObject(QObject *val, const char *name, PyObject *dict)
{
  if(!val) return false;
  PyObject *pyobj=NULL;
  sipTypeDef *t;
#if SIP_VERSION >= 0x040301 && SIP_VERSION <= 0x040403
#error "SIP versions between 4.3.1 and 4.4.3 are currently not supported. Please install another version of SIP and try again."
#endif
#if SIP_VERSION >= 0x040400
  for (int i=0; i<sipModuleAPI_qti.em_nrtypes; i++)
#else
  for (int i=0; sipModuleAPI_qti.em_types[i] != 0; i++)
#endif
  // Note that the SIP API is a bit confusing here.
  // sipTypeDef.td_cname holds the C++ class name, but is NULL if that's the same as the Python class name.
  // sipTypeDef.td_name OTOH always holds the Python class name, but prepended by the module name ("qti.")
    if (((t=sipModuleAPI_qti.em_types[i]->type)->td_cname && !strcmp(val->className(),t->td_cname)) ||
	  (!t->td_cname && !strcmp(val->className(),t->td_name+4)))
    {
#if SIP_VERSION >= 0x040400
      pyobj=sipConvertFromInstance(val,sipModuleAPI_qti.em_types[i],NULL);
#else
      pyobj=sipBuildResult(NULL, "M", val, sipModuleAPI_qti.em_types[i]);
#endif
      if (!pyobj) return false;
      break;
    }
  if (!pyobj) {
#if SIP_VERSION >= 0x040400
    for (int i=0; i<sipModuleAPI_qti_qt->em_nrtypes; i++)
#else
    for (int i=0; sipModuleAPI_qti_qt->em_types[i] != 0; i++)
#endif
    if (((t=sipModuleAPI_qti_qt->em_types[i]->type)->td_cname && !strcmp(val->className(),t->td_cname)) ||
	  (!t->td_cname && !strcmp(val->className(),t->td_name+3)))
      {
#if SIP_VERSION >= 0x040400
	pyobj=sipConvertFromInstance(val,sipModuleAPI_qti_qt->em_types[i],NULL);
#else
	pyobj=sipBuildResult(NULL, "M", val, sipModuleAPI_qti_qt->em_types[i]);
#endif
	if (!pyobj) return false;
	break;
      }
  } 
  if (!pyobj) return false;

  if (dict)
    PyDict_SetItemString(dict,name,pyobj);
  else
    PyDict_SetItemString(globals,name,pyobj);
  Py_DECREF(pyobj);
  return true;
}
コード例 #2
0
static PyObject *meth_QRegExpValidator_validate(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
{
    PyObject *sipParseErr = NULL;
    bool sipSelfWasArg = (!sipSelf || sipIsDerived((sipSimpleWrapper *)sipSelf));

    if (sipIsAPIEnabled(sipName_QString, 2, 0))
    {
        QString * a0;
        int a0State = 0;
        int a1;
        QRegExpValidator *sipCpp;

        static const char *sipKwdList[] = {
            sipName_input,
            sipName_pos,
        };

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, NULL, "BJ1i", &sipSelf, sipType_QRegExpValidator, &sipCpp, sipType_QString,&a0, &a0State, &a1))
        {
            QValidator::State sipRes;
            PyObject *sipResult;

            Py_BEGIN_ALLOW_THREADS
            sipRes = (sipSelfWasArg ? sipCpp->QRegExpValidator::validate(*a0,a1) : sipCpp->validate(*a0,a1));
            Py_END_ALLOW_THREADS

            sipResult = sipBuildResult(0,"(FDi)",sipRes,sipType_QValidator_State,a0,sipType_QString,NULL,a1);
            sipReleaseType(a0,sipType_QString,a0State);

            return sipResult;
        }
    }

    if (sipIsAPIEnabled(sipName_QString, 0, 2))
    {
        QString * a0;
        int a1;
        QRegExpValidator *sipCpp;

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, NULL, NULL, "BJ9i", &sipSelf, sipType_QRegExpValidator, &sipCpp, sipType_QString,&a0, &a1))
        {
            QValidator::State sipRes;

            Py_BEGIN_ALLOW_THREADS
            sipRes = (sipSelfWasArg ? sipCpp->QRegExpValidator::validate(*a0,a1) : sipCpp->validate(*a0,a1));
            Py_END_ALLOW_THREADS

            return sipBuildResult(0,"(Fi)",sipRes,sipType_QValidator_State,a1);
        }
static PyObject *convertFrom_QVector_0600QPair_2400_0100QVariant(void *sipCppV, PyObject *sipTransferObj)
{
   QVector<QPair<qreal,QVariant> > *sipCpp = reinterpret_cast<QVector<QPair<qreal,QVariant> > *>(sipCppV);

#line 257 "/Users/Kunwiji/Dropbox/Spectroscopy_paper/PyQt-mac-gpl-4.11.2/sip/QtCore/qvector.sip"
    // Create the list.
    PyObject *l;

    if ((l = PyList_New(sipCpp->size())) == NULL)
        return NULL;

    // Set the list elements.
    for (int i = 0; i < sipCpp->size(); ++i)
    {
        const QPair<qreal, QVariant> &p = sipCpp->at(i);
        QVariant *pt = new QVariant(p.second);
        PyObject *pobj;

        if ((pobj = sipBuildResult(NULL, "(dN)", p.first, pt, sipType_QVariant, sipTransferObj)) == NULL)
        {
            Py_DECREF(l);
            delete pt;

            return NULL;
        }

        PyList_SET_ITEM(l, i, pobj);
    }

    return l;
#line 166 "/Users/Kunwiji/Dropbox/Spectroscopy_paper/PyQt-mac-gpl-4.11.2/QtCore/sipQtCoreQVector0600QPair24000100QVariant.cpp"
}
static PyObject *convertFrom_QList_0600QPair_0100QByteArray_0100QByteArray(void *sipCppV, PyObject *sipTransferObj)
{
   QList<QPair<QByteArray,QByteArray> > *sipCpp = reinterpret_cast<QList<QPair<QByteArray,QByteArray> > *>(sipCppV);

#line 257 "sip/QtCore/qpycore_qlist.sip"
    PyObject *l = PyList_New(sipCpp->size());

    if (!l)
        return 0;

    for (int i = 0; i < sipCpp->size(); ++i)
    {
        const QPair<QByteArray, QByteArray> &p = sipCpp->at(i);
        QByteArray *s1 = new QByteArray(p.first);
        QByteArray *s2 = new QByteArray(p.second);
        PyObject *pobj = sipBuildResult(NULL, "(NN)", s1, sipType_QByteArray,
                sipTransferObj, s2, sipType_QByteArray, sipTransferObj);

        if (!pobj)
        {
            delete s1;
            delete s2;
            Py_DECREF(l);

            return 0;
        }

        PyList_SET_ITEM(l, i, pobj);
    }

    return l;
#line 260 "C:\\Users\\marcus\\Downloads\\PyQt-gpl-5.4\\PyQt-gpl-5.4\\QtNetwork/sipQtNetworkQList0600QPair0100QByteArray0100QByteArray.cpp"
}
コード例 #5
0
static PyObject *convertFrom_QVector_0600QPair_2400_0100QVariant(void *sipCppV, PyObject *sipTransferObj)
{
    QVector<QPair<qreal,QVariant> > *sipCpp = reinterpret_cast<QVector<QPair<qreal,QVariant> > *>(sipCppV);

#line 140 "C:\\Users\\marcus\\Downloads\\PyQt-gpl-5.4\\PyQt-gpl-5.4\\sip/QtCore/qpycore_qvector.sip"
    PyObject *l = PyList_New(sipCpp->size());

    if (!l)
        return 0;

    for (int i = 0; i < sipCpp->size(); ++i)
    {
        const QPair<qreal, QVariant> &p = sipCpp->at(i);
        QVariant *s2 = new QVariant(p.second);
        PyObject *pobj = sipBuildResult(NULL, "(dN)", (double)p.first, s2,
                                        sipType_QVariant, sipTransferObj);

        if (!pobj)
        {
            delete s2;
            Py_DECREF(l);

            return 0;
        }

        PyList_SET_ITEM(l, i, pobj);
    }

    return l;
#line 254 "C:\\Users\\marcus\\Downloads\\PyQt-gpl-5.4\\PyQt-gpl-5.4\\QtCore/sipQtCoreQVector0600QPair24000100QVariant.cpp"
}
コード例 #6
0
static PyObject *meth_PySemsB2BDialog_acceptAudio(PyObject *sipSelf,PyObject *sipArgs)
{
    sipTrace(SIP_TRACE_METHODS,"meth_PySemsB2BDialog_acceptAudio()\n");

    int sipArgsParsed = 0;

    {
        const string * a0;
        int a0State = 0;
        const string * a1;
        int a1State = 0;
        string * a2;
        PySemsB2BDialog *sipCpp;

        if (sipParseArgs(&sipArgsParsed,sipArgs,"BM1M1",&sipSelf,sipClass_PySemsB2BDialog,&sipCpp,sipMappedType_string,&a0,&a0State,sipMappedType_string,&a1,&a1State))
        {
            int sipRes;
            a2 = new string();

            sipRes = sipCpp->acceptAudio(*a0,*a1,a2);

            sipReleaseMappedType(const_cast<string *>(a0),sipMappedType_string,a0State);
            sipReleaseMappedType(const_cast<string *>(a1),sipMappedType_string,a1State);

            return sipBuildResult(0,"(iD)",sipRes,a2,sipMappedType_string,NULL);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipArgsParsed,sipNm_py_sems_lib_PySemsB2BDialog,sipNm_py_sems_lib_acceptAudio);

    return NULL;
}
static PyObject *convertFrom_QList_0600QPair_2400_0100QPointF(void *sipCppV, PyObject *sipTransferObj)
{
   QList<QPair<qreal,QPointF> > *sipCpp = reinterpret_cast<QList<QPair<qreal,QPointF> > *>(sipCppV);

#line 516 "/Users/Kunwiji/Dropbox/Spectroscopy_paper/PyQt-mac-gpl-4.11.2/sip/QtCore/qlist.sip"
    // Create the list.
    PyObject *l;

    if ((l = PyList_New(sipCpp->size())) == NULL)
        return NULL;

    // Set the list elements.
    for (int i = 0; i < sipCpp->size(); ++i)
    {
        const QPair<qreal, QPointF> &p = sipCpp->at(i);
        QPointF *t = new QPointF(p.second);
        PyObject *pobj;

        if ((pobj = sipBuildResult(NULL, "(dN)", p.first, t, sipType_QPointF, sipTransferObj)) == NULL)
        {
            Py_DECREF(l);
            delete t;

            return NULL;
        }

        PyList_SET_ITEM(l, i, pobj);
    }

    return l;
#line 192 "/Users/Kunwiji/Dropbox/Spectroscopy_paper/PyQt-mac-gpl-4.11.2/QtGui/sipQtGuiQList0600QPair24000100QPointF.cpp"
}
コード例 #8
0
static PyObject *meth_QGraphicsLayout_getContentsMargins(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;
    bool sipSelfWasArg = (!sipSelf || sipIsDerived((sipSimpleWrapper *)sipSelf));

    {
        qreal a0;
        qreal a1;
        qreal a2;
        qreal a3;
        const QGraphicsLayout *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QGraphicsLayout, &sipCpp))
        {
            Py_BEGIN_ALLOW_THREADS
            (sipSelfWasArg ? sipCpp->QGraphicsLayout::getContentsMargins(&a0,&a1,&a2,&a3) : sipCpp->getContentsMargins(&a0,&a1,&a2,&a3));
            Py_END_ALLOW_THREADS

            return sipBuildResult(0,"(dddd)",a0,a1,a2,a3);
        }
    }
コード例 #9
0
ファイル: sipQtXmlQXmlReader.cpp プロジェクト: annelida/stuff
static PyObject *meth_QXmlReader_property(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
{
    PyObject *sipParseErr = NULL;
    PyObject *sipOrigSelf = sipSelf;

    {
        const QString* a0;
        int a0State = 0;
        bool a1;
        const QXmlReader *sipCpp;

        static const char *sipKwdList[] = {
            NULL,
        };

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, NULL, "BJ1", &sipSelf, sipType_QXmlReader, &sipCpp, sipType_QString,&a0, &a0State))
        {
            void*sipRes;

            if (!sipOrigSelf)
            {
                sipAbstractMethod(sipName_QXmlReader, sipName_property);
                return NULL;
            }

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->property(*a0,&a1);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast<QString *>(a0),sipType_QString,a0State);

            return sipBuildResult(0,"(Vb)",sipRes,a1);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QXmlReader, sipName_property, doc_QXmlReader_property);

    return NULL;
}
コード例 #10
0
static PyObject *meth_QXmlEntityResolver_resolveEntity(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;
    PyObject *sipOrigSelf = sipSelf;

    {
        const QString* a0;
        int a0State = 0;
        const QString* a1;
        int a1State = 0;
        QXmlInputSource* a2;
        QXmlEntityResolver *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ1J1", &sipSelf, sipType_QXmlEntityResolver, &sipCpp, sipType_QString,&a0, &a0State, sipType_QString,&a1, &a1State))
        {
            bool sipRes;

            if (!sipOrigSelf)
            {
                sipAbstractMethod(sipName_QXmlEntityResolver, sipName_resolveEntity);
                return NULL;
            }

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->resolveEntity(*a0,*a1,a2);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast<QString *>(a0),sipType_QString,a0State);
            sipReleaseType(const_cast<QString *>(a1),sipType_QString,a1State);

            return sipBuildResult(0,"(bD)",sipRes,a2,sipType_QXmlInputSource,NULL);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QXmlEntityResolver, sipName_resolveEntity, doc_QXmlEntityResolver_resolveEntity);

    return NULL;
}
コード例 #11
0
static PyObject *meth_QtWin_colorizationColor(PyObject *, PyObject *sipArgs, PyObject *sipKwds)
{
    PyObject *sipParseErr = NULL;

    {
        bool a0;

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, NULL, NULL, ""))
        {
            QColor*sipRes;

            sipRes = new QColor(QtWin::colorizationColor(&a0));

            PyObject *sipResObj = sipConvertFromNewType(sipRes,sipType_QColor,NULL);
            return sipBuildResult(0,"(Rb)",sipResObj,a0);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoFunction(sipParseErr, sipName_colorizationColor, doc_QtWin_colorizationColor);

    return NULL;
}
コード例 #12
0
ファイル: sipQtCoreQDate.cpp プロジェクト: rff255/python-qt5
static PyObject *meth_QDate_getDate(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        int a0;
        int a1;
        int a2;
        QDate *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QDate, &sipCpp))
        {
            sipCpp->getDate(&a0,&a1,&a2);

            return sipBuildResult(0,"(iii)",a0,a1,a2);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QDate, sipName_getDate, doc_QDate_getDate);

    return NULL;
}
コード例 #13
0
ファイル: sipQtCoreQDate.cpp プロジェクト: rff255/python-qt5
static PyObject *meth_QDate_weekNumber(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
{
    PyObject *sipParseErr = NULL;

    {
        int a0;
        const QDate *sipCpp;

        if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, NULL, NULL, "B", &sipSelf, sipType_QDate, &sipCpp))
        {
            int sipRes;

            sipRes = sipCpp->weekNumber(&a0);

            return sipBuildResult(0,"(ii)",sipRes,a0);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QDate, sipName_weekNumber, doc_QDate_weekNumber);

    return NULL;
}
コード例 #14
0
static PyObject *meth_QJsonDocument_rawData(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        int a0;
        const QJsonDocument *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QJsonDocument, &sipCpp))
        {
            const char*sipRes;

            sipRes = sipCpp->rawData(&a0);

            return sipBuildResult(0,"(si)",sipRes,a0);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QJsonDocument, sipName_rawData, doc_QJsonDocument_rawData);

    return NULL;
}
コード例 #15
0
static PyObject *meth_QAbstractNativeEventFilter_nativeEventFilter(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;
    PyObject *sipOrigSelf = sipSelf;

    {
        const QByteArray* a0;
        int a0State = 0;
        void* a1;
        long a2;
        QAbstractNativeEventFilter *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BJ1v", &sipSelf, sipType_QAbstractNativeEventFilter, &sipCpp, sipType_QByteArray, &a0, &a0State, &a1))
        {
            bool sipRes;

            if (!sipOrigSelf)
            {
                sipAbstractMethod(sipName_QAbstractNativeEventFilter, sipName_nativeEventFilter);
                return NULL;
            }

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->nativeEventFilter(*a0,a1,&a2);
            Py_END_ALLOW_THREADS
            sipReleaseType(const_cast<QByteArray *>(a0),sipType_QByteArray,a0State);

            return sipBuildResult(0,"(bl)",sipRes,a2);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QAbstractNativeEventFilter, sipName_nativeEventFilter, doc_QAbstractNativeEventFilter_nativeEventFilter);

    return NULL;
}