PDA

View Full Version : Transfer Data Between Dialogs



umulingu
19th February 2010, 05:17
Hai

I have some doubts on data sharing between UI Dialogs or Classes.

I want to get the value of textedit in another window.like that.

suggestion please


suree
Bangalore

nish
19th February 2010, 05:39
take a look at the dialogs example which comes with qt

navi1084
19th February 2010, 05:41
Create the instance of the class wherever you want to get the value of that class and write public function to get the value of controls.

Ex: if classA contains the textedit and you want to access the value in classB use the instance of classA in class B and expose a method in classA to get the value of textedit and use it in classB by calling it.

soumya
19th February 2010, 05:41
Store the lineedit value in a variable and call it in the other form using extern below is the code snippet


int input1;
input = lineEdit->text().toInt();

In the next window.cpp use

extern int input1;
ineEdit->setText(QString::number(input1,10 ) );

Hope this helps

Lykurg
19th February 2010, 08:35
This question was asked before. Several times. Please use the search engine of the forum.
Solutions: A signal/slot connection or a pointer to the other dialog.