The following code is used by me in order to send the value in a table view in one window to the line edit in another window. but i get an error! how can i correct it?
void firstWindow::on_tableView_activated(const QModelIndex &index)
{
QString val=ui->tableView->model()->data(index).toString();
firstWindow conn;
conn.connOpen();
QSqlQuery qry;
qry.prepare("Select MESSAGE_ID from Message where MESSAGE_ID='"+val+"'");
if(qry.exec())
{
while(qry.next())
{
Window2 a;
ui->message->setText(qry.value(0).toString());
}
}
conn.connClose();
}
here firstwindow is one class which has a connOpen() method to connect to a database( works properly), when the user clicks a row retrieved from the database i want it to appear in a line edit named message in a window which belongs to a class named window2. But I get an error stating that message is not a member of firstWindow class! How can i correct this issue?