我试图通过其子类覆盖onEntry和onExist上的QState函数。我该如何调用QState的构造函数。我对重新实现QState感到困惑。
class s : public QState
{
public:
s(QState *parent = 0);
~s();
protected:
void onEntry(QEvent *event) override;
void onExit(QEvent *event);
};
void s::onEntry(QEvent *event)
{
qDebug("on enter");
}
void s::onExit(QEvent *event)
{
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
s * state = new s();
}
和QState就像:
class QState
{
protected:
.
.
public:
void onEntry(QEvent *event);
void onEntry(QEvent *event)
};