PDA

View Full Version : text from form1 to form2



vanduongbk
15th June 2013, 04:35
hello everyone
i'm a newbie,
i have use a virtual keyboard to input textboxEdit in form1,
i want to ask how when i click enter button in form1 ->text in textboxEdit (form1) is set to textboxEdit in form2
thank

Zlatomir
15th June 2013, 05:56
The correct answer with Qt is to use signals and slots (http://qt-project.org/doc/qt-4.8/signalsandslots.html) so you will need to add to the form1 a signal with a QString parameter (this will be emitted in the slot that is connected to clicked signal of the button you use to submit the data obviously with the parameter you need) and to the form2 you add a slot with a QString parameter (that sets the QString wherever you need it in form2) and connect those two where you have access to both forms.

Or a second method is to do it with a simple call to a member function of form2 (if you don't already have a pointer to form2 you will need one) - the first solution involves more coding, but that is the recommended way to do it.

wysota
15th June 2013, 07:42
hello everyone
i'm a newbie,
i have use a virtual keyboard to input textboxEdit in form1,
i want to ask how when i click enter button in form1 ->text in textboxEdit (form1) is set to textboxEdit in form2
thank

For using a virtual keyboard you should implement an input context plugin.

vanduongbk
15th June 2013, 17:28
The correct answer with Qt is to use signals and slots (http://qt-project.org/doc/qt-4.8/signalsandslots.html) so you will need to add to the form1 a signal with a QString parameter (this will be emitted in the slot that is connected to clicked signal of the button you use to submit the data obviously with the parameter you need) and to the form2 you add a slot with a QString parameter (that sets the QString wherever you need it in form2) and connect those two where you have access to both forms.

Or a second method is to do it with a simple call to a member function of form2 (if you don't already have a pointer to form2 you will need one) - the first solution involves more coding, but that is the recommended way to do it.

thank for your respond
plz help me in a simple demo code.


For using a virtual keyboard you should implement an input context plugin.

hi wysota;
what is an input context plugin?
and how i can use it in my code ,you can demo it?

wysota
17th June 2013, 09:22
You can type in "Qt input context plugin" into your favourite web search engine or type in "Input panel example" into your Creator/Assistant help panel.