[Solved] how to add a handler to handle clicking cancel on QWizardPage

  • I want to do some cleaning process while the user clicking the cancel button on QWizardPage. I know there is already a virtual function cleanupPage() in QWizardPage, but the reference document said that the cleanupPage() would be called when the user leaves the page by clicking Back. It doesn't mention about leaving page by clicking Cancel.

    Would cleanupPage() be called when the user clicking cancel?
    Can I add a handler to handle clicking cancel? or is there any alternative way to handle such cleaning process? Thank you.

    The QWizardPage API reference
    "About cleanupPage() in QWizardPage":http://qt-project.org/doc/qt-4.8/qwizardpage.html

  • I want to release resources which was used in individual pages. While the user leaves the page, I want all resource that was no longer used to be released.

    I have tried using cleanupPage() to release resources current page was using, but it doesn't work. The function cleanupPage() would only be called while I clicking cancel or back.

  • A QWizard is a subclass of QDialog. QDialog has the rejected() signal, that is fired when the dialog (the wizard) is cancelled (or otherwise rejected). You can connect to that signal to do your cleanup.

Log in to reply