title: Undeclared Identifier (header file included)
body: <pre><code>#ifndef MAINWINDOW_H
  #define MAINWINDOW_H
  #include &lt;QMainWindow&gt;
  #include &lt;QFile&gt;
  #include &lt;QFileDialog&gt;
  #include &lt;QTextStream&gt;
  #include &lt;QStandardItemModel&gt;
  
  namespace Ui {
      class MainWindow;
  }
  
  class MainWindow : public QMainWindow{
      Q_OBJECT
  public:
      Ui::MainWindow *ui;
      QList&lt;QStringList&gt; csv;
      QStandardItemModel *model;
      QList&lt;QStandardItem*&gt; standardItemList;
      MainWindow(QWidget *parent = 0);
      ~MainWindow();
  private slots:
      void on_action_Open_triggered();
      void checkString(QString &amp;temp, QChar ch = 0);
  };
  
  #endif // MAINWINDOW_H
  </code></pre>
  
  <p><strong>maindwindow.cpp</strong></p>
  
  <pre><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  #include &lt;iostream&gt;
  #include &lt;QDebug&gt;
  
  MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent),ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
      QObject::connect(ui-&gt;Open, SIGNAL(clicked()),
                       this,SLOT(on_action_Open_triggered()));
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  
  void MainWindow::on_action_Open_triggered()
  {
  
      model = new QStandardItemModel(this);
      ui-&gt;tableView-&gt;setModel(model);
  
      QString fileName = QFileDialog::getOpenFileName(this, "Open CSV file",QDir::currentPath(), "csv (*.csv)");
      QFile file(fileName);
  
      if (file.open(QIODevice::ReadOnly))
      {
  
          QString data = file.readAll();
          data.remove(QRegExp("\r")); // remove all carriage return characters
          QString temp;
          QChar ch;
          QTextStream instream (&amp;data);
  
          while (!instream.atEnd())
          {
              instream &gt;&gt; ch;
              if (ch == ',')
                  checkString(temp, ch);
              else if (ch == '\n')
                  checkString(temp, ch);
              else if (instream.atEnd())
              {
                  temp.append(ch);
                  checkString(temp);
              } else
                  temp.append(ch);
          }
      }
  }
  
  void MainWindow::checkString(QString &amp;temp, QChar ch)
  {
  
      if (temp.count("\"")%2 == 0)
      {
          if (temp.startsWith(QChar('\"')) &amp;&amp; temp.endsWith(QChar('\"')))
          {
              temp.remove(QRegExp("^\""));
              temp.remove(QRegExp("\"$"));
          }
  
          temp.replace("\"\"", "\"");
          QStandardItem *item = new QStandardItem(temp);
          standardItemList.append(item);
  
          if (ch != QChar(','))
          {
          }
  
          temp.clear();
      } else
          temp.append(ch);
  }
  
  void something()
  {
      qDebug() &lt;&lt; standardItemList;
  }
  </code></pre>
  
  <p>I am being told standardItemList, undeclared identifier in the something function(why not in the checkstring function?). However I have included mainwindow.h and that includes a definition of standardItemList. does it have something to do with the standardItemList containing *item and that is declared within checkString</p>