Access QWizardPage created by Qt Designer

余生长醉 提交于 2021-01-27 20:34:51

问题


I am using Qt Designer to create a QWizardPage.

I have imported the file into Qt Creator and it runs fine so far (I can build the project and run the wizard just fine)

Now I need to reimplement the isComplete function but I an unable to understand how to do it. The pages are named wizardPage{,1,2_1,_2}. I would like to know whats the best way to reimplement the isComplete() function now.


回答1:


In order to overload the isComplete() function of a QWizardPage, you need to create the QWizardPage yourself. Basically, layout a form -- like you would a dialog -- for only the page you want. Create a class for that page. This class inherits from QWizardPage and reimplements isComplete() for whatever checks you desire. Now in your wizard, find where you want the page to be. Delete all the widgets on it, then right-click and select Promote Widget.... Enter your class name and the path to the header file. Now when you compile, it should use an instance of your class for that page, including your override for isComplete().




回答2:


I am not sure what you are trying to ask but return false from isComplete() if you want to disable "Next" button of the wizard.

When you want to enable the "Next" button emit completeChanged() signal and return true.

The default implementation already returns true. So you may not even need to override this method.

I hope this helps.



来源:https://stackoverflow.com/questions/6408481/access-qwizardpage-created-by-qt-designer

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