QValidator::State sipQRegExpValidator::validate(QString& a0,int& a1) const
{
    sip_gilstate_t sipGILState;
    PyObject *meth;

    meth = sipIsPyMethod(&sipGILState,const_cast<char *>(&sipPyMethods[0]),sipPySelf,NULL,sipName_validate);

    if (!meth)
        return QRegExpValidator::validate(a0,a1);

    if (sipIsAPIEnabled(sipName_QString, 2, 0))
    {
        extern QValidator::State sipVH_QtGui_30(sip_gilstate_t,PyObject *,QString&,int&);

        return sipVH_QtGui_30(sipGILState,meth,a0,a1);
    }

    if (sipIsAPIEnabled(sipName_QString, 0, 2))
    {
        extern QValidator::State sipVH_QtGui_29(sip_gilstate_t,PyObject *,QString&,int&);

        return sipVH_QtGui_29(sipGILState,meth,a0,a1);
    }

    return QRegExpValidator::validate(a0,a1);
}
void sipQRegExpValidator::fixup(QString& a0) const
{
    sip_gilstate_t sipGILState;
    PyObject *meth;

    meth = sipIsPyMethod(&sipGILState,const_cast<char *>(&sipPyMethods[1]),sipPySelf,NULL,sipName_fixup);

    if (!meth)
    {
        QValidator::fixup(a0);
        return;
    }

    if (sipIsAPIEnabled(sipName_QString, 2, 0))
    {
        extern void sipVH_QtGui_34(sip_gilstate_t,PyObject *,QString&);

        sipVH_QtGui_34(sipGILState,meth,a0);
        return;
    }

    if (sipIsAPIEnabled(sipName_QString, 0, 2))
    {
        extern void sipVH_QtGui_33(sip_gilstate_t,PyObject *,QString&);

        sipVH_QtGui_33(sipGILState,meth,a0);
        return;
    }

    QValidator::fixup(a0);
}
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);
        }
Beispiel #4
0
// Convert a QVariant to a Python object based on the type of the object.
PyObject *Chimera::toAnyPyObject(const QVariant &var)
{
    if (!var.isValid())
    {
        Py_INCREF(Py_None);
        return Py_None;
    }

    // Handle null variants for the v2 API.
    if (var.isNull() && sipIsAPIEnabled("QVariant", 2, 0))
        return qpycore_qpynullvariant_FromQVariant(var);

    const char *type_name = var.typeName();
    const sipTypeDef *td = sipFindType(type_name);

    Chimera *ct = new Chimera;

    ct->_type = td;
    ct->_name = type_name;
    ct->_metatype = var.userType();

    if (td && sipTypeIsClass(td))
        ct->set_flag();

    PyObject *py = ct->toPyObject(var);
    delete ct;

    return py;
}