I have created a wizard using the GUI and so my pages are all part of the UI.
Now, on one of the pages I want to make the fields mandatory. From looking into the API it appears there is a registerField() function which can also make sure the next button isn’t available until the fields are filled in. However, that function is protected to QWizardPage which means I cannot set this up. Is there a way to carry out this behaviour without needing to create a new class?
I know I can create a new class but I am considering if I create even more pages then I would need to create classes for every page I have. I also thought for sucha simple case it felt a bit like overkill.
Qt designed QWizardPage this way because it is page responsible for fields logic, not other classes. But if you still want to use this (bad designed) pattern, you can simple create QWizardPage wrapper with public member, that calls protected member, and use it instead of QWizardPage. Remember that pages have some logic, and it would be even better, to keep that logic separated from other classes. Also if you have some similar pages, you may reuse one class with some parameteres