Important: Please read the Qt Code of Conduct -

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?


    #include <QObject>
    #include <QDebug>
    #include "readermanager.h"
    class ReaderManagerQMLInterface : public QObject
        explicit ReaderManagerQMLInterface(QObject *parent = 0);
        readerManager rManager;
        void reqIm();
    public slots:
        void sendImage(QImage &imgQImage); //cv::mat removed


    #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
            explicit imageReader(QObject *parent = 0);
            imgHelpers imHelpers;
            void sendImage(QImage &imgQImage);//cv::mat removed
        public slots:
            void requestImage();
            void setFrame(int frameID);
            void loadImage(QString fileName);

  • Lifetime Qt Champion

    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.

  • Lifetime Qt Champion

    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, you can find details in there.

  • Lifetime Qt Champion

    To sum up what happened is that you were trying to send a reference to a temporary object thus it failed

  • @SGaist

    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)

Log in to reply