A warning message "No matching signal for" when executing my application

Viewed 369

When executing my application some warning messages appear:
QMetaObject::connectSlotsByName: No matching signal for on_actionUndo_triggered(), QMetaObject::connectSlotsByName: No matching signal for on_actionRedo_triggered()

I have implemented the rule void on_objectName_signalName(signalParameters); to the signal and slot that I have created and I don't know why that messages appear, note that the signal and slot work fine.

Declaration:

class Widget : public QWidget {
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = 0);
    ~Widget();

private:
    Ui::Widget *ui;
    QAction *actionUndo;
    QAction *actionRedo;

private slots:
    void on_actionUndo_triggered();
    void on_actionRedo_triggered();
};

Definition:

Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) {
    ui->setupUi(this);   
    QVBoxLayout *layout = new QVBoxLayout(this);
    QMenuBar *menuBar = new QMenuBar();
    QMenu *editMenu = new QMenu("&Edit");
    menuBar->addMenu(editMenu);

    this->actionUndo = new QAction("&Undo", editMenu);
    this->actionUndo->setShortcut(QKeySequence::Undo);
    QObject::connect(this->actionUndo, SIGNAL(triggered()), this, SLOT(on_actionUndo_triggered()));

    this->actionRedo = new QAction("&Redo", editMenu);
    this->actionRedo->setShortcut(QKeySequence::Redo);
    QObject::connect(this->actionRedo, SIGNAL(triggered()), this, SLOT(on_actionRedo_triggered()));

    editMenu->addAction(this->actionUndo);
    editMenu->addAction(this->actionRedo);

    this->layout()->setMenuBar(menuBar);
}

Widget::~Widget() {
    delete ui;
}


void Widget::on_actionUndo_triggered() {

}

void Widget::on_actionRedo_triggered() {

}
1 Answers
Related