Can't emit signal in android.
-
I have this signal in my project;
void sendImage(cv::Mat &imgMat, QImage &imgQImage);
Project compiles on both Mingw and Visual Studio but when i try to build for Android, i get "error: no matching function for call to imageReader::sendImage(cv::Mat&, QImage)" error.
I tested my pro file on different project, try clean/run qmake/clean/rebuild, remove cv::Mat from signal but nothing worked.
What can be the problem?
Edit;
#ifndef READERMANAGERQMLINTERFACE_H #define READERMANAGERQMLINTERFACE_H #include <QObject> #include <QDebug> #include "readermanager.h" class ReaderManagerQMLInterface : public QObject { Q_OBJECT public: explicit ReaderManagerQMLInterface(QObject *parent = 0); ~ReaderManagerQMLInterface(); readerManager rManager; private: signals: void reqIm(); public slots: void sendImage(QImage &imgQImage); //cv::mat removed }; #endif // READERMANAGERQMLINTERFACE_H
imageReader;
#ifndef IMAGEREADER_H #define IMAGEREADER_H #include <QObject> #include <QImage> #include <QDebug> #include <QThread> #include <QDir> #include <QFile> #include <opencv/cv.h> class imageReader : public QObject { Q_OBJECT public: explicit imageReader(QObject *parent = 0); ~imageReader(); imgHelpers imHelpers; signals: void sendImage(QImage &imgQImage);//cv::mat removed public slots: void requestImage(); void setFrame(int frameID); void loadImage(QString fileName); }
-
Hi and welcome to devnet,
Do you get any warning related to that function when building for Windows ?
-
@SGaist said:
Hi and welcome to devnet,
Do you get any warning related to that function when building for Windows ?
Hi, thanks :)
No, i get no warning with -Wall.
-
I meant on stdout when running your application. Which connection syntax are you using ?
-
Nope, i get nothing on stdout.
I connect signal/slot like this;
QObject::connect(this->rManager.imreader, SIGNAL(sendImage(QImage&)), this, SLOT(sendImage(QImage&)) );
I also tried new syntax but nothing changed :/
connect(this->rManager.imreader, &imageReader::sendImage, this, &MainWindow::sendImage );
-
Hi,
I opened an issue in bugreports.qt.io, you can find details in there.
-
To sum up what happened is that you were trying to send a reference to a temporary object thus it failed
-
Yes, basically; "emit signal( Object() );" works with Visual C++(and iirc Intel) but not with GCC.
And for the Mingw; it was my mistake :)(sorry about that), when i tested my codebase with it, i didn't use "signal( Object() )" but didn't realize i didn't tested with final codebase(sometimes Qt Creator does not build with final changes-especially with qml- unless clean/rebuild)