PDA

View Full Version : Help QStringList



pcoliver
15th September 2011, 11:15
Hi all

I am new to programming with Qt4. I have a doubt.
I have a list

I have one for running through a checklist that can be variable.
Each list is separated by commas

List1 Securities Ex: 040000000000, FFFFFF, hhhhh, JJJJJJJJ
Securities Ex list2: 030000000000, EEEEE, GGGG, IIIIIIIII
Lista3 Securities Ex: 020000000000, AAAAA, BBBBB, CCCCCCC

Each item in the list I have it in a comma-separated string.
I need to retrieve the first value of each of the list, taking the first two values ​​and need to recover the data included in the list starting with 02 (in the example list1).

I wonder how I can access the contents of the list where the criterion is that list [i] = 02 and dump the values ​​of variables that list:

Ex:
id=0200000
valor1=AAAAA
valor2= BBBBB
valor3=CCCCCCC

Here I leave the code I have, the code works for me when the first list is the lista3 read, but if you read the order list1, list2, I lista3 retrieves the values.

I put the code in case someone can help me about it.
Thank you all.


ui->listWidget->clear();
QString sAplicacionesww = settings::getRegAppInstaladas();
QStringList listww;

if(sAplicacionesww.size() > 0)
listww = sAplicacionesww.split(",");

QStringList::const_iterator constIteratorww;

for (constIteratorww = listww.constBegin(); constIteratorww != listww.constEnd(); ++constIteratorww){

QString item2;
QString sEstado2;
if(settings::getEstadoProducto(*constIteratorww) != "I")
sEstado2 = "(Descargado)";
else{
sEstado2 = "(Instalado)";
item2.append(sEstado2);
item2.append(" \t");
item2.append(settings::getNombreProducto(*constIte ratorww));
//NombreProductoInstalado=settings::getNombreProduct o(*constIterator1);
item2.append(" v. ");
item2.append(settings::getVersionProducto(*constIt eratorww));

item2.append(" \t");
item2.append(settings::getDescripcionProducto(*con stIteratorww));

RegistroProductoInstalado=listww[PosicionOO];
CodAppInstalada=RegistroProductoInstalado.mid(0,2) ;

//Comprobar que alguna de las lista separada por comas list[consiterator] del registro Apl

//if (CodAppInstalada=="02")

if (RegistroProductoInstalado.startsWith("02"));
{

NombreProductoInstalado=settings::getNombreProduct o(*constIteratorww);
VersionProductoInstalado=settings::getVersionProdu cto(*constIteratorww);
DescripcionProductoInstalado=settings::getDescripc ionProducto(*constIteratorww);
DirectorioAppProducto=settings::getAppDirectory(*c onstIteratorww);
OOIns = "Instalado";
AppInstalada="AAAAAAAA";
Posicion=nt;

}
if (CodAppInstalada=="04")
{
OOIns = "No Instalado";
AppInstalada="PowerMan Energy";

}
if (CodAppInstalada=="06")
{
OOIns = "No Instalado";
AppInstalada="LibreOffice";

}

ui->listWidget->addItem(item2);

}//EndIF
nposicion ++;

}//EndFor
Nuevo proyecto ›