So i have a custom class extending QWidget. I have tried adding a custom slot to it. However it keeps giving me the error:
"QObject::connect: No such slot QWidget::closeSlot() in ..\menuTest\menu.cpp:13".
My code is:
#include "menu.h"
Menu::Menu()
{
exitButton = new QPushButton;
exitButton->setText(tr("Exit"));
connect(exitButton, SIGNAL(clicked()), this, SLOT(closeSlot()));
QVBoxLayout * layout = new QVBoxLayout;
layout->addWidget(exitButton);
this->setLayout(layout);
}
void Menu::closeSlot()
{
qDebug() << "I'm inside";
}
and the header file:
#ifndef MENU_H
#define MENU_H
#include "allIncludes.h"
class Menu : public QWidget
{
public:
Menu();
private:
QPushButton * exitButton;
private slots:
void closeSlot();
};
#endif // MENU_H