How to disable NextButton in QWizard ?
Hi!
I am working in Qt 4.3 and have created four pages. In the second page, it has a start pushbutton which is used to calibrate cards. I want to make the start pushbutton enabled and the Qwizard NextButton disabled when initialized. To do this I tried to disable the button in the initializePage() or QWizard’s nextId() funtion, but both do not work.
In Qwizard::nextId():
Code:
button(Qwizard::NextButton)->setEnabled(false);
In QwizardPage::initializePage():
Code:
QabstractButton *btn = parentHandle->button(Qwizard::NextButton);
Btn->setEnabled(false);
After I called wizard->show(), I do the following:
Code:
wizard->button(Qwizard::NextButton)->setEnabled(false);
This can disable the QWizard’s NextButton, but if I call it before wizard->show(), it does not work.
If I connect the start pushbutton click signal to a slot, which is to disable the Qwizard’s NextButton, when I click the button it can disable the QWizard’s NextButton. However, I don’t want it to be disabled when I click the button, only when it is initialized.
Any suggestion will be greatly appreciate!
Re: How to disable NextButton in QWizard ?
Take a look at the docs of QWizardPage::isComplete().
Re: How to disable NextButton in QWizard ?
Thanks a million, It solved my problem, i did the following:
Code:
bool QWizardPage::isComplete()const
{
if (startPushButton->isEnabled()) {
return false;
} else {
return true;
}
}
I am puzzled why I can't disable the QWizard's NextButton in QWizardPage::initializePage(). I did the following:
Code:
button->setEnabled(false);
If you have any suggestions why this is the case, I'd be interested to hear the reason!
Any help would be appreciated!
Re: How to disable NextButton in QWizard ?
Maybe the button gets enabled right after you disable it?