All this code is in MainWindow class. In the header I define modelCell as
Qt Code:
  1. class MainWindow : public QMainWindow
  2. {
  3. Q_OBJECT
  4. public:
  5. QSqlQueryModel *modelCell;
To copy to clipboard, switch view to plain text mode 
Then I create the pointer. I thought this would allow the pointer to be used in any of the functions of the mainwindow class.

Qt Code:
  1. MainWindow::MainWindow(QWidget *parent) :
  2. QMainWindow(parent),
  3. ui(new Ui::MainWindow)
  4. {
  5. ui->setupUi(this);
  6. QSqlQueryModel *modelCell = new QSqlQueryModel(this);
To copy to clipboard, switch view to plain text mode 

Here is the function I am trying to access the pointer. What am I not doing correctly?
I must be missing something in my fundamental knowledge.

Qt Code:
  1. void MainWindow::on_btnSaveConductivityTest_clicked()
  2. {
  3. QSqlRecord record = modelCell->record(ui->cmbCellList->currentIndex());
  4. QString lstr;
  5. lstr = record.value(0).toString();
  6. ui->lineEdit->setText(lstr);
To copy to clipboard, switch view to plain text mode