Hello all,
I'm trying to get a test app working where a Main Window Menu is used to call a Dialog. Text is entered into the Dialog and then transferred to the Main Window. Sounds easy 


My problem is I don't know how to access the Dialog's lineEdit. I've tried the following, but the compiler gives the error that lineEdit is private.
// from mainwindow.cpp
void MainWindow::on_actionDialog_1_triggered() // if the menu item triggered.
{
Dialog *mydialog = new Dialog(this);
if (mydialog->exec())
{
QString textIn
= mydialog
->ui
->lineEdit
->text
();
ui->textEdit->append(textIn);
}
}
// from mainwindow.cpp
void MainWindow::on_actionDialog_1_triggered() // if the menu item triggered.
{
Dialog *mydialog = new Dialog(this);
if (mydialog->exec())
{
QString textIn = mydialog->ui->lineEdit->text();
ui->textEdit->append(textIn);
}
}
To copy to clipboard, switch view to plain text mode
Here are the files generated by Creator from my Dialog.ui:
ui_dialog.h
dialog.h
dialog.cpp
Thanks.
Bookmarks