I want to disable or hide Back button in QWizard dialog. How can I do it?
I've looked at Qt's sources and found out that it's possible to hide Back button by creating custom button layout and ommiting Back button in the list:
QList<QWizard::WizardButton> button_layout;
button_layout << QWizard::HelpButton << QWizard::Stretch <<
QWizard::NextButton << QWizard::CustomButton1 <<
QWizard::CancelButton;
this->setButtonLayout(button_layout);
I hope this will save some time to somebody.
P.S.
AFAIU to avoid using QTimer it is needed to modify QWizard source code. The easies way will be to add a virtual function virtual void buttonsUpdated(); and call it from the end of QWizard's: void QWizardPrivate::_q_updateButtonStates() Then reimplement this buttonsUpdated() in your QWizard sublass and disable Back button there.
Calling
QWizard::button(QWizard::BackButton).hide()
in
QWizard::onCurrentIdChanged(int)
worked for me (in PyQt4).
This effectively hides the back button again on every wizard page, but it achieves the desired effect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With