July 5, 2012

Donita Doll Donita Doll
Lab Rat
20 posts

[Solved] Using nextId() in linear wizard

 

I’m trying to create a linear wizard like this.

  1. this->setPage(Page_First, new PageReport());
  2. this->setPage(Page_Second, new PageSetting());
  3. ....
  4. this->setPage(Page_Final, new PageResult());

Each pages in my wizard is added by using setPage(), which allow us to set the page ID

I want to display the string “show result” on the next button in all wizard pages. I use the following source to achieve this goal, but it failed.

  1. if (Page_Final == nextId()) {
  2.  setButtonText(QWizard::NextButton, QString("show result"));
  3. }

I checked the return value of nextId(). It always gives me -1. I know that I didn’t implement the nextId() but I want to know which page would be the next. Can I get the next page ID in a linear wizard without implementing nextId()? Thank you

2 replies

July 5, 2012

Donita Doll Donita Doll
Lab Rat
20 posts

I know there are many alternatives to replace the text on the next button. But I want to use these pages to create many different wizards with different purposes. I don’t want to take care with the page order or which page is the next. I just want to know “is the next page have the page ID Page_Final?”

Thanks again.

July 6, 2012

Donita Doll Donita Doll
Lab Rat
20 posts

I figured out why nextId() always returns -1. The reason is that I was using the nextId() in the constructor. Before the QWizardPage being inserted into QWizard, QWizard has no reason to know which page is the next page of current page.

It’s a stupid mistake. Sorry for disturbance.

 
  ‹‹ How to prevent changing selection in QtableView, if the data is invalid?      SQLITE with QT Application... ››

You must log in to post a reply. Not a member yet? Register here!