Hi: I'm using a QWizard class, which contains several QWizardPage. For some pages, I need to do something when "Next" button is clicked.
I tried to overwrite the "next" slot in QWizard class, however, it seems this doesn't work. the program still went into the original "next" slot in QWizard class instead the one I implemented.
Does this because of that this next slot is virtual protected? How can I do some things after the next button is clicked?? Thanks for your help.
Follows is the header file of my QWizard class: By the way, the "accept" signal works fine as what I expected.
#ifndef PRIMERWIZARD_H
#define PRIMERWIZARD_H
#include <QWizard>
namespace Ui {
class PrimerWizard;
}
class PrimerWizard : public QWizard {
Q_OBJECT
public:
PrimerWizard(QWidget *parent = 0);
~PrimerWizard();
protected slots:
void next();
void accept();
protected:
void changeEvent(QEvent *e);
private:
Ui::PrimerWizard *ui;
};
#endif // PRIMERWIZARD_H
Can you show the code where you create new wizard instance and connect some signals with its slots?
P.S. I can't leave comments so I've written this as answer. Sorry =)
I create new wizard instance by the QtCreator's wizard (Ha XD) The code is as follows:
PrimerWizard* pW = new PrimerWizard(this);
pW->exec();
And the signal-slot connection of "next" is created by QtCreator, I cannot find where it's actually connected. I think the connection is builded in ui_PrimerWizard.h by the function:
QMetaObject::connectSlotsByName(PrimerWizard);