No such slot
-
Something I don't understand about slots i guess . My slot function never gets called .
I see a message that says :
QObject::connect: No such slot Lobby::Lobby::onMyButtonClick() in lobby.cpp:13@#pragma once
#include <QtWidgets/QWidget>
class Lobby : public QWidget
{Q_OBJECT
public:
Lobby(QWidget *parent = 0);protected:
void keyPressEvent(QKeyEvent * e);
void closeEvent(QCloseEvent * e);public slots:
void onMyButtonClick();};
#include <QPushButton>
#include <QApplication>
#include <QKeyEvent>
#include "lobby.h"Lobby::Lobby(QWidget *parent)
: QWidget(parent)
{
QPushButton *myButton = new QPushButton("button", this);
myButton->setGeometry(50, 40, 75, 30);connect(myButton, SIGNAL(clicked()), this, SLOT(Lobby::onMyButtonClick()));
}void Lobby::onMyButtonClick()
{//
}
@ -
Hi,
The SLOT and SIGNAL function signatures must not contain the class name, only the function name and argument types.