×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    4

    Question QWizard - value from previous page into next page?

    Hello Team,

    I am developing a Wizard using QWizard. I have a QListWidget areaList on first page of the wizard. Per QWizardPage documentation, I have registered the widget:

    registerField("areaIndex", areaList);

    However, when I try to get the field "areaIndex" in the subsequent page, it gives me the row number in the QListWidget. I am interested in getting the QListWidgetItem->text() on the next page.

    How do I get this text value from previous page into next page?

    Please let me know.

    Thank you!
    Anagha

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QWizard - value from previous page into next page?

    Code:
    areaList->currentItem()->text();

  3. #3
    Registered User
    Join Date
    Feb 2010
    Posts
    4

    Question Re: QWizard - value from previous page into next page?

    Thank you for your reply Daniil.

    However, the areaList is not visible in the next page.
    Besides, I am wondering if the mehtods register() field() can be enhanced for transmitting the "areaList->currentItem()->text()" to the subsequent Wizard Pages.

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QWizard - value from previous page into next page?

    Quote Originally Posted by Anagha_T View Post
    However, the areaList is not visible in the next page.
    Are you sure?

  5. #5
    Registered User
    Join Date
    Feb 2010
    Posts
    4

    Re: QWizard - value from previous page into next page?

    As seen below, the "QListWidget *areaList" is in IntroPage & hence not seen in the Survey page:



    class MyWizard : public QWizard
    {
    Q_OBJECT

    public:
    enum { Page_Intro, Page_Survey, Page_Conclusion };
    MyWizard(QWidget *parent = 0);

    private slots:
    void showHelp();
    };

    class IntroPage : public QWizardPage
    {
    Q_OBJECT

    public:
    IntroPage(QWidget *parent = 0);
    QListWidget *areaList;
    :
    :
    };

    class SurveyPage : public QWizardPage
    {
    Q_OBJECT

    public:
    SurveyPage(QWidget *parent = 0);

    :
    :
    };

  6. #6
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QWizard - value from previous page into next page?

    You can move areaList to QWizard class making it accessible for all pages.

  7. #7
    Registered User
    Join Date
    Feb 2010
    Posts
    4

    Question Re: QWizard - value from previous page into next page?

    When I move the areaList to QWizard:

    ----------------------------------------------------------------------------------
    class MyWizard : public QWizard
    {
    Q_OBJECT

    public:
    enum { Page_Intro, Page_Survey, Page_Conclusion };
    MyWizard(QWidget *parent = 0);
    QListWidget *areaList;
    private slots:
    void showHelp();
    };

    ----------------------------------------------------------------------------------
    And try to access it in other pages like:


    IntroPage::IntroPage(QWidget *parent)
    : QWizardPage(parent)
    {
    setTitle(tr("Step 1: Select an Area"));
    setSubTitle(tr("..."));

    MyWizard::areaList = new QListWidget;
    :
    :
    }



    I get the following compilation error:

    MyWizard.h: In constructor ‘IntroPage::IntroPage(QWidget*)’:
    MyWizard.h:30: error: object missing in reference to ‘MyWizard::areaList’
    MyWizard.cpp:127: error: from this location

    ----------------------------------------------------------------------------------

    Am I missing something?
    How can I declare the areaList so that it's accessible to all the pages of MyWizard?

    Thank you!

  8. #8
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QWizard - value from previous page into next page?

    Code:
    IntroPage::IntroPage(QWidget *parent)
         : QWizardPage(parent)
    {
         setTitle(tr("Step 1: Select an Area"));
         setSubTitle(tr("..."));
    
         MyWizard *wizard = qobject_cast<MyWizard *>(wizard());
         wizard->areaList = new QListWidget;
    }
    And note you store pointer to list in MyWizard, while it's created, belongs and destroyed by IntroPage. This is design flaw and potential source of bugs.

Similar Threads

  1. Thoughts: Taking the Presence Page Up a Notch
    By ARJWright in forum Mobile Web Server
    Replies: 1
    Last Post: 2009-04-03, 01:34
  2. FATAL ERROR - Applet 17 with certain png's
    By OneNineStudios in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2008-12-17, 13:11
  3. go to previous page.
    By itziks in forum Browsing and Mark-ups
    Replies: 2
    Last Post: 2007-01-18, 16:15

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×