Results 1 to 4 of 4

Thread: passing data from forms

  1. #1
    Join Date
    Mar 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default passing data from forms

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: passing data from forms

    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,
    _

  3. #3
    Join Date
    Mar 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: passing data from forms

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

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

    Default Re: passing data from forms

    Quote Originally Posted by shreeram View Post
    I am sorry... I tried googling what getter function is.. I am just not able to understand..
    http://en.wikipedia.org/wiki/Mutator_method
    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. [solved] Passing QVector between forms
    By KeineAhnung in forum Newbie
    Replies: 4
    Last Post: 23rd May 2014, 09:50
  2. Passing data to a QThread
    By lynchkp in forum Newbie
    Replies: 4
    Last Post: 10th March 2011, 22:02
  3. Passing variables between forms.
    By Splatify in forum Newbie
    Replies: 9
    Last Post: 21st February 2011, 11:12
  4. SEnding data between forms
    By core_st in forum Newbie
    Replies: 1
    Last Post: 31st January 2011, 09:23
  5. Writing Data Aware Forms in QT4.
    By gsQT4 in forum Qt Programming
    Replies: 5
    Last Post: 21st March 2007, 10:35

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
  •  
Qt is a trademark of The Qt Company.