Hi!
I am making a GUI app with wizard structure and I have:
- the main.cpp
- the class MainWindow : public QMainWindow basic class
- class BaseWizard : public QWizard
- class BasePage : public QWizardPage
- all the pages(wp1, wp2, wp3 …) like this: class WP1 : public BasePage (they inherit from BasePage)
Then in wp1 I have 2 big buttons which you can focus the with tab. If you press 'L' when button1 has focus, you go to wp2, and if the focus is on button2, you go to wp3.
Now I want to know if the user choose to go to wp2 or wp3, so I decided to put a var (int iA; ) in Basepage (cause its common to all pages) and change iA's value on the page I want to, so I have:
On basepage.h:
public:
void setA(int i);
int getA() {return iA;};
private:
int iA;
public:
void setA(int i);
int getA() {return iA;};
private:
int iA;
To copy to clipboard, switch view to plain text mode
on wp2.cpp:
void WP2::initializePage()
{
BasePage::setA(0);
}
void WP2::initializePage()
{
BasePage::setA(0);
}
To copy to clipboard, switch view to plain text mode
on wp3.cpp:
void WP3::initializePage()
{
BasePage::setA(1);
}
void WP3::initializePage()
{
BasePage::setA(1);
}
To copy to clipboard, switch view to plain text mode
So I know that if getiA() returns 0 means the user chose the first option, and if it returns 1 the user chose the second.
The problem is that setA() works fine but then the var iA gets any number lately, and I don't make any other setA()... so when I am on w5 and I want to do a BasePage::getA() it returns 0 or 4 or 5 or... instead of (in case the user chose the second button) ...1 .
Any idea of why? Any idea of how can I pass the information throw wizardpages?
I know that you can registerfield() but that is only for wdgets like lineedits, so it doesn't work here.
Thanks.
Bookmarks