PDA

View Full Version : Transferring data from sub-dialog to maindialog



deepakn
2nd July 2007, 06:06
Hello all

I have a dialog which from which i have created few sub-dialogs. These dialogs are activated when i click the corresponding button from maindialog. All sub-dialogs have some input fields and an 'OK' button. When I press OK button, I want the data entered in the input fields to be displayed in the main dialog. I am not sure about the procedure for transferring the data back to maindialog. Could anyone tell me how to do that?

Also, if the user is not entering any data and simply clicking OK, some default values must be displayed in main-dialog.

The main thing is not to display the input data, but to use it for some other purpose [which even i am not much clear about :confused: ]

any examples? any help will be really appreciated. Please let me know if anymore clarification is required from my side.

I use Qt 4.2.2 from WinXP with MinGW.

Thanks :)

Michiel
2nd July 2007, 12:04
There are a couple of ways. But the easiest way I can think of is this:

* In your custom dialog, define a few public functions for retrieving the data.
* Use the return value of exec() to see if the user clicked Cancel or OK.
* Don't destroy the dialog object yet (make sure it doesn't have the Qt::WA_DeleteOnClose attribute activated). Use its public functions to get the data.