I find these answers here, here and here, but no one can help me for my case because my slot is in another class and the answers is for static slot in the same class.
Consider this code:
class Util : public QObject
{
Q_OBJECT
public slots:
static void clean(); // static
private:
Util(QObject *parent=0): QObject(parent){} // be always static
};
class Handler: public QObject
{
Q_OBJECT
public:
Handler(QObject *parent=0): QObject(parent){}
signals:
void cleanup();
};
and MainWindow function connectSignal();
void MainWdindow::connectSignal()
{
Handler *handler = new Handler();
connect(handler, SIGNAL(cleanup), &Util::clean) // compile error
}
the error is:
no matching function for call MainWindow::connect(Handler*&, const char*, void(*)())
....
note: cannot convert Util::clean(type void(*)()) to type const QObject*
any help is appreciated. Thanks
UPDATE
Solved, solution in the comments