How to solve Object::connect: No such signal
-
You are mixing old and new connect syntax.
Either use this:
// Old syntax connect(this, SIGNAL(MainWindow::newImage(const QImage)), this, SLOT(MainWindow::setImage(const QImage)));Or this:
// New syntax: connect(this, &MainWindow::newImage, this, &MainWindow::setImage);I recommend using new syntax whenever possible.
-
You are mixing old and new connect syntax.
Either use this:
// Old syntax connect(this, SIGNAL(MainWindow::newImage(const QImage)), this, SLOT(MainWindow::setImage(const QImage)));Or this:
// New syntax: connect(this, &MainWindow::newImage, this, &MainWindow::setImage);I recommend using new syntax whenever possible.
@sierdzio I was using the new version but I get the error of matching
error: no matching function for call to ‘qdude::MainWindow::connect(qdude::MainWindow*, void (qdude::MainWindow::*)(const QImage&), qdude::MainWindow*, void (qdude::MainWindow::*)(const QImage&))’ -
@jaouad100 said in How to solve Object::connect: No such signal:
void setImage(const QImage &);
Make this method as slot:
protected slots: void setImage(const QImage &); -
@jaouad100 said in How to solve Object::connect: No such signal:
void setImage(const QImage &);
Make this method as slot:
protected slots: void setImage(const QImage &); -
@sierdzio I was using the new version but I get the error of matching
error: no matching function for call to ‘qdude::MainWindow::connect(qdude::MainWindow*, void (qdude::MainWindow::*)(const QImage&), qdude::MainWindow*, void (qdude::MainWindow::*)(const QImage&))’@jaouad100 said in How to solve Object::connect: No such signal:
@sierdzio I was using the new version
If you say you are using the "new version" syntax, we would not expect to see
SIGNAL()orSLOT().Would you care to either confirm your code is still exactly as shown in your first post, or update it correctly?
-
@jaouad100 said in How to solve Object::connect: No such signal:
@sierdzio I was using the new version
If you say you are using the "new version" syntax, we would not expect to see
SIGNAL()orSLOT().Would you care to either confirm your code is still exactly as shown in your first post, or update it correctly?
-
@jaouad100
Then I think (I am not a C++-er) you'll find that as @sierdzio wrote for the old syntax you need to remove the two&characters prior toMainWindow::in bothSIGNAL()&SLOT()(because they effectively put their own&in for you) .... -
@jaouad100
Then I think (I am not a C++-er) you'll find that as @sierdzio wrote for the old syntax you need to remove the two&characters prior toMainWindow::in bothSIGNAL()&SLOT()(because they effectively put their own&in for you) .... -
@jaouad100
If it is not the issue, then why does your error message read:
qdude::MainWindow::&MainWindow::newImage(const QImage&*)
with that middling&in it? I believe it is....If I wanted to use the old syntax, I would be writing:
QObject::connect(this, SIGNAL(newImage(const QImage &)), this, SLOT(setImage(const QImage &)));exactly as per e.g. http://doc.qt.io/qt-5/qobject.html#connect
-
@jaouad100
If it is not the issue, then why does your error message read:
qdude::MainWindow::&MainWindow::newImage(const QImage&*)
with that middling&in it? I believe it is....If I wanted to use the old syntax, I would be writing:
QObject::connect(this, SIGNAL(newImage(const QImage &)), this, SLOT(setImage(const QImage &)));exactly as per e.g. http://doc.qt.io/qt-5/qobject.html#connect