[Qt-interest] QVector not in scope

Alvaro algajard at gmail.com
Sun May 31 04:01:44 CEST 2009


Hi,

I have a problem with a QVector Object. The debugger tells me that de 
QVector object is not in scope.

Here is my code.

QVector<CEnfermedad> PgSqlEnfermedad::obtenerListaEnfermedades() 
throw(SqlConnectException,SqlSelectException)

{

    QSqlQuery consulta;

    QString delim(QChar('"'));

    QVector<CEnfermedad> enfermedades;

    CEnfermedad e;


    if(pgSqlConectar())

    {

        consulta=QSqlQuery(conn);

        consulta.prepare("SELECT codigo,descripcion,tipo FROM 
"+delim+"Enfermedad"+delim+";");


        if(consulta.exec())

        {

            while(consulta.next())

            {

                e.setearCodigo(consulta.value(0).toString());

                e.setearDescripcion(consulta.value(1).toString());

                e.setearTipo(consulta.value(2).toInt());

                e.setearSintomas(obtenerSintomas(e));

                e.setearTratamientos(obtenerTratamientos(e));

                enfermedades.append(e);

                e.eliminarSintomas();

                e.eliminarTratamientos();

            }


            pgSqlDesconectar();

        }

        else

        {

            pgSqlDesconectar();

            throw SqlSelectException();

        }

    }

    else

        throw SqlConnectException();


    return enfermedades;

}



The QVector is defined, but it does not *append* the CEnfermedad object 
*e*. The debugger tells me that the QVector is not in scope. The Object 
CEnfermedad is correct (at least the the debugger says that).

The application crushes with the following message.

*The program has unexpectedly finished.*


Any ideas ?

Greetings,

Alvaro.



More information about the Qt-interest-old mailing list