A form returning an object.
Hi all,
I know how to pass an object to a form which can be done through the constructor.
What I don't now is how i can return an object used and declared in a form.
For example i have two forms frmA and frmB. In frmB i have a linedit widget and i want to pass these contents to an object and then pass the object to formA. The idea behind it is that I can pass lots of data through an abject (say for example the contents of 20 lineedits through an object).
Can please one write a sample code for that?
Many thanks in advance.
Re: A form returning an object.
I assume u mean dialogs by forms .
You can always have functions to retrieve the data from dialog.
For eg -
Code:
MyDialog dlg;
if(dlg.exec() == Qt::Accepted)
{
QString text
= dlg.
getLineEditText();
// You get the text of the line edit here
// Now pass it on to another dialog or use it as u want
dlg2.setLineEditText(text);
}
Hope you get the idea :)
Re: A form returning an object.
Many thanks for the reply.
Is the object of the dialogue killed when the user closes the form? or if it is not do i have to delete this object as soon as i read the things that i want to read form it (ex lineedits).
What is the .getlineedit and setlineedit?. I cant find them in the documentation
Many thanks
Re: A form returning an object.
The object has scope of a normal object. I hope u know c++
the getLinedEditText, setLineEditText are user defined functions. I assume you had inherited the dialog, and those are member functions of ur class.