View Full Version : A form returning an object.

6th September 2008, 16:34
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.

7th September 2008, 11:51
I assume u mean dialogs by forms .
You can always have functions to retrieve the data from dialog.
For eg -

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

Hope you get the idea :)

7th September 2008, 21:54
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

8th September 2008, 06:21
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.