Where to control the QWizard button?

冷暖自知 提交于 2019-12-04 02:46:51
Greg S

The best solution is probably the one provided by using QWizardPage::registerField. It allows you to define mandatory fields/radio buttons/etc. and the Next and/or Finish buttons in your wizard are enabled only when all mandatory fields are filled/checked.

See http://doc.trolltech.com/4.6/dialogs-licensewizard.html for an example which makes use of this functionality.

EDIT: QWizard::button provides access to the buttons in the wizard. Have you tried something like myWizard->button(QWizard::NextButton)->setEnabled(false) ?

To disable the next button you can subclass QWizardPage and reimplement isComplete(). When it returns true then QWizard will enable the button. The subclass has to emit the 'completeChanged()' signal when you change the state of isComplete(). The documentation for QWizardPage explains how to do it.

Possibly you could also use

parent->button(QWizard::NextButton)->setVisible(false)

to hide the button.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!