Results 1 to 5 of 5

Thread: text from form1 to form2

  1. #1
    Join Date
    Jan 2013
    Posts
    44
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default text from form1 to form2

    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

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: text from form1 to form2

    The correct answer with Qt is to use signals and slots 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.

  3. The following user says thank you to Zlatomir for this useful post:

    vanduongbk (15th June 2013)

  4. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: text from form1 to form2

    Quote Originally Posted by vanduongbk View Post
    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #4
    Join Date
    Jan 2013
    Posts
    44
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: text from form1 to form2

    Quote Originally Posted by Zlatomir View Post
    The correct answer with Qt is to use signals and slots 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.

    Quote Originally Posted by wysota View Post
    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?

  6. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: text from form1 to form2

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. show form2 from form1( form1 will hide)
    By jindoniit in forum Newbie
    Replies: 1
    Last Post: 5th July 2011, 09:18
  2. transfer graphicsscene on form1 to graphicsscene on form2
    By rogerholmes in forum Qt Programming
    Replies: 2
    Last Post: 25th September 2009, 20:37
  3. Replies: 1
    Last Post: 3rd September 2008, 14:16
  4. Replies: 1
    Last Post: 7th November 2007, 08:39
  5. accessing form1's objects from form2
    By Philip_Anselmo in forum Newbie
    Replies: 5
    Last Post: 4th May 2006, 22:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.