PDA

View Full Version : Is lineEdit from dialog connectable to textEdit from mainwindow?



knutson
16th January 2014, 14:14
It's my third day in Qt and the second day I'm trying to find any reasonable solution to insert a text from my dialog to the textEdit widget on the mainwindow. I know it's a C++ question and I suspect it's about inheritance, but please be kind to me. I am not a programmer and I will never be, I am a linguist. Please don't give me any advices about further readings, just help me with the problem. The code is attached: 9941.

anda_skoa
16th January 2014, 16:11
The easiest way for you is to add a getter to the dialog that returns teh text


QString Dialog::text() const
{
return ui->lineEdit->text();
}

and then call that in MainWindow


Dialog dlg;
dlg.exec();

ui->textEdit->append(dlg.text());


Cheers,
_