I try to become more familiar with singnals and slots with Qt. I want to emit a signal in one class and want to handle it at one other. Here my example code:
main.c
#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } mainwindow.h
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> class Emiter { signals: void anSignal (); }; class MainWindow : public QMainWindow { Q_OBJECT private slots: void handleEmitter (); public: MainWindow(QWidget *parent = 0); }; #endif // MAINWINDOW_H mainwindow.cpp
#include "mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { auto emiter = new Emiter(); connect( emiter, &Emiter::anSignal, this, &MainWindow::handleEmitter ); } void MainWindow::handleEmitter() { } Then I get this error:
error: ‘qt_metacall’ is not a member of ‘Emiter’ enum { Value = sizeof(test(&Object::qt_metacall)) == sizeof(int) }; What does this mean?