Results 1 to 1 of 1

Thread: Help QStringList

  1. #1
    Join Date
    Sep 2011
    Posts
    6
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Help QStringList

    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.

    Qt Code:
    1. ui->listWidget->clear();
    2. QString sAplicacionesww = settings::getRegAppInstaladas();
    3. QStringList listww;
    4.  
    5. if(sAplicacionesww.size() > 0)
    6. listww = sAplicacionesww.split(",");
    7.  
    8. QStringList::const_iterator constIteratorww;
    9.  
    10. for (constIteratorww = listww.constBegin(); constIteratorww != listww.constEnd(); ++constIteratorww){
    11.  
    12. QString item2;
    13. QString sEstado2;
    14. if(settings::getEstadoProducto(*constIteratorww) != "I")
    15. sEstado2 = "(Descargado)";
    16. else{
    17. sEstado2 = "(Instalado)";
    18. item2.append(sEstado2);
    19. item2.append(" \t");
    20. item2.append(settings::getNombreProducto(*constIteratorww));
    21. //NombreProductoInstalado=settings::getNombreProducto(*constIterator1);
    22. item2.append(" v. ");
    23. item2.append(settings::getVersionProducto(*constIteratorww));
    24.  
    25. item2.append(" \t");
    26. item2.append(settings::getDescripcionProducto(*constIteratorww));
    27.  
    28. RegistroProductoInstalado=listww[PosicionOO];
    29. CodAppInstalada=RegistroProductoInstalado.mid(0,2);
    30.  
    31. //Comprobar que alguna de las lista separada por comas list[consiterator] del registro Apl
    32.  
    33. //if (CodAppInstalada=="02")
    34.  
    35. if (RegistroProductoInstalado.startsWith("02"));
    36. {
    37.  
    38. NombreProductoInstalado=settings::getNombreProducto(*constIteratorww);
    39. VersionProductoInstalado=settings::getVersionProducto(*constIteratorww);
    40. DescripcionProductoInstalado=settings::getDescripcionProducto(*constIteratorww);
    41. DirectorioAppProducto=settings::getAppDirectory(*constIteratorww);
    42. OOIns = "Instalado";
    43. AppInstalada="AAAAAAAA";
    44. Posicion=nt;
    45.  
    46. }
    47. if (CodAppInstalada=="04")
    48. {
    49. OOIns = "No Instalado";
    50. AppInstalada="PowerMan Energy";
    51.  
    52. }
    53. if (CodAppInstalada=="06")
    54. {
    55. OOIns = "No Instalado";
    56. AppInstalada="LibreOffice";
    57.  
    58. }
    59.  
    60. ui->listWidget->addItem(item2);
    61.  
    62. }//EndIF
    63. nposicion ++;
    64.  
    65. }//EndFor
    To copy to clipboard, switch view to plain text mode 
    Nuevo proyecto ›
    Last edited by wysota; 15th September 2011 at 11:24.

Similar Threads

  1. Plz help me,I met a bug about QStringList
    By study_c in forum Qt Programming
    Replies: 1
    Last Post: 16th October 2010, 16:56
  2. QStringList::contains() not working
    By nmuntz in forum Qt Programming
    Replies: 9
    Last Post: 21st May 2008, 16:30
  3. QStringList
    By jaca in forum Qt Programming
    Replies: 5
    Last Post: 17th May 2008, 11:12
  4. QStringList
    By dragon in forum Newbie
    Replies: 2
    Last Post: 8th June 2007, 18:26
  5. Replies: 7
    Last Post: 2nd June 2006, 13:48

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.