title: read the data from text file in QT
body: <p>I have to read the data from text file in QT which has data in this form  </p>
  
  <blockquote>
    <p>1      1<br>
    2      4<br>
    3      9<br>
    4      16<br>
    5      25  </p>
  </blockquote>
  
  <p>I would like to take every integer or float number  and assign it to a array variable like </p>
  
  <pre><code>X[0]=1, Y[0]=1 &amp; 
  X[1]=2, Y[1]=4  and so on....  
  
  enter code here
  QString filename=QFileDialog::getOpenFileName(this, tr("Open File"), "media://", "All files (*.*);; Text File (*.txt)");
  
  QFile file3(filename);
  
  if(!file3.open(QFile::ReadOnly|QFile::Text))
  QMessageBox::information(0,"info", file3.errorString());
  
  
  QTextStream in3(&amp;file3);
  
  QString xv,*p,xx,yy;
  
  QStringList L;
  
  for(j=0;j&lt;n;j++)
  {
   xv = in3.readLine();
   p[0]=xv;
   p[1]=xv;
   xx=p[0];
   yy=p[1];
  
   L=xx.split(" ");
  
   L=yy.split(" ");
  
   X[j]=L[0].toFloat();
  
   ui-&gt;xvalue-&gt;addItem(QString::number((X[j])));
  
   xv.split(" ", QString::SkipEmptyParts);
  
   Y[j]=L[1].toFloat();
  
   ui-&gt;yvalue-&gt;addItem(QString::number((Y[j])));
  
   }`
  </code></pre>
  
  <p>I tried many ways but nothing worked for me</p>