PDA

View Full Version : passing data from forms



shreeram
16th March 2015, 18:14
Hello everybody, I am very new to Qt.. I have a QWidget which is my main form. In it, if a radio button is clicked, a pop up window appears, which is a separate QDialog I added as a 2nd form. Till this, it is fine.. Now there are line edits in the 2nd form which the user fills.. I want the data to be used in the 1st form. How to go about it?

P.S I hope I am clear.
and thanks for your time

Regards
Shree

anda_skoa
16th March 2015, 18:55
That depends on how you are using the dialog.
If this is a modal dialog, i.e. one that you display using exec(), then simply add getter functions and call them after exec() to retrieve the values.

If it is a non-modal dialog, i.e. one that you display using show(), then add signals that are emitted then the values change or a signal that emits all the values when the dialog is closed.

Cheers,
_

shreeram
17th March 2015, 14:41
That depends on how you are using the dialog.
If this is a modal dialog, i.e. one that you display using exec(), then simply add getter functions and call them after exec() to retrieve the values.

If it is a non-modal dialog, i.e. one that you display using show(), then add signals that are emitted then the values change or a signal that emits all the values when the dialog is closed.

Cheers,
_

I am sorry... I tried googling what getter function is.. I am just not able to understand.. I use modal dialog box. It would be great if you could explain with an example code..
Thanks

wysota
17th March 2015, 15:37
I am sorry... I tried googling what getter function is.. I am just not able to understand..
http://en.wikipedia.org/wiki/Mutator_method