问题
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