Results 1 to 3 of 3

Thread: get data from QWizardPages - which signal?

  1. #1
    Join Date
    Jan 2012
    Posts
    29
    Thanks
    7

    Default get data from QWizardPages - which signal?

    Hi all,

    using QtCreator I have created a QWIzard class and form and promoted the pages to my QWizardPage classes, one for each page. So far so good. Honestly I do not know if it is the proper way do to this, but it is the only one I could find out and seems to work. Is it right?

    Anyway the main question I have is about getting the data the user inserts in these pages (for example in the lineEdit widgets), in order to store it on disk, using QSettings in my case. With other forms I simply connect the signal from a button to a slot, but in this case I can not figure out how to connect the signal from the Next and Finish buttons.

    Thanks,
    Jan

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: get data from QWizardPages - which signal?

    Building a wizard with Designer is done the way you describe. You generally cannot do all the plumbing without resorting to code.

    You can pass data around within the wizard using registered fields. These fields should be available when the user clicks finished and the accepted() signal is emitted by the wizard.

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

    dotjan (20th February 2012)

  4. #3
    Join Date
    Jan 2012
    Posts
    29
    Thanks
    7

    Default Re: get data from QWizardPages - which signal?

    Great, for the QWizard object I have connected the accepted() signal to the slot getData():

    Qt Code:
    1. connect(this, SIGNAL(accepted()), this, SLOT(getData()));
    To copy to clipboard, switch view to plain text mode 

    which is then implemented to get the data:

    Qt Code:
    1. void ProfileWizard::getData()
    2. {
    3. QString name = field("ProfileName").toString();
    4. .....
    5. }
    To copy to clipboard, switch view to plain text mode 
    This worked for me. I could also use the QWizardPage::initializePage () function in the "next" page to get data from the "previous page" but I had the problem I could not figure out how to get data from the last page. A possible workaround was to have one more page to be the final one without getting any data. Of course, the suggested solution does make much more sense.

    Thanks,
    Jan

Similar Threads

  1. how to get data from signal?
    By banlinhtienphong in forum Newbie
    Replies: 1
    Last Post: 27th April 2011, 13:25
  2. Passing data via signal/slot
    By gib in forum Qt Programming
    Replies: 4
    Last Post: 1st November 2010, 05:49
  3. Replies: 0
    Last Post: 20th July 2010, 18:31
  4. QWizard with QWizardPages gives blank pages?
    By Tiansen in forum Qt Programming
    Replies: 4
    Last Post: 4th March 2008, 06:45
  5. sending data over signal
    By gyre in forum Newbie
    Replies: 1
    Last Post: 16th December 2007, 23:10

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.