Oh I finally solved the problem
myclass.h
#ifndef MYCLASS_H
#define MYCLASS_H
#include <QObject>
class MyClass : public QObject
{
Q_OBJECT
public:
explicit MyClass(QObject *parent = 0);
signals:
public slots:
void helloMethod(const QString &msg);
};
#endif
myclass.cpp
#include "myclass.h"
#include <QDebug>
MyClass::MyClass(QObject *parent) :
QObject(parent)
{
}
void MyClass::helloMethod(const QString &msg) {
qDebug() << "Called the C++ slot with message:" << msg;
}
↧