Error is: error: no matching function for call to 'QObject::connect(MainWindow*, const char*, MainWindow*, const char*)'
In second() member function the slot progress() is not matching with the definition.
So can anyone please solve the problem.
#include <QtCore/QCoreApplication>
#include<QFuture>
#include<QtConcurrentMap>
#include<QtCore>
#include<QString>
int i =0;
namespace Ui {
class MainWindow;
}
class MainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
signals:
void finished();
public slots:
void progress(const QString& status);
public:
void search();
void second();
};
void MainWindow::progress(const QString& status)
{
printf("progress bar %d is finished", i);
i++;
}
void MainWindow::search()
{
QFuture<void> future=QtConcurrent::run(this,&MainWindow::second);
}
void MainWindow::finished()
{
printf("signal got finished");
}
void MainWindow::second()
{
MainWindow n,o;
QObject::connect(&n,SIGNAL(finished()),&o,
SLOT(progress(const QString&)));
o.progress("hello");
}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
MainWindow mi;
mi.search();
return a.exec();
}