Hello, i have a problem with reading my map data or possibly even writing it in.

the app i'm making is a basic currency converter.

I download the exchange rates from a website, save it into txt file, which i then parse to save the values into a map and use my calculator class to do the conversion.

the downloader class works flawless (i got it of offical QT forums) so i wont post it since the problem aint there.

the code: main.cpp

Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QApplication a(argc, argv);
  4.  
  5. QMap<QString,double> currency_map;
  6.  
  7. downloader d;
  8. d.Do_download();
  9.  
  10. parser p;
  11. p.read_line(currency_map);
  12.  
  13. p.print_map(currency_map);// this line works, and it prints out the map
  14.  
  15. MainWindow w(currency_map);
  16. w.show();
  17.  
  18. return a.exec();
  19. };
To copy to clipboard, switch view to plain text mode 
parser.cpp
im pretty sure it works well because the print_map function does its job.

Qt Code:
  1. void parser::process_line(QString line, QMap<QString, double> &my_map)
  2. {
  3.  
  4. QStringList temporary_list;
  5.  
  6. for(int i = 0; i< currency_list.size();i++)
  7. {
  8. if(line.contains(currency_list.at(i),Qt::CaseInsensitive))
  9. {
  10.  
  11. temporary_list=line.split(" ",QString::SkipEmptyParts);
  12.  
  13. temporary_list.replaceInStrings(",",".");
  14. my_map.insert(currency_list.at(i),temporary_list[6].toDouble());
  15. }
  16. }
  17.  
  18. }
  19.  
  20. int parser::read_line(QMap<QString, double> &my_map)
  21. {
  22.  
  23. QFile file("C:/Qt/test/downloaded.txt");
  24.  
  25. if(!file.exists())
  26. {
  27. QMessageBox msgBox;
  28. msgBox.setText("There is no such file");
  29. msgBox.exec();
  30. return 1;
  31. }
  32. if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
  33. {
  34. QMessageBox msgBox;
  35. msgBox.setText("Error while opening file");
  36. msgBox.exec();
  37. return 1;
  38. }
  39.  
  40. QTextStream in_stream(&file);
  41. QString line=in_stream.readLine();
  42.  
  43. while (!line.isNull())
  44. {
  45. process_line(line, my_map);
  46. line = in_stream.readLine();
  47. }
  48. return 0;
  49. }
  50.  
  51. void parser::print_map(QMap<QString, double> &my_map)
  52. {
  53. QMapIterator<QString, double> i(my_map);
  54. while(i.hasNext())
  55. {
  56. i.next();
  57. qDebug()<< i.key() << ": " << i.value();
  58. }
  59. }
To copy to clipboard, switch view to plain text mode 

now i have a calculator class :

.h

Qt Code:
  1. class Calculator
  2. {
  3. public:
  4. explicit Calculator(QMap<QString,double> &currency_map);
  5. void multiply();
  6. void getValues(QString strFrom, QString strTo);
  7. double getTotal();
  8. private:
  9. double total, firstCurr, secondCurr;
  10. QMap<QString,double> &map;
  11.  
  12. };
To copy to clipboard, switch view to plain text mode 

.cpp

Qt Code:
  1. #include "calculator.h"
  2.  
  3. Calculator::Calculator(QMap<QString,double> &currency_map):map(currency_map)
  4. {
  5. total = 0;
  6. firstCurr = 0;
  7. secondCurr= 0;
  8. }
  9.  
  10. void Calculator::getValues(QString strFrom, QString strTo)
  11. {
  12. QMap<QString, double>::iterator i;
  13. for(i=map.begin();i!=map.end();i++);
  14. {
  15.  
  16. if(!i.key().compare(strFrom))
  17. firstCurr=i.value();
  18. if(!i.key().compare(strFrom))
  19. secondCurr = i.value();
  20. }
  21. //firstCurr = 2;
  22. //secondCurr = 3;
  23. }
  24.  
  25. void Calculator::multiply()
  26. {
  27. total = firstCurr * secondCurr;
  28. }
  29.  
  30. double Calculator::getTotal()
  31. {
  32. return total;
  33. }
To copy to clipboard, switch view to plain text mode 

then i create a Calculator object in my mainWindow class
.h

Qt Code:
  1. class MainWindow : public QMainWindow
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. explicit MainWindow(QMap<QString,double> &currency_map, QWidget *parent = 0);
  7.  
  8. ~MainWindow();
  9.  
  10.  
  11. private slots:
  12. void on_convert_button_clicked();
  13.  
  14. private:
  15. Ui::MainWindow *ui;
  16. Calculator calc;
  17.  
  18. };
To copy to clipboard, switch view to plain text mode 

.cpp

Qt Code:
  1. MainWindow::MainWindow(QMap<QString, double> &currency_map, QWidget *parent) :
  2. QMainWindow(parent),
  3. ui(new Ui::MainWindow),calc(currency_map)
  4. {
  5. ui->setupUi(this);
  6. }
  7.  
  8. MainWindow::~MainWindow()
  9. {
  10. delete ui;
  11. }
  12.  
  13. void MainWindow::on_convert_button_clicked()
  14. {
  15. calc.getValues(ui->from_Combox->currentText(),ui->to_Combox->currentText());
  16. calc.multiply();
  17. ui->lcdNumber->display(calc.getTotal());
  18. }
To copy to clipboard, switch view to plain text mode 

but i cant seem to get any values from the map.
the wierd thing also is when i debugg(i use visual studio, have some trouble setting up a debbuger in QT Creator) its always shows the map as empty, which i cant grasp since the print function works.

any help would be appreciated. thx