Override next button functionality in QWizardPage
-
wrote on 25 Nov 2017, 10:55 last edited by
Hi,
I want to make some things when the next or back button are pressed in a QWizardPage.
But I don't know how to override the functionality of that buttons.I saw in the Qt Documentation page the function nextId: https://doc.qt.io/qt-5/qwizard.html#nextId
But that's only for indicate the order page in non-linear wizards.Some suggestion?
Thanks
-
Hi,
I want to make some things when the next or back button are pressed in a QWizardPage.
But I don't know how to override the functionality of that buttons.I saw in the Qt Documentation page the function nextId: https://doc.qt.io/qt-5/qwizard.html#nextId
But that's only for indicate the order page in non-linear wizards.Some suggestion?
Thanks
wrote on 25 Nov 2017, 11:15 last edited by JonB@Carlavilla
Unless someone knows a better way, could you handle theQWizard::currentIdChanged(int id)
signal?Or, if you have derived your own class from base
QWizard
(always a good idea), you can just overrideQWizard::next()
--- maybe do your own stuff, then call baseQWizard::next()
, depending on what you want to do? -
wrote on 25 Nov 2017, 12:12 last edited by
I've done this:
This is my header file:
class MachineNamePage: public QWizardPage { Q_OBJECT public: ...... signals: ...... public slots: void selectOS(int OSSelected); void next(); protected: private: ...... };
This is my source file:
MachineNamePage::MachineNamePage(QWidget *parent) : QWizardPage(parent) { ...... } void MachineNamePage::next() { qDebug() << "Next"; }
But I don't know how to make the QWizardPage execute the code inside MachineNamePage::next()
-
wrote on 25 Nov 2017, 13:51 last edited by
I solve the problem using the 'validatePage' function.
bool MachineNamePage::validatePage() { return true; }
1/4