PDA

View Full Version : "Innaccessible within this context"



Nefastious
18th October 2009, 13:08
Hi there folks,

I'm having a bit of a weird error here, when I use the following code:


void mainwindow::adddialogslot() {
adddialog *add = new adddialog;
add->show();
if (add->Accepted) {
QSqlRecord patient;
patient.setValue("name", add->lineEdit_name->text());
}
}

The compiler tells me "QLineEdit* Ui_AddDLG::lineEdit_name is inaccessible within this context". I wonder what I am doing wrong. Sample code would be appreciated.

Thanks in advance,

Nefastious :confused:

Lykurg
18th October 2009, 13:19
I guess lineEdit_name is declared private. So you can't reach it from outside of adddialog. So best define a getter for the text.