thx, that helped. now if i can trouble you some more

so i have this parser class im making

Qt Code:
  1. #include <QFile>
  2. #include <QTextStream>
  3. #include <QString>
  4. #include <QTextStream>
  5. #include <QMessageBox>
  6. #include <QDebug>
  7. #include <QStringList>
  8. class parser : public QObject
  9.  
  10. {
  11. Q_OBJECT
  12. public:
  13. explicit parser(QObject *parent = 0);
  14.  
  15. void process_line(QString line);
  16. int read_line();
  17. void init_map();
  18. void init_list();
  19.  
  20. private:
  21. QMap<QString,float> map;
  22. QStringList valute;
  23. };
To copy to clipboard, switch view to plain text mode 

and the .cpp

Qt Code:
  1. #include "parser.h"
  2.  
  3. parser::parser(QObject *parent) :
  4. QObject(parent)
  5. {
  6. init_map();
  7. init_list();
  8. }
  9. void parser::process_line(QString line)
  10. {
  11. QString str="EUR";
  12. QStringList temporary_list;
  13. if(line.contains(str,Qt::CaseInsensitive)) this is the part im having trouble with now**
  14. {
  15. qDebug()<<"found euro";
  16. temporary_list=line.split(" ", QString::SkipEmptyParts);
  17. map.insert("EUR",temporary_list[6].toFloat());
  18.  
  19. }
  20.  
  21. }
  22. int parser::read_line()
  23. {
  24.  
  25. QFile file("C:/downloaded.txt");
  26.  
  27. if(!file.exists())
  28. {
  29. QMessageBox msgBox;
  30. msgBox.setText("There is no such file");
  31. msgBox.exec();
  32. return 1;
  33. }
  34.  
  35. if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
  36. {
  37. QMessageBox msgBox;
  38. msgBox.setText("Error while opening file");
  39. return 1;
  40. }
  41.  
  42. QTextStream in_stream(&file);
  43. QString line=in_stream.readLine();
  44.  
  45.  
  46. while (!line.isNull())
  47. {
  48. process_line(line);
  49. line = in_stream.readLine();
  50. }
  51.  
  52.  
  53. return 0;
  54. }
  55.  
  56. void parser::init_map()
  57. {
  58. map.insert("AUD",0);
  59. map.insert("CAD",0);
  60. map.insert("CZK",0);
  61. map.insert("DKK",0);
  62. map.insert("NOK",0);
  63. map.insert("SEK",0);
  64. map.insert("CHF",0);
  65. map.insert("GBP",0);
  66. map.insert("USD",0);
  67. map.insert("EUR",0);
  68. map.insert("PLN",0);
  69. }
  70.  
  71. void parser::init_list()
  72. {
  73. valute << "AUD" << "CAD" << "CZK" << "DKK" << "NOK" << "SEK"
  74. << "CHF" << "GBP" << "USD" << "EUR" << "PLN";
  75. }
To copy to clipboard, switch view to plain text mode 

i have a txt file of over 60 lines from which i have to read the values.
so i would like my process_line function to check the QString it receives if there is any matching strings from my QStringlist in there.
and if so to insert the value to my map.

im not sure how to write that in my if statement, and im pretty sure also i have the wrong aproach here. so if you could point me in the right direction again, would be very much appreciated.