All this code is in MainWindow class. In the header I define modelCell as
{
Q_OBJECT
public:
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
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.
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
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.
void MainWindow::on_btnSaveConductivityTest_clicked()
{
QSqlRecord record
= modelCell
->record
(ui
->cmbCellList
->currentIndex
());
lstr = record.value(0).toString();
ui->lineEdit->setText(lstr);
void MainWindow::on_btnSaveConductivityTest_clicked()
{
QSqlRecord record = modelCell->record(ui->cmbCellList->currentIndex());
QString lstr;
lstr = record.value(0).toString();
ui->lineEdit->setText(lstr);
To copy to clipboard, switch view to plain text mode
Bookmarks