I have created a modal dialog and it responds to the 'ok' and 'cancel' buttons fine. My main issue is that when I attempt to put code to access the other fields in the dialog I get some errors:
//popup for modal dialog:
void PulseMain::popupmodal() {
//create a dialog box:
DialogLogin dlg(this);
//do something once we click OK:
if( dlg.
exec() == QDialog::Accepted ) {
//initialize a place to put our login information:
var_login login;
// Extract the information from the dialog
login.username = dlg.userid->text();
login.password = dlg.password->text();
QMessageBox::warning( this,
"Dialog results!",
"We clicked OK!");
//else do something when we click cancel:
} else {
QMessageBox::warning( this,
"Dialog results!",
"We canceled it!");
}
//dlg.exec();
}
//popup for modal dialog:
void PulseMain::popupmodal() {
//create a dialog box:
DialogLogin dlg(this);
//do something once we click OK:
if( dlg.exec() == QDialog::Accepted ) {
//initialize a place to put our login information:
var_login login;
// Extract the information from the dialog
login.username = dlg.userid->text();
login.password = dlg.password->text();
QMessageBox::warning( this, "Dialog results!", "We clicked OK!");
//else do something when we click cancel:
} else {
QMessageBox::warning( this, "Dialog results!", "We canceled it!");
}
//dlg.exec();
}
To copy to clipboard, switch view to plain text mode
everything works fine when the following lines are removed:
login.username = dlg.userid->text();
login.password = dlg.password->text();
login.username = dlg.userid->text();
login.password = dlg.password->text();
To copy to clipboard, switch view to plain text mode
when the lines are there I get the following error message when compiling the program:
ui_dialog_login.h:29: error: 'QLineEdit* Ui_DialogLogin::userid' is inaccessible
calculatorform.cpp:48: error: within this context
ui_dialog_login.h:30: error: 'QLineEdit* Ui_DialogLogin:

assword' is inaccessible
calculatorform.cpp:49: error: within this context
so it seems that I am using the wrong route to access the text items in the dialog. I am sure that its something simple that I am missing that would make this work properly. Anyone have an idea?
Bookmarks