Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7624433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:57:48+00:00 2026-05-31T04:57:48+00:00

In short, I get following error: QObject::connect: Cannot queue arguments of type ‘cv::Mat’ (Make

  • 0

In short, I get following error:

QObject::connect: Cannot queue arguments of type 'cv::Mat'
(Make sure 'cv::Mat' is registered using qRegisterMetaType().)

What I’m trying to do is send a signal containing two cv::Mat images from a QThread to the main thread, so that I can display the output. There’s no compile time error, but when I run the program, it gets stuck at a breakpoint in qglobal.h (inline void qt_noop() {}).

I’ve tried to add Q_DECLARE_METATYPE(cv::Mat) to the code, to no avail. I’m quite suck with what to do now.

code

In a QThread class:

signals:
void sndFlow(cv::Mat &leftEye, cv::Mat &rightEye);

void eyesDriver::run()
{
    forever
    {
        flow->draw(leftEye, rightEye);
        sndFlow(leftEye, rightEye);
    }
}

Capturing in a QObject class:

public slots:
void recFlow(cv::Mat &leftEye, cv::Mat &rightEye);

void myClass::recFlow(cv::Mat &leftEye, cv::Mat &rightEye)
{
    cv::imshow("left", leftEye);
    cv::imshow("rigth", rightEye);
    cv::waitKey(40);
}

In main:

Q_DECLARE_METATYPE(cv::Mat)
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    qRegisterMetaType< cv::Mat >("cv::Mat");
    // create objects from QThread and QObject class
    QObject::connect(&qthread, SIGNAL(sndFlow(cv::Mat&,cv::Mat&)),
                     &qobject, SLOT(recFlow(cv::Mat&,cv::Mat&)));
    qthread.start();
    return a.exec();
}

Changing the signal-slot variables to QSharedPointer< cv::Mat > does not work either. Gives the same error:

QObject::connect: Cannot queue arguments of type 'QSharedPointer<cv::Mat>'
(Make sure 'QSharedPointer<cv::Mat>' is registered using qRegisterMetaType().)

WORKS

All right, it seems to work. I’ve move qRegisterMetaType< cv::Mat >("cv::Mat"); right before the QObject::connect call. However I still have to ‘F5’ past the breakpoint in qglobal.h, it works afterwards.

I might be wrong, but it seems that the location of qRegisterMetaType is not trivial.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:57:49+00:00Added an answer on May 31, 2026 at 4:57 am

    You need to call qRegisterMetaType in addition to the macro (or instead of it, depending on your needs). This is necessary for the signals to be able to marshal your data across threads. However, it might be a wiser idea to pass by reference or smart pointer, or raw pointer if you are using the QObject hierarchy to manage the object lifetime.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get the following error at this line: const short pcmSample = *reinterpret_cast<const short*>(*(buffer->index));
I get the following error: 1>c:\documents and settings\krzys\desktop\desktop icons\ollydbg\plugins\odbgscript\OllyLangCommands.cpp(3602): error C2593: 'operator =' is
When I start etop on my machine I get the following error message: =ERROR
I get the following error message for the code below: Failure/Error: @league.errors.on(:short_name).should_equal can't be
Any short code to get the database table prefix in cakephp controller action ?
I'm trying to get get the short filename from a long filename but I'm
my question is , I want to get some short and smart ideas to
I need a short code snippet to get a directory listing from an HTTP
Is there a short way to check/get for least significant bit in a 32-bit
Short version: I have a similar setup to StackOverflow. Users get Achievements. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.