Hello,

Well im quiet new to QT Programming and im trying to create my own first programm at the moment. But i have some problems with finding the right functions for what i want to do.
Here is my Problem:
I want to open a file that has numbers in it. I want to read those number (4 coloumns and many rows) to some double-arrays so that i can then put them into a plot with QWT.
What i managed to do so far is make the QWT plot and open a QFileDialog that is connected to a QPushButton.
Now my first problem is that i cant get the filename of the file that i chose into a QString.
Then ive been trying to understand how to open a file and then read the data from it. There are so many things that i read about that im kinda confused now. Also i have no idea yet how i can test if the data is read correct. in normal C++ i simply used printf in a command prompt but with QT i dunno where i can print the numbers.

Well here is the code i wrote so far:

Qt Code:
  1. #include <QApplication>
  2. #include <QFont>
  3. #include <QPushButton>
  4. #include <QWidget>
  5. #include <qwt_plot.h>
  6. #include <qwt_plot_curve.h>
  7. #include <QFileDialog>
  8. #include <QStringList>
  9. #include <QLabel>
  10.  
  11.  
  12. int main(int argc, char *argv[])
  13. {
  14. QApplication app(argc, argv);
  15. QWidget window;
  16. window.resize(500, 500);
  17.  
  18. QFileDialog *dial = new QFileDialog( &window, "Test", TRUE);
  19.  
  20. dial->setFileMode(QFileDialog::ExistingFile);
  21.  
  22. QPushButton quit("Quit", &window);
  23. quit.setFont(QFont("Times", 18, QFont::Bold));
  24. quit.setGeometry(10, 450, 100, 40);
  25. QObject::connect(&quit, SIGNAL(clicked()), &app, SLOT(quit()));
  26.  
  27. QPushButton open("Open", &window);
  28. open.setFont(QFont("Times", 18, QFont::Bold));
  29. open.setGeometry(150, 450, 100, 40);
  30. QObject::connect(&open, SIGNAL(clicked()), dial, SLOT(exec()));
  31.  
  32.  
  33. window.show();
  34. return app.exec();
  35. }
To copy to clipboard, switch view to plain text mode 

So i hope someone here can help me. If i missed something in my explanation let me know.

Thanks
Basti